An agentic codebase evaluation and evolution tool for Python projects.
Project description
Python Harness
An agentic codebase evaluation and evolution tool for Python projects.
python-harness is designed to be a universal standard tool—just like pytest or ruff—but instead of just checking syntax or running tests, it evaluates the architecture, readability, and governance of your codebase using both static analysis and LLMs (DeepSeek/OpenAI).
Features
- Hard Evaluation (First Fence): Enforces strict rules using
ruff,mypy, andty. Evaluates Cyclomatic Complexity (CC) and Maintainability Index (MI) viaradon. - Governance QC (Second Fence): Checks if the changes violate core project governance or attempt to bypass the evaluation rules themselves.
- Soft Evaluation (Third Fence):
- Calculates architecture metrics like Fan-out (coupling).
- Generates a holistic package understanding using LLMs.
- Performs "Blind QA": Randomly samples functions/classes and tests the LLM's ability to understand them without context.
- Actionable Output: Synthesizes the evaluation into a final
Pass/Failverdict with exactly 3 concrete, actionable refactoring suggestions.
Installation
You can install python-harness using uv or pip:
uv pip install python-harness
Configuration
python-harness requires an LLM to perform its soft evaluation. Create a .env file in the root of your project:
LLM_API_KEY=your_api_key_here
LLM_BASE_URL=https://api.deepseek.com/v1
LLM_MODEL_NAME=deepseek-reasoner
LLM_MINI_MODEL_NAME=deepseek-chat
(Note: If you don't provide an API key, the harness will safely run in Mock mode).
Usage
1. Measure
To evaluate your codebase, run the measure command in your project directory:
harness measure .
This will run the full 3-fence evaluation and output a report with a final verdict and top 3 improvement suggestions.
2. Refine (Evolution Loop - WIP)
The refine command is an Agentic Edit-Test-Improve loop. It takes the suggestions generated by measure, automatically creates branches (variants), applies the changes, runs the tests (pytest), and picks the best variant.
harness refine . --steps 1 --max-retries 3
License
MIT License. See LICENSE for more details.
A harness toolkit for Python projects
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 python_harness-0.0.1.tar.gz.
File metadata
- Download URL: python_harness-0.0.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85fbf18774c1f78a5fc541b233655ef72be7b5a5b1a3557ec6e7efcf1316b8f7
|
|
| MD5 |
5f6e35df64e05ef729be198cb2d87f1b
|
|
| BLAKE2b-256 |
796cf482fc72c40368a5732f738ca6eb8f92109450144cef02015d1686796fb3
|
File details
Details for the file python_harness-0.0.1-py3-none-any.whl.
File metadata
- Download URL: python_harness-0.0.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bd05e8b6ce2e28c51e94f52e5de2e58b2df72106154900d73678c390ea2a74d
|
|
| MD5 |
595b81140fefebbdaad20332d22380b0
|
|
| BLAKE2b-256 |
0b97edd394a42a90297afbf1263aaa9147c91e44522cc1e0156410a9084ad7b6
|