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

  • 51 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 lint the repository:

rattle lint .

Apply available autofixes:

rattle 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.2.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.2.0
File Size Uploaded
rattle_lint-3.2.0.tar.gz 342.6 kB Details

Built distribution (wheel)

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

Total release size: 555.7 kB

Release files / rattle_lint-3.2.0.tar.gz

Download URL rattle_lint-3.2.0.tar.gz
Size 342.6 kB
Tags Source
SHA-256 checksum
How to use checksums
88c71765fafbd455da8d6bc373c18af601f42251888f4770b95675a3336c79af
BLAKE2b-256 checksum
How to use checksums
09b56506759e7a9684f0ec8b504bb6528dd23d9472c3504230307ab71a0e4040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

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

Download URL rattle_lint-3.2.0-py3-none-any.whl
Size 213.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1ee78336c82ee98064c6d2191dc00a6ca7e6298bec619b762cb3561ea0194a7
BLAKE2b-256 checksum
How to use checksums
d56cdb1d9e3f48fa17f33ee73ce3119908ededf1db166b7e03143d007bc0eea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release history Release notifications | RSS feed

3.3.0

2 release files

This release

3.2.0 This release

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.4

2 release files

2.5.3

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

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