Repolode
openstack

openstack/hacking

A set of flake8 plugins that check Python code against the OpenStack style guide.

Stars
243
Forks
67
Open issues
0
Last commit
2 months ago

What is it?

Hacking is a collection of flake8 plugins that enforce the OpenStack Python style guide. It automates checks that would otherwise be done by hand during code review, such as import ordering, docstring rules, and patterns the OpenStack community considers risky, like shadowing built-in names.

Checks are named with an H prefix and are installed from PyPI together with the flake8, pep8, mccabe and pyflakes plugins it depends on. Dependencies are pinned, so a new upstream release will not silently add rules that break existing gating jobs. Versioning follows major.minor.maintenance, where maintenance releases never add new checks, so projects can pin to a minor version safely.

Some checks are off by default, such as those for assertion style and eventlet imports, and can be enabled in the flake8 section of tox.ini. Projects can also define local checks in tox.ini and implement them with the flake8 extension decorator.

Key features

  • 01Enforces the OpenStack Python style guide through flake8 plugins.
  • 02Installs from PyPI with pinned dependencies to keep CI gates stable.
  • 03Maintenance releases never add new checks, so minor-version pins stay safe.
  • 04Some checks are off by default and can be enabled in tox.ini.
  • 05Supports project-specific local checks registered in tox.ini.

Use cases

  • Gating code reviews in OpenStack projects so style nitpicks are caught automatically.
  • Enforcing consistent Python style across a large codebase written by many authors.
  • Adding project-specific lint rules alongside the standard OpenStack checks.

Quick start

  1. 1

    Install hacking from PyPI

    pip install hacking

Things to know

  • Hacking pins its dependencies, so it can conflict with newer versions of flake8 or plugins in your environment.
  • Many checks are OpenStack-specific and off by default for other projects.

In collections

Topics

FAQ

What is hacking?
A set of flake8 plugins that check Python code against the OpenStack style guide. Hacking is a collection of flake8 plugins that enforce the OpenStack Python style guide. It automates checks that would otherwise be done by hand during code review, such as import ordering, docstring rules, and patterns the OpenStack community considers risky, like shadowing built-in names.
Is hacking free to use? What license does it have?
hacking is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is hacking still maintained?
Updated within 6 months. The last commit to hacking was on Sep 14, 2026.
What can I use hacking for?
Gating code reviews in OpenStack projects so style nitpicks are caught automatically. Enforcing consistent Python style across a large codebase written by many authors. Adding project-specific lint rules alongside the standard OpenStack checks.
How do I install hacking?
Install hacking from PyPI: pip install hacking
Where can I get hacking?
The source code and installation instructions are on GitHub: https://github.com/openstack/hacking

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects