Registry / testing / pylint-plugin-utils

pylint-plugin-utils

JSON →
library0.9.0pypypi✓ verified 26d ago

Pylint Plugin Utilities (version 0.9.0) provides a collection of helper functions and classes designed to simplify the development of custom Pylint checkers and transformers. It abstracts away common boilerplate and provides tools for AST manipulation and message suppression. The library maintains a steady release cadence, typically aligning with Pylint's own major versions to ensure compatibility.

pip install pylint-plugin-utils
INSTALL
IMPORT
SIG · PYLINT-PLUGIN-UTIL
P
pylint-plugin-utils
testingpythonv0.9.0
Install
2.7s avg
Import
513ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.0 · 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.528s · 26.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.7s · import 0.498s · 27MB
26MB installed
● package 26MB
Code
Verified usage

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

suppress_message
from pylint_plugin_utils import suppress_message
from pylint_plugin_utils.utils import suppress_message
get_checker
from pylint_plugin_utils import get_checker
get_class
from pylint_plugin_utils import get_class

This quickstart demonstrates how to create a basic Pylint checker using `pylint-plugin-utils` to detect direct calls to `print`. It also shows the use of the `suppress_message` decorator to exempt specific code from Pylint's default checks. The `register` function is the standard entry point for Pylint plugins.

# my_plugin.py from pylint.checkers import BaseChecker from pylint_plugin_utils.messages import add_message from pylint_plugin_utils.utils import suppress_message # Define a custom message ID and details MY_MSG = 'W9999' MY_MSG_ID = 'no-direct-print' MY_MSG_STR = 'Avoid calling "print" directly in production code.' class NoPrintChecker(BaseChecker): """ Checks for direct calls to the 'print' function. """ name = 'no-print-checker' priority = -1 msgs = { MY_MSG: ( MY_MSG_STR, MY_MSG_ID, 'Avoid using print for logging in production; use a proper logger instead.', ) } def visit_call(self, node): """Called for every function call.""" if node.func.as_string() == 'print': add_message(self, MY_MSG_ID, node=node) # Example of using suppress_message decorator @suppress_message('invalid-name') def ThisFunctionIsAllowedToHaveAnInvalidName(): pass def register(linter): """Register the checker with Pylint.""" linter.register_checker(NoPrintChecker(linter)) # To run this plugin: # 1. Save the above code as `my_plugin.py`. # 2. Create a test file, e.g., `test_code.py`: # print("Hello, World!") # ThisFunctionIsAllowedToHaveAnInvalidName() # 3. Run Pylint with the plugin: `pylint --load-plugins=my_plugin test_code.py` # This will report 'no-direct-print' for `print` and suppress 'invalid-name' for the function.
Debug
Known issues
breakingPylint version compatibility changed; `pylint-plugin-utils` 0.9.0 now requires `Pylint >= 2.16`.
fix
Ensure your `Pylint` installation is version 2.16 or newer. Upgrade `Pylint` using `pip install --upgrade pylint`.
affects: 0.9.0 onwards
breakingThe `register_linter_extension` function has been removed.
fix
This function was deprecated in 0.8.0. Plugins should use the standard `register(linter)` function in their module, and within it, call `linter.register_checker()` or similar methods directly.
affects: 0.9.0 onwards
breakingThe `fix_pythonpath` function has been removed.
fix
This function was primarily used for older Pylint setups to manipulate `sys.path`. Ensure your plugin's dependencies are correctly available on `PYTHONPATH` or use Pylint's `--init-hook` option for path manipulation if necessary.
affects: 0.8.0 onwards
gotchaPylint plugins are not automatically discovered by default; they must be explicitly loaded.
fix
To enable a plugin, Pylint must be invoked with `--load-plugins=your_plugin_module`. For more persistent configuration, define plugins in your `pyproject.toml` or `.pylintrc` file under the `[MASTER]` section using the `load-plugins` option.
affects: All versions
Upgrade
Version history
0.9.0latest on PyPI · released Jun 24, 2025
Audit
Dependencies
pylintrequiredRequired for Pylint plugin development and execution. Ensure compatibility with Pylint >= 2.16 for version 0.9.0 of this library.
Agent activity
3 hits · last 30 days
node
2
Resources
pylint-plugin-utils — pip install pylint-plugin-utils · libregistry