Rattle
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.
Features
- 48 built-in lint rules
- Autofix support when a rule can safely rewrite code
- Local custom rules that can live inside your repository
- Hierarchical
pyproject.tomlconfiguration - 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rattle_lint-2.6.0.tar.gz.
File metadata
- Download URL: rattle_lint-2.6.0.tar.gz
- Upload date:
- Size: 315.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe9e598746f1b002990fa9c43b111f9fb99a40c372ea4de712858cc335a0b540
|
|
| MD5 |
7a6b2f6879e964bf9f23a3666d7dc768
|
|
| BLAKE2b-256 |
1fc2c0f57bf660827f2bb85c3df1ac159d19f52b5d71363a100f9fe59ccf349f
|
File details
Details for the file rattle_lint-2.6.0-py3-none-any.whl.
File metadata
- Download URL: rattle_lint-2.6.0-py3-none-any.whl
- Upload date:
- Size: 236.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8471811471fd9e1644c289c60ac15bb5a431569f1fc48c6d268ea9da863f52b9
|
|
| MD5 |
f10c2d7a9a21eee42bd2705652743ddc
|
|
| BLAKE2b-256 |
47d89772e64b67d52c8ec8d67919f55f0a3d8a8d744556e72afd083517809229
|