CLI tool to refactor messy AI-generated Python scripts into production-ready code using Claude.
Project description
python-vibe-cleanup
A CLI tool that takes any messy, AI-generated Python script and rewrites it into clean, production-ready code — using Claude claude-sonnet-4-6 via the Anthropic API.
Install
pip install python-vibe-cleanup
Or from source:
git clone https://github.com/yourusername/python-vibe-cleanup
cd python-vibe-cleanup
pip install -e .
Setup
Create a .env file in your working directory (or export the key in your shell):
cp .env.example .env
# then edit .env and add your key
ANTHROPIC_API_KEY=sk-ant-...
Usage
# Overwrite the file with clean code
vibe-clean my_messy_script.py
# Preview the output without modifying the file
vibe-clean my_messy_script.py --dry-run
# Show version
vibe-clean --version
What it fixes
| Issue | Fix applied |
|---|---|
| Unused / duplicate imports | Removed and reordered (PEP 8) |
| Missing type hints | Full annotations on every function |
| No docstrings | Google-style docstrings added |
| Redundant logic | Extracted into named helpers |
Bare except: |
Replaced with specific exception types |
print() diagnostics |
Replaced with logging calls |
| Magic strings/numbers | Lifted to UPPER_CASE constants |
Logic in __main__ guard |
Moved into a main() function |
| PEP 8 violations | Fixed (88-char line limit, Black style) |
Publishing to PyPI
pip install build twine
python -m build
twine upload dist/*
License
MIT
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_vibe_cleanup-1.0.0.tar.gz.
File metadata
- Download URL: python_vibe_cleanup-1.0.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f291fc7a89ff3e23d4960e069fcca96b1088bf95d16936b934a608fce49ee631
|
|
| MD5 |
6a754ac63732170e0af36f9538a892c5
|
|
| BLAKE2b-256 |
32a36948c49a42d20f40ada61fbf98e3f7fc07bdf55ac211b94ed6d1f5772d75
|
File details
Details for the file python_vibe_cleanup-1.0.0-py3-none-any.whl.
File metadata
- Download URL: python_vibe_cleanup-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b9ac9ae0bd6a2f2df8613fa070d50f6e206e538f05a4c713524f86883e96f8f
|
|
| MD5 |
1aaec8d48c80d1f4e3982c630e6526cb
|
|
| BLAKE2b-256 |
6b15fc435c1f0c009590a08f2328151114fef45ad5b3694898ab592138c1b397
|