flake8-plugin-utils is a Python package providing base classes and utility functions to simplify the creation of custom plugins for the Flake8 linter. It aims to reduce boilerplate and offer helpful tools for AST (Abstract Syntax Tree) analysis within Flake8 plugins. The current version is 1.3.3, released on 2022-01-14, with a moderate release cadence based on contributions.
pip install flake8-plugin-utilsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a custom Flake8 error, a visitor to detect specific AST patterns (here, the use of 'footgun' as a variable name), and a minimal plugin integrating these components. It also shows a basic test using `assert_error`.
Change `class MyPlugin(Plugin):` to `class MyPlugin(Plugin[None]):` and `class MyVisitor(Visitor):` to `class MyVisitor(Visitor[None]):` if no custom config is used. Otherwise, use your config class as the type parameter (e.g., `Plugin[MyConfig]`).
Verify your `setup.py` contains an `entry_points` section like `{'flake8.extension': ['X = your_package.your_module:YourPluginClass']}`. The 'X' should be your plugin's unique error code prefix (e.g., 'X100', 'Y200').Manually remove any orphaned configuration sections related to uninstalled plugins from your Flake8 configuration files. Use `flake8 --isolated` during testing to ensure only command-line options are considered, or specify a clean config file.
No dependency data recorded yet.