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.

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.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 runs with no enabled rules until a project enables them in pyproject.toml:

[tool.rattle]
enable = ["fixit"]
rattle lint

Apply available autofixes:

rattle fix

Explain rule metadata, examples, and settings:

rattle explain use-f-string
rattle explain --json use-f-string

Example Configuration

[tool.rattle]
root = true
enable = ["fixit"]
python-version = "3.10"
disable = [
    "no-static-if-condition",
    "use-rattle-ignore-comment",
]
per-file-disable = {"tests/generated.py" = ["no-named-tuple"]}

# Apply extra rules only under the src/ directory.
[[tool.rattle.overrides]]
path = "src"
enable = ["fixit-extra"]

[[tool.rattle.overrides]]
path = "tests"
enable = ["no-named-tuple"]

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rattle_lint-2.5.4.tar.gz (298.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rattle_lint-2.5.4-py3-none-any.whl (218.4 kB view details)

Uploaded Python 3

File details

Details for the file rattle_lint-2.5.4.tar.gz.

File metadata

  • Download URL: rattle_lint-2.5.4.tar.gz
  • Upload date:
  • Size: 298.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for rattle_lint-2.5.4.tar.gz
Algorithm Hash digest
SHA256 91d801fc5a9797d4009c502079d062a7633ff23169b06a582369da08d6150178
MD5 e71b9fccafb7391053cf490dc23c698a
BLAKE2b-256 c50ec3d21244a27cc8d04e3d560e9a52471677ec086c9acf3e922ca5bb33bc18

See more details on using hashes here.

File details

Details for the file rattle_lint-2.5.4-py3-none-any.whl.

File metadata

  • Download URL: rattle_lint-2.5.4-py3-none-any.whl
  • Upload date:
  • Size: 218.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for rattle_lint-2.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fbf8ec44b709c93f5fd1fc51c4f9621c079514f660b93e1cae31feb83f62cd27
MD5 c811dddc0298ece1d56121391e8b36e4
BLAKE2b-256 bfcb7510e61bafba8a316e921523f9fc86085177b25974bc8af1026bac587d11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page