Pycleancode Python toolkit to help developers write professional-grade, maintainable, and clean code following clean code principles
Project description
Pycleancode: Professional Python Clean Code Toolkit
A Python toolkit to help developers write professional-grade, maintainable, and clean code following clean code principles.
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2332b123d800e6d7d99b2ae50c8a0d14d1ede04eea4ad34bc0ed5aacc00a994e
|
|
| MD5 |
6a51bf0df807cb7ca6cfc490eab42f9a
|
|
| BLAKE2b-256 |
ee7a4aec3fc6761972fad68c7a03044523ba188c75ad9706066645d5598ba86b
|
Provenance
The following attestation bundles were made for pycleancode-1.0.2.tar.gz:
Publisher:
workflow.yml on pycleancode/pycleancode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycleancode-1.0.2.tar.gz -
Subject digest:
2332b123d800e6d7d99b2ae50c8a0d14d1ede04eea4ad34bc0ed5aacc00a994e - Sigstore transparency entry: 243306169
- Sigstore integration time:
-
Permalink:
pycleancode/pycleancode@9fa8a7638574b93e2911dda36984502bdec532e1 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/pycleancode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@9fa8a7638574b93e2911dda36984502bdec532e1 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80584ba811c8e0fbded599e62eb2233d767f9b730047e062eb12ef1d476969f5
|
|
| MD5 |
df7eb01097d7109f1ca1c08b1caafaae
|
|
| BLAKE2b-256 |
d0c0065c4c989db8ee9e129b8d8d037f460f592962cae09fb4471877f3eeb493
|
Provenance
The following attestation bundles were made for pycleancode-1.0.2-py3-none-any.whl:
Publisher:
workflow.yml on pycleancode/pycleancode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycleancode-1.0.2-py3-none-any.whl -
Subject digest:
80584ba811c8e0fbded599e62eb2233d767f9b730047e062eb12ef1d476969f5 - Sigstore transparency entry: 243306171
- Sigstore integration time:
-
Permalink:
pycleancode/pycleancode@9fa8a7638574b93e2911dda36984502bdec532e1 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/pycleancode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@9fa8a7638574b93e2911dda36984502bdec532e1 -
Trigger Event:
push
-
Statement type: