Registry / testing / flake8-variables-names

flake8-variables-names

JSON →
library0.0.6pypypiunverified

Flake8 Variables Names is a Flake8 extension designed to promote more readable variable names in Python code. It identifies single-character variable names or overly common and ambiguous names such as 'result', 'value', or 'info', flagging them for clarification. The current version is 0.0.6, with releases occurring periodically to introduce new features and fix bugs.

pip install flake8-variables-names
INSTALL
IMPORT
SIG · FLAKE8-VARIABLES-N
F
flake8-variables-names
testingpythonv0.0.6
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VariableNamesChecker
This is a Flake8 plugin and typically doesn't require direct imports in user code for its core functionality. It is automatically loaded by Flake8 upon installation. For programmatic access to its version, you might import from `flake8_variables_names`.
Flake8 plugins are activated through Flake8's configuration or command-line execution, not via direct imports in application code.

After installation, `flake8-variables-names` automatically integrates with `flake8`. Run `flake8` from your terminal to apply checks. Configuration, including enabling strict mode, can be done via command-line arguments or in a `flake8` configuration file (e.g., `setup.cfg`, `tox.ini`, or `.flake8`).

# 1. Install the library # pip install flake8 flake8-variables-names # 2. Create a Python file, e.g., my_module.py # def process_data(d): # i = 0 # res = d * 2 # info = 'processed' # return res, info # 3. Run flake8 on your file or project # flake8 my_module.py # Example of flake8 output: # my_module.py:2:13: VNE001 single letter variable names like 'd' are not allowed # my_module.py:3:5: VNE001 single letter variable names like 'i' are not allowed # my_module.py:4:5: VNE002 variable name 'res' should be clarified # my_module.py:5:5: VNE002 variable name 'info' should be clarified # 4. To enable strict mode (more aggressive checks): # flake8 --use-varnames-strict-mode my_module.py # Or in a config file (setup.cfg, tox.ini, or .flake8): # [flake8] # use-varnames-strict-mode = True
Debug
Known issues
breakingIn version `0.0.6`, a bug fix changed the behavior for multiple assignments. Expressions like `a, b = 1, 2` are now correctly marked as invalid if `a` or `b` violate naming conventions.
fix
Review existing code with multiple assignments (`a, b = 1, 2`) after updating to `0.0.6` to ensure compliance with the updated variable naming rules. Adjust variable names as required by the linter's output.
affects: >=0.0.6
gotchaBy default, `flake8-variables-names` operates in a 'non-strict' mode. This means some common but ambiguous variable names (e.g., 'data', 'result', 'value') are not flagged unless 'strict mode' is explicitly enabled.
fix
To enable more comprehensive checks, activate strict mode. Use the `--use-varnames-strict-mode` command-line option or add `use-varnames-strict-mode = True` to your `[flake8]` configuration in `setup.cfg`, `tox.ini`, or `.flake8`.
affects: All versions
gotchaThe plugin introduces specific error codes (VNE001, VNE002, VNE003) for various naming violations. Not understanding these codes can make it difficult to interpret `flake8`'s output.
fix
Familiarize yourself with the error codes: VNE001 for single-letter variable names, VNE002 for ambiguous/unclarified names, and VNE003 for names shadowing builtins. Refer to the plugin's documentation or source code for a complete list and their meanings to effectively resolve reported issues.
affects: All versions
Upgrade
Version history
0.0.6latest on PyPI · released Jun 22, 2023
Audit
Dependencies
flake8requiredThis is a plugin for Flake8 and requires Flake8 to be installed to function.
Agent activity
6 hits · last 30 days
node
6
Resources
flake8-variables-names — pip install flake8-variables-names · libregistry