Skip to main content

Rattle

Tests Documentation Status PyPI version Supported versions Downloads License: MIT

Rattle is a Python linting framework built on LibCST with support for autofixes, custom in-repo lint rules, and hierarchical configuration.

Rattle is a fork of Fixit designed to complement Ruff. It intentionally omits rules that duplicate Ruff checks, so pair it with a comprehensive Ruff configuration; Ruff is considerably faster for those checks.

For migration from Fixit, overlapping Fixit-derived rules remain available in the opt-in legacy collection. This collection is not recommended for new configurations.

Features

  • 52 built-in lint rules
  • Autofix support when a rule can safely rewrite code
  • Local custom rules that can live inside your repository
  • Hierarchical pyproject.toml configuration
  • Pre-commit integration for CI and local workflows
  • LSP support

Install

From PyPI

uv tool install rattle-lint
pip install rattle-lint

With editor/LSP support

uv tool install "rattle-lint[lsp]"
pip install "rattle-lint[lsp]"

Agent Skill

The official AI agent skill can be installed from this repo.

npx skills add https://github.com/zigai/rattle/tree/main/src/rattle/.agents/skills/create-rattle-lint-rules

or

uvx library-skills

Basic Usage

Rattle enables no rules by default. A practical baseline for a typical typed Python project is:

[tool.rattle]
root = true
enable = [
    "blank-line-after-control-block",
    "blank-line-after-terminal-control-block",
    "blank-line-before-branch",
    "blank-line-before-unrelated-block",
    "no-suite-leading-trailing-blank-lines",
    "module-all-at-bottom",
    "no-underscore-all-exports",
    "forbidden-call",
    "no-relative-imports",
    "no-underscore-import-aliases",
    "no-unsafe-tempfile-factories",
    "no-annotated-self",
    "no-exception-message-variables",
    "no-str-exception-translation",
    "no-underscore-class",
    "public-method-order",
    "no-bare-object-annotations",
    "no-named-tuple",
    "no-static-if-condition",
    "sorted-attributes",
    "use-callable-ellipsis",
]

[tool.rattle.options."forbidden-call"]
forbidden_calls = ["typing.cast"]

Adjust the list to match the project, then check the repository. Rattle uses the invoked Python environment; install custom-rule dependencies there. For a uv-managed project, install Rattle as a project dependency and use uv run python -m rattle check ..

rattle check .

Apply available autofixes:

rattle check --fix .

Explain rule metadata, examples, and settings:

rattle explain no-bare-object-annotations
rattle explain --json no-bare-object-annotations

License

MIT

Metadata

Release files for rattle-lint 3.5.0

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

Source distribution (sdist)

Source distribution for rattle-lint 3.5.0
File Size Uploaded Provenance Actions
rattle_lint-3.5.0.tar.gz 341.7 kB Without provenance Details for rattle_lint-3.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rattle-lint 3.5.0
File Interpreter ABI Platform Actions
rattle_lint-3.5.0-py3-none-any.whl Python 3 none any Details for rattle_lint-3.5.0-py3-none-any.whl

Total release size: 560.3 kB

Release files / rattle_lint-3.5.0.tar.gz

Download URL rattle_lint-3.5.0.tar.gz
Size 341.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7a88c67e222e39cb6c545bb3da5c9186b3d2d1b23981b5d5d31c1bbd483dd6dc
BLAKE2b-256 checksum
How to use checksums
25d941ed84f638b5bf135be9b2f68cfc2f1601361f282035b559a7535597bf13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / rattle_lint-3.5.0-py3-none-any.whl

Download URL rattle_lint-3.5.0-py3-none-any.whl
Size 218.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ce658e96832134351428c35b3af6c5f1a408f9e6b0c40af0d83e9e3d86305df
BLAKE2b-256 checksum
How to use checksums
b018207632302a873c15fa733f24dd837a17acad42955f2354009ae42a887e5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for rattle-lint 3.5.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

3.5.0 This release

2 release files No provenance

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