A pragmatic, resilient Python linter and formatter
Project description
Drace – The Pragmatic Linter & Formatter
Drace is a resilient, opinionated, and user-centric linter + formatter for Python. It doesn't just enforce convention — it encourages better code thinking, inspired by The Pragmatic Programmer and real-world software philosophies.
Features
- Resilient Parsing: Drace won't crash on fatal syntax errors — it continues linting and shows where things broke
- Custom Linting Rules: Includes pragmatic and aesthetic rules like:
Z200: Suggests one-liners where appropriateZ202: Suggests refactoring for DRY-nessZ221: Warns about bloated functionsZ222: Flags high external dependency usage
- AST-based & Rule-based Checks: Deep analysis where needed, quick rules where not
- Formatter Included: Drace has a formatter with opinionated but readable output
- User-Friendly Config System:
- Supports CLI and interactive (USSD-like) editing
- Temporary overrides and persistent defaults
- Readable Output:
- Colored, well-padded output for clarity
- Aligns messages visually for fast scanning
Installation
pip install drace
Usage
Linting & Formatting
drace lint path/to/file.py # Lint a file
drace format path/to/file.py # Format a file
drace # Defaults to linting current directory
Scoring Code Quality
drace score path/to/dir
Calculates a "Darkian Standard" score based on lines vs issues.
Configuration
drace config # Launch interactive (USSD-style) config
drace config line_len 100 # Set line length limit
drace config list # View current config
drace config reset # Reset all defaults
drace config reset line_len # Reset a key
Drace allows multiple separator styles: =, :, ::, etc:
drace config line_len = 100
Philosophy
Drace is pragmatic-first. It values readability, clarity, and real-world coding sensibilities over strict adherence to PEP8. It helps you write code that's both clean and thoughtful.
Unlike tools like flake8 or black, Drace:
- Handles broken files gracefully
- Suggests deeper improvements (e.g., cohesion, function size)
- Doesn't treat aesthetics and logic as separate
Limitations
- Slower than others: Due to deep AST analysis and graceful error handling, Drace may take its time (about 2 seconds longer) on large, nested files
- Currently Python-only: But support for other languages might arrive as I learn them (Go will probably be supported soon)
- Opinionated: May conflict with pure PEP8 setups
License
Drace is free to use, modify, and distribute. See LICENSE
Contributing
Have suggestions or want to add new rules?
Pull requests and ideas welcome — Drace is built to grow.
Project details
Release history Release notifications | RSS feed
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 drace-2.0.3.tar.gz.
File metadata
- Download URL: drace-2.0.3.tar.gz
- Upload date:
- Size: 112.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e38177779e62b8b0ef5d90266ee8f67398081935b45817a6e10311a6e52e8c97
|
|
| MD5 |
67bf91cb918fd8bec533410d93a36ed3
|
|
| BLAKE2b-256 |
012a4ef91f2f29d2ef49b787db03f47cee7bbd4343b141fc172aaea2ce2aacc2
|
Provenance
The following attestation bundles were made for drace-2.0.3.tar.gz:
Publisher:
publish.yml on 2kDarki/drace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drace-2.0.3.tar.gz -
Subject digest:
e38177779e62b8b0ef5d90266ee8f67398081935b45817a6e10311a6e52e8c97 - Sigstore transparency entry: 835713293
- Sigstore integration time:
-
Permalink:
2kDarki/drace@fb8b650806b48f468edc158c991b6e930843b185 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/2kDarki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fb8b650806b48f468edc158c991b6e930843b185 -
Trigger Event:
push
-
Statement type:
File details
Details for the file drace-2.0.3-py3-none-any.whl.
File metadata
- Download URL: drace-2.0.3-py3-none-any.whl
- Upload date:
- Size: 124.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b87a4ba3131d6142d9b8bd61e2103594a1ec8ae0aaa798d5ad763af7ca436c92
|
|
| MD5 |
26b3c9a218fa399c652bf7b7c78744e8
|
|
| BLAKE2b-256 |
3fc0f04039bf21526745c9bc3e246bf3bf503b5a6b7be828add4f555ef828928
|
Provenance
The following attestation bundles were made for drace-2.0.3-py3-none-any.whl:
Publisher:
publish.yml on 2kDarki/drace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drace-2.0.3-py3-none-any.whl -
Subject digest:
b87a4ba3131d6142d9b8bd61e2103594a1ec8ae0aaa798d5ad763af7ca436c92 - Sigstore transparency entry: 835713302
- Sigstore integration time:
-
Permalink:
2kDarki/drace@fb8b650806b48f468edc158c991b6e930843b185 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/2kDarki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fb8b650806b48f468edc158c991b6e930843b185 -
Trigger Event:
push
-
Statement type: