Skip to main content

pyfixer

License PyPI Python

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-explain to skip AI entirely and behave like plain python.

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:

  1. Prints the full traceback
  2. Explains the error in plain English
  3. Opens a VS Code diff showing the suggested fix
  4. 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.

Metadata

Release files for py-fixer 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-fixer 1.0.2
File Size Uploaded Provenance
py_fixer-1.0.2.tar.gz 11.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for py-fixer 1.0.2
File Interpreter ABI Platform
py_fixer-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / py_fixer-1.0.2.tar.gz

Download URL py_fixer-1.0.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f7ec2510a4c16892fecc743a87f0eeb07ffc9ed4cf9df03dd2d13277afe3c7f6
BLAKE2b-256 checksum
How to use checksums
d231b7971f015be169e6422274f21d87c4e0cb7fd6cb61a19dc517095e9a177e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / py_fixer-1.0.2-py3-none-any.whl

Download URL py_fixer-1.0.2-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d37a1de2985b20d83dae4f57fbe3155bb8444ac8c1a149ba0052ff72a284c027
BLAKE2b-256 checksum
How to use checksums
91f3f22a488739ed994eb69496a95dbba254c05a39d7741eec808a68e0b4911e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for py-fixer 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page