Skip to main content

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 appropriate
    • Z202: Suggests refactoring for DRY-ness
    • Z221: Warns about bloated functions
    • Z222: 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


Download files

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

Source Distribution

drace-0.1.1.tar.gz (113.0 kB view details)

Uploaded Source

Built Distribution

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

drace-0.1.1-py3-none-any.whl (124.7 kB view details)

Uploaded Python 3

File details

Details for the file drace-0.1.1.tar.gz.

File metadata

  • Download URL: drace-0.1.1.tar.gz
  • Upload date:
  • Size: 113.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for drace-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5ec962177a636e92310c354f8d4e62cf54e285037a1408a1ccaf199d41ffdae2
MD5 05b4d79c8fb933567e2bf3df488ec70b
BLAKE2b-256 49cc53e1f1329aa1b6f4d0a2c466514ae072f0d6409128c3fd09afe81a669bcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for drace-0.1.1.tar.gz:

Publisher: publish.yml on 2kDarki/drace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file drace-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: drace-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 124.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for drace-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2f1149fa90dec9dfc522ba4f22e8ac0d046f297f2cd1e6fe79b9ade4992e44d
MD5 956dfaf6c8ee5cc0b67f255a60527096
BLAKE2b-256 79b08c82ffa8fb75bdece72d1d6b55b6b5b99eef71b35cc95cad7a381a52fd64

See more details on using hashes here.

Provenance

The following attestation bundles were made for drace-0.1.1-py3-none-any.whl:

Publisher: publish.yml on 2kDarki/drace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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