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.4

pycleancode 1.0.4 includes the first module: brace_linter, YAML threshold fixes, and security hardening for dependencies, CI, and console output.

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.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 --config pybrace.yml --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.4 planned as a security-hardening release

🚀 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.4.tar.gz (13.6 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.4-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pycleancode-1.0.4.tar.gz
Algorithm Hash digest
SHA256 46aaf52c3986cd81952a00bb2019fbea0d1784abdbc4ec5c42b4ff8b5b341be5
MD5 41a76ebd99e8bc97a8a9fe8bd4b1f700
BLAKE2b-256 c1c4f288ab16a77b08c0e97f8c1cd7b0d5c0fb574b707e2432252a70e1d5f517

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycleancode-1.0.4.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.4-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pycleancode-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 90abb86a6249bbc1e79aba2be89a325b59089545f4806b2c68313a9206389630
MD5 88d0a2d3316841513c87ec7a1b772e89
BLAKE2b-256 a7ffee174eb008d0039ba31b650eb4a2dcdf7516ff7940aff065cb2e162fcbd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycleancode-1.0.4-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