Registry / testing / hacking

hacking

JSON →
library8.0.0pypypiunverified

Hacking is an OpenStack project that provides a set of Flake8 plugins to enforce the OpenStack Hacking Guidelines for Python code. It helps developers maintain consistent code style and identify common pitfalls specific to the OpenStack development community. The current version is 8.0.0, and it follows a release cadence tied to OpenStack cycles, with updates typically occurring every few months or as new guideline enforcement is required.

pip install flake8 hacking
INSTALL
IMPORT
SIG · HACKING
H
hacking
testingpythonv8.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

This quickstart demonstrates how to install `flake8` and `hacking`, create a sample Python file with a common OpenStack hacking violation (H301), and then run `flake8` to see the generated warning. `hacking` automatically integrates its checks with `flake8` upon installation.

mkdir my_project cd my_project echo "def my_func( value ):\n # H301: no space after parameters\n pass" > app.py pip install flake8 hacking flake8 app.py
Debug
Known issues
breaking`hacking` version 8.0.0 and newer requires Python 3.10 or higher. Projects on older Python versions must use an older `hacking` release.
fix
Upgrade your Python environment to 3.10+ or pin `hacking` to a compatible older version (e.g., `hacking<8.0.0`) if Python upgrade is not feasible.
affects: >=8.0.0
breaking`hacking` version 8.0.0 and newer requires `flake8` version 6.0.0 or higher. Older `flake8` versions are incompatible.
fix
Ensure `flake8>=6.0.0` is installed in your environment alongside `hacking`. Use `pip install --upgrade flake8`.
affects: >=8.0.0
gotchaThe `hacking` library is a `flake8` plugin and is not designed for direct import and usage in Python code. Its checks are automatically discovered and applied by `flake8`.
fix
Instead of `import hacking`, run `flake8` from your command line in your project directory. `hacking` contributes checks that `flake8` then executes.
affects: *
Errors
Common errors & fixes
ImportError: No module named 'hacking'
Attempting to import `hacking` directly into a Python script.
fix
`hacking` is a `flake8` plugin, not a library for direct import. Ensure it's installed (`pip install hacking`) and then run `flake8` from your terminal.
flake8: error: unrecognized arguments: --select H301
Trying to explicitly enable or select `hacking` checks (e.g., H301) via command-line arguments, which are already integrated by `hacking`.
fix
Remove `--select Hxxx` arguments. `hacking` checks are automatically included. If you need to enable/disable specific checks, use a `.flake8` or `pyproject.toml` configuration file (e.g., `[flake8]\nignore = H301` to ignore).
Upgrade
Version history
8.0.0latest on PyPI · released Nov 6, 2025
Audit
Dependencies
flake8requiredHacking is a Flake8 plugin and requires Flake8 to function.
Agent activity
8 hits · last 30 days
node
8
Resources
hacking — pip install hacking · libregistry