Skip to main content

Pycleancode Python toolkit to help developers write professional-grade, maintainable, and clean code following clean code principles

Project description

pycleancode logo

Pycleancode: Professional Python Clean Code Toolkit

A Python toolkit to help developers write professional-grade, maintainable, and clean code following clean code principles.

PyPI version CI Coverage License


pycleancode is a professional-grade Python toolkit that helps developers write clean, maintainable, and scalable code following clean code principles.

🌍 Project Goal

Build multiple code quality tools under a single unified package architecture.

Unlike traditional linters that only focus on style violations, pycleancode implements advanced rule engines that target deeper structural and maintainability aspects of your code.


🔄 Why pycleancode?

While tools like flake8, pylint, ruff, and black are excellent, most focus heavily on surface-level syntax or style violations.

pycleancode is different:

  • 🔄 Designed for professional teams writing critical Python codebases.
  • 🤝 Rule-based pluggable architecture to extend new structural checks.
  • 🔄 AST-powered deep nesting detection.
  • 🎡 Focused on long-term maintainability.
  • 🦖 OSS-grade code architecture.

🔄 Current Release - v1.0.0

pycleancode 1.0.0 includes the first module: brace_linter.

Brace Linter

The brace_linter module focuses on structural code depth and complexity. It analyzes Python code for excessive nesting and deeply nested functions that often make code harder to read, maintain, and extend.

Key Features

  • Max Depth Rule

    • Enforces maximum logical nesting depth.
    • Helps prevent pyramid-of-doom structures.
  • Nested Function Rule

    • Enforces maximum levels of nested function definitions.
    • Prevents excessive local function scoping that can reduce readability.
  • Structural Reporting

    • Full structural report of nesting tree.
    • Emoji + ASCII visualization of code structure.
    • Summary chart output for quick depth evaluation.

Sample output:

sandbox/test_sample.py:2: Nested functions depth 2 exceeds allowed 1
sandbox/test_sample.py:3: Depth 4 exceeds max 3

📈 Structural Report:

 🔾 ROOT (Line 0, Depth 1) 🔹 FunctionDef (Line 1, Depth 2)  🔹 FunctionDef (Line 2, Depth 3)   🔹 FunctionDef (Line 3, Depth 4)

🛡 Python Compatibility

  • ✅ Supported Python versions: 3.8, 3.9, 3.10, 3.11, 3.12
  • ⚠ Python 3.13+ is not yet supported (due to upstream Rust dependencies)

🌐 Installation

Install via PyPI:

pip install pycleancode

Or using Poetry:

poetry add pycleancode

🔧 Basic Usage

Run directly via CLI:

pycleancode-brace-linter path/to/your/code.py --report

🏓 Configuration

Configure via pybrace.yml:

rules:
  max_depth:
    enabled: true
    max_depth: 3
  nested_function:
    enabled: true
    max_nested: 1

Pass config via CLI:

pycleancode-brace-linter your_code.py --config pybrace.yml

🔧 Development Setup

git clone git@github.com:YOUR_USERNAME/pycleancode.git
cd pycleancode
poetry install
pre-commit install

Run full tests:

poetry run pytest --cov=pycleancode --cov-report=term-missing

Run pre-commit:

poetry run pre-commit run --all-files

📖 Roadmap

Module Description Status
brace_linter Structural depth analysis (nesting, functions) ✅ Completed
Full documentation site OSS-grade docs & API reference ⏳ Planned

🔒 License

Released under the MIT License. See LICENSE.


🛡️ Code of Conduct

Please see our CODE_OF_CONDUCT.md


🔗 Contributing

We welcome OSS contributions. Please read our full CONTRIBUTING.md to get started!

  • Clean Code Principles
  • 100% Test Coverage Required
  • Pre-commit Hooks Required
  • Conventional Commits Required

🔔 Community

  • GitHub Discussions (coming soon)
  • Issues and PRs welcomed
  • PyPI release v1.0.0 live

🚀 Pycleancode: Clean Code. Professional Quality. OSS-Grade Python. Unified Modular Clean Code Toolkit.

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

pycleancode-1.0.2.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

pycleancode-1.0.2-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file pycleancode-1.0.2.tar.gz.

File metadata

  • Download URL: pycleancode-1.0.2.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pycleancode-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2332b123d800e6d7d99b2ae50c8a0d14d1ede04eea4ad34bc0ed5aacc00a994e
MD5 6a51bf0df807cb7ca6cfc490eab42f9a
BLAKE2b-256 ee7a4aec3fc6761972fad68c7a03044523ba188c75ad9706066645d5598ba86b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycleancode-1.0.2.tar.gz:

Publisher: workflow.yml on pycleancode/pycleancode

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

File details

Details for the file pycleancode-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pycleancode-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pycleancode-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 80584ba811c8e0fbded599e62eb2233d767f9b730047e062eb12ef1d476969f5
MD5 df7eb01097d7109f1ca1c08b1caafaae
BLAKE2b-256 d0c0065c4c989db8ee9e129b8d8d037f460f592962cae09fb4471877f3eeb493

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycleancode-1.0.2-py3-none-any.whl:

Publisher: workflow.yml on pycleancode/pycleancode

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