Registry / testing / pylint-venv

pylint-venv

JSON →
library3.0.4pypypi✓ verified 86d ago

pylint-venv provides a Pylint init-hook to automatically use the same Pylint installation with different virtual environments. Version 3.0.4 supports Python 3.7-3.13 and Pylint 3. It resolves virtual environment paths and configures the hook via pylintrc, pyproject.toml, or toml. Released as needed.

pip install pylint-venv
INSTALL
IMPORT
SIG · PYLINT-VENV
P
pylint-venv
testingpythonv3.0.4
Install
1.6s avg
Import
11ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.4 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.008s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

inithook
from pylint_venv import inithook
inithook is the main function to install the hook.

Configure Pylint to automatically detect and use the virtual environment's packages.

# Add to your .pylintrc [MAIN] section: # init-hook=import pylint_venv; pylint_venv.inithook() # Or programmatically: from pylint_venv import inithook inithook()
Debug
Known issues
breakingIn v3.0.0, the `force_venv_activation` argument to `inithook` must be passed as a keyword argument. Positional usage breaks.
fix
Use `inithook(force_venv_activation=True)` instead of `inithook(True)`.
affects: >=3.0.0
gotchaThe init-hook must be placed in the `[MAIN]` section of .pylintrc, not elsewhere like `[BASIC]`. Common mistake.
fix
Ensure the line is under `[MAIN]` in your configuration file.
affects: all
gotchaWhen using `pyproject.toml`, the hook must be configured via `[tool.pylint.MAIN]` section. People often put it under wrong tool table.
fix
Place configuration under `[tool.pylint.MAIN]` in pyproject.toml.
affects: >=3.0.3
deprecatedPython 3.6 support was removed in v3.0.0. Using pylint-venv 3.x on Python 3.6 will fail.
fix
Upgrade Python to 3.7+ or use pylint-venv 2.x.
affects: >=3.0.0
Errors
Common errors & fixes
ValueError: 'force_venv_activation' must be passed as a keyword argument
Using `inithook(True)` in pylint-venv 3.0+ where positional arguments are no longer allowed.
fix
Change to `inithook(force_venv_activation=True)`.
ModuleNotFoundError: No module named 'pylint_venv'
pylint-venv not installed in the environment where pylint runs, or wrong Python interpreter.
fix
Install pylint-venv in the same environment as pylint: `pip install pylint-venv`.
pylint: error: argument --init-hook: invalid value: 'import pylint_venv; pylint_venv.inithook()'
The init-hook string in .pylintrc is not properly escaped or has syntax errors.
fix
Ensure the hook is on one line and does not contain quotes that break the config parser. Use: `init-hook=import pylint_venv; pylint_venv.inithook()`
Upgrade
Version history
3.0.4latest on PyPI · released Oct 27, 2024
Audit
Dependencies
pylintrequiredRequired. pylint-venv is a plugin that modifies Pylint's behavior.
Agent activity
9 hits · last 30 days
node
6
Resources
pylint-venv — pip install pylint-venv · libregistry