Skip to main content

Gruff

Gruff is an opinionated, deterministic maintainability linter for Python. It complements Ruff with project policies that make agent-assisted code easier to understand and review; it does not infer who or what wrote the code.

Installation

Requires Python 3.10 or later.

pip install gruff

Or with uv:

uv tool install gruff

Verify it works:

gruff --version

Quick start

Enable the baseline rules in pyproject.toml:

[tool.gruff.lint]
select = ["GR:baseline"]

Then check the current directory:

gruff check .

All rules are opt-in. Each rule belongs to a tier that states what adopting it costs. Start with the baseline rules, then add opinionated rules one code at a time. GR:baseline, GR:opinionated, and GR:api-shaping select a whole tier. GR enables every Gruff rule, including the API-shaping tier. A check with no enabled rules succeeds but warns that it performed no policy analysis.

Rules at a glance

The first release tests eleven theses: inputs are easier to trace when definitions declare how callers pass them, non-public behavior is easier to review when callers supply every value, package initializer manifests are easier to review when every public import path defines __all__, constants are easier to review when uppercase names and Final annotations always appear together, non-public definitions are easier to understand when their names carry their purpose, comments are worth reading when they state more than the code beneath them, tests are worth running when an exception can still fail them, a body is easier to follow when its trailing condition inverts into a guard, a branch is easier to verify when its condition states the positive form, a non-public module binding is easier to find when it lives in the one definition that reads it, and public instance data is easier to review when properties declare its interface.

Baseline

Few projects disagree with these rules. A fix usually stays inside one module, but GR004 can rename a constant that other code imports, and a GR014 fix renames a name across modules.

Code Rule Policy
GR002 no-uniform-non-public-defaults Some calls in its module pass a module-private default and others omit it.
GR003 package-dunder-all Every public package import path defines __all__.
GR004 final-constants Uppercase names and Final annotations appear together.
GR007 no-subsumed-comments One-line comments state something beyond the statements they annotate.
GR008 no-exception-swallowing-tests Tests let exceptions propagate instead of swallowing them.
GR014 no-non-public-imports Non-public names stay inside the module that defines them.

Opinionated

These rules take a style position that some projects reject. A fix usually stays inside the project, but GR012's getter-only property fix stops outside code from assigning the attribute.

Code Rule Policy
GR001 explicit-non-public-input-conventions Every fixed input to a non-public callable has an explicit calling convention.
GR006 no-non-public-docstrings Non-public definitions carry their purpose in their names instead of docstrings.
GR009 no-guarded-tails Trailing conditions invert into guards instead of nesting the rest of the body.
GR010 positive-branch-conditions Branch conditions state the positive form instead of negating around an else.
GR011 no-single-consumer-module-bindings Non-public module bindings live in the one definition that reads them.
GR012 explicit-instance-data Public instance data is explicit through class-body annotations or properties.
GR013 keyword-only-non-public-inputs Every fixed input to a non-public callable is keyword-only.
GR015 explicit-private-instance-data Private instance data is declared through class-body annotations.

API-shaping

Fixing a finding changes a public signature, which can break callers outside the project. On a published library, adopt these rules with a major release.

Code Rule Policy
GR005 explicit-public-input-conventions Every fixed input to a public callable has an explicit calling convention.

Each rule links to its rule doc, which states what the rule flags, why, an example, and when to suppress. gruff rule GR004 prints the same document in the terminal, and gruff rule --all --output-format json emits every rule and its tier for tooling.

Documentation

The documentation site carries the rule docs, and its configuration page covers pyproject.toml, the command-line reference, suppressing findings, and the recommended Ruff pairing.

Distribution

Gruff releases use PyPI wheels for Linux x86_64 and aarch64, macOS x86_64 and arm64, and Windows x86_64. Gruff is not published to crates.io.

Metadata

Release files for gruff 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for gruff 0.2.5
File Actions
gruff-0.2.5-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for gruff-0.2.5-py3-none-win_amd64.whl
gruff-0.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for gruff-0.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
gruff-0.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for gruff-0.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
gruff-0.2.5-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for gruff-0.2.5-py3-none-macosx_11_0_arm64.whl
gruff-0.2.5-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for gruff-0.2.5-py3-none-macosx_10_12_x86_64.whl

Total release size: 10.3 MB

Release files / gruff-0.2.5-py3-none-win_amd64.whl

Download URL gruff-0.2.5-py3-none-win_amd64.whl
Size 2.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
96793791965098d958c3ab315015dc4679c520e026ec7fa989434740b6079310
BLAKE2b-256 checksum
How to use checksums
980cc1ec1af5ec79df0e71aed2de2102947ef50ef2b9bbdda05064abb9e760c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / gruff-0.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gruff-0.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.1 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
b69371cb3b1bb3078cbc344cea7f931436cc426022e5aec6d2ba79fee4f93b36
BLAKE2b-256 checksum
How to use checksums
b0d7fda5da424906014799be0dc983a2ac7239af04825d9b5ee985b24d866f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / gruff-0.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL gruff-0.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
9bb2c95fc1b639b9d0a4d072d94d26a682e50f6a1199039f160d547438a15227
BLAKE2b-256 checksum
How to use checksums
69953dada808ad9ffb0ce7287f96a5897b9dc979c2554fa75b641096ec2488b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / gruff-0.2.5-py3-none-macosx_11_0_arm64.whl

Download URL gruff-0.2.5-py3-none-macosx_11_0_arm64.whl
Size 2.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
99cb6fa8de9a094a11c49d0b9290ca4a317c6c183864ec8ea6f350f72f00f4e7
BLAKE2b-256 checksum
How to use checksums
d18ed75b38acf0ed45cc38d53ec2ad6bf684cc77452b6f6c3538aa2162048760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / gruff-0.2.5-py3-none-macosx_10_12_x86_64.whl

Download URL gruff-0.2.5-py3-none-macosx_10_12_x86_64.whl
Size 2.1 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c1512b3142870d556ae97613318ec7fcb8eb8a3d40ca9e2ed33dff8968721d14
BLAKE2b-256 checksum
How to use checksums
01f4df419596988193e85ea691b93c77ff140007422a23faf3c0f9b2c2de27a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for gruff 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for gruff-0.2.5-py3-none-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page