Run Python scripts with AI-powered error explanations
Reason this release was yanked:
Bugfix release 1.0.2 supersedes this version — OpenAI calls used max_tokens instead of max_completion_tokens, causing failures with GPT-5.x models.
Project description
pyfixer
A drop-in replacement for python that runs your scripts normally — but when an error occurs, uses AI to explain what went wrong and suggest a fix, right in your terminal.
Supports Anthropic Claude, Google Gemini, and OpenAI. The provider is detected automatically from your API key.
Key Features
- AI Error Explanations: Get plain-English explanations of tracebacks powered by Claude, Gemini, or OpenAI.
- VS Code Diff View: See suggested fixes as a side-by-side diff before applying anything.
- One-Click Apply: Accept or discard fixes interactively — originals are backed up automatically.
- Multi-Provider: Works with Anthropic (
sk-ant-...), Google Gemini (AIza...), and OpenAI (sk-...) keys. - No lock-in: Use
--no-explainto skip AI entirely and behave like plainpython.
Installation
pip install py-fixer
Quick Start
1. Store your API key
pyfixer login
Paste your API key when prompted — you'll also choose a model. Credentials are saved to ~/.config/pyfixer/config.json (mode 600).
2. Run a script
pyfixer run script.py
When an error occurs, pyfixer:
- Prints the full traceback
- Explains the error in plain English
- Opens a VS Code diff showing the suggested fix
- Asks whether to apply it — original is backed up to
.pyfixer-backup/
pyfixer run script.py arg1 arg2 # forward args to your script
pyfixer run script.py --no-explain # traceback only, no AI
Commands
| Command | Description |
|---|---|
pyfixer login |
Save your API key and choose a model |
pyfixer logout |
Remove your stored API key and model |
pyfixer run <script> |
Run a script with AI error explanations |
pyfixer set-model |
Switch models without re-entering your key |
pyfixer install-extension |
Install the VS Code extension for inline fixes |
Requirements
- Python 3.10+
- An Anthropic, Google Gemini, or OpenAI API key
- VS Code (optional, for diff view)
Contributing
Bug reports and pull requests are welcome! Please open an issue at github.com/ayushisahu222/py-fixer/issues.
License
This project is licensed under the MIT License.
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 py_fixer-1.0.1.tar.gz.
File metadata
- Download URL: py_fixer-1.0.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d11b476f413870e8f0907ebe0881416cb6fd10bfa2e90c4906b2d6d6c1c47f9
|
|
| MD5 |
54aa2188b7633a1f9f68f775cb212a70
|
|
| BLAKE2b-256 |
dc5c358045bf4ef9daccd284446b080db5a665108f03339658d122ab0a3846e3
|
File details
Details for the file py_fixer-1.0.1-py3-none-any.whl.
File metadata
- Download URL: py_fixer-1.0.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d9fcaa9077bf7a16b8fcaa3f85f14d615b2dab78e5e5ffecba7510a20b6bfea
|
|
| MD5 |
0ecfdd770727da150278d7919d5b0763
|
|
| BLAKE2b-256 |
10e5f039daaa8ff6bfdf4a07766385b0e3a9cfcc01efbf258ccdf1948db64b9c
|