Skip to main content

๐Ÿ”ฅ The magical Python error fixing tool that automatically fixes your code with a single command! Features AI integration, 5 personality modes, and fixes 50+ common errors in under 2 seconds.

Project description

๐Ÿ”ฅ UNFUCK - The Magical Python Error Fixer ๐Ÿ”ฅ

Because life's too short to debug!

Python Version License GitHub LinkedIn

Unfuck is a magical Python tool that automatically fixes your code errors with a single command. When your Python script crashes, simply type unfuck and watch the magic happen! โœจ

๐Ÿš€ Quick Start

# Install unfuck
pip install unfuck

# Run your script (it will probably break)
python my_script.py

# Unfuck it!
unfuck

# Your code is now working! ๐ŸŽ‰

โœจ Features

๐Ÿ”ฅ Instant Error Fixing

  • Fixes 50+ common Python errors automatically
  • Works in under 2 seconds
  • Zero configuration required
  • Creates backups before making changes

๐Ÿค– AI-Powered Analysis

  • Uses local Ollama LLM for complex errors
  • Learns from your mistakes
  • Gets smarter over time
  • Explains what went wrong

๐ŸŽญ Personality Modes

  • Encouraging: "I got you! Let me fix that error..."
  • Sarcastic: "This again? sigh fixing..."
  • Zen: "Breathe... let me find the balance in your code..."
  • Professional: "Error detected. Initiating repair sequence..."
  • Meme: "TO THE MOON! (with your fixed code)"

๐Ÿ› ๏ธ Error Types Fixed

Error Type Examples Fix
Import Errors ModuleNotFoundError, ImportError Install packages, fix typos
Syntax Errors Missing colons, brackets, quotes Add missing syntax elements
Type Errors String + Integer, NoneType calls Add type conversions, null checks
Name Errors Undefined variables, scope issues Define variables, fix scope
Index/Key Errors List out of range, missing dict keys Add bounds checking, use .get()
Attribute Errors Wrong method calls, typos Fix method names, add checks
Value Errors Invalid conversions, empty sequences Add validation, defaults
File Errors Missing files, permission issues Create files, fix paths
Indentation Errors Mixed tabs/spaces, wrong levels Fix indentation consistently

๐ŸŽฏ Usage Examples

Basic Usage

# Fix the last error
unfuck

# Fix with explanations
unfuck --explain

# Preview fixes without applying
unfuck --preview

# Use AI for complex errors
unfuck --ai

Personality Modes

# Encouraging mode (default)
unfuck --mode encouraging

# Sarcastic mode
unfuck --mode sarcastic

# Zen mode
unfuck --mode zen

# Professional mode
unfuck --mode professional

# Meme mode
unfuck --mode meme

Advanced Features

# Try harder fixes
unfuck --aggressive

# Show fix history
unfuck --history

# Show success statistics
unfuck --stats

# Undo last fix
unfuck --undo

# Fix everything possible (rampage mode!)
unfuck --rampage

๐ŸŽฎ Fun Commands

# Fix everything it can find
unfuck --rampage

# Add meditation comments to code
unfuck --zen

# Git blame with sarcastic comments
unfuck --blame

# Russian roulette - random fix from top options
unfuck --russian-roulette

๐Ÿ† Achievement System

  • ๐ŸŽ‰ First Unfuck! - Your first successful fix
  • ๐Ÿ”ฅ Unfuck Streak - Fix 10 errors in a row
  • ๐Ÿ’Ž Unfuck Master - Fix 100 errors
  • ๐Ÿ‘‘ Unfuck Royalty - Fix 500 errors
  • ๐Ÿ† Unfuck Legend - Fix 1000 errors

๐Ÿค– AI Integration

Unfuck can use local AI models via Ollama for complex error analysis:

# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh

# Pull a model
ollama pull llama2

# Use AI-powered unfucking
unfuck --ai --explain

๐Ÿ“Š Statistics & Learning

Unfuck tracks your debugging journey:

# View your unfuck statistics
unfuck --stats

# View fix history
unfuck --history

# Export your unfuck story
unfuck --export-story

๐Ÿ”ง Configuration

Create ~/.unfuck/config.json to customize:

{
  "ai_enabled": true,
  "ai_model": "llama2",
  "personality_mode": "encouraging",
  "auto_backup": true,
  "max_fix_attempts": 3,
  "confidence_threshold": 0.6,
  "show_animations": true,
  "verbose_output": false
}

๐Ÿงช Testing

Try unfuck with these example broken scripts:

# Test import errors
python examples/test_imports.py
unfuck

# Test syntax errors  
python examples/test_syntax.py
unfuck

# Test various errors
python examples/broken_script.py
unfuck

๐ŸŽจ Screenshots

๐Ÿ”ฅ UNFUCK - The Magical Python Error Fixer ๐Ÿ”ฅ

๐Ÿ” Error Analysis
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Property    โ”‚ Value                               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Error Type  โ”‚ ModuleNotFoundError                 โ”‚
โ”‚ Message     โ”‚ No module named 'numpy'             โ”‚
โ”‚ File        โ”‚ /path/to/script.py                  โ”‚
โ”‚ Line        โ”‚ 3                                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Fix Suggestions
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Rank โ”‚ Description             โ”‚ Confidence โ”‚ Type     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1    โ”‚ Install missing module  โ”‚ 95%        โ”‚ install  โ”‚
โ”‚ 2    โ”‚ Fix typo in import name โ”‚ 80%        โ”‚ typo     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽ‰ Unfucked! Your code is running!
๐Ÿ”ฅ You're on fire! 5 fixes in a row!

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Add your fix patterns to the database
  4. Test with broken scripts
  5. Submit a pull request

Adding New Fix Patterns

# Add to unfuck/core/pattern_database.py
FixPattern(
    error_type="YourError",
    error_pattern="error message pattern",
    fix_type="your_fix_type",
    fix_code="fix implementation",
    confidence=0.9,
    description="What this fix does",
    examples=["example usage"]
)

๐Ÿ“ˆ Roadmap

  • JavaScript/TypeScript support
  • VS Code extension
  • Team collaboration features
  • Cloud-based fix sharing
  • Machine learning improvements
  • Plugin system for custom fixes

๐Ÿ› Bug Reports

Found a bug? We want to fix it! Please report issues with:

  • The error that occurred
  • What unfuck tried to do
  • What actually happened
  • Your Python version and OS

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • The Python community for all the Stack Overflow questions that inspired this
  • Ollama for making local AI accessible
  • Rich for beautiful terminal output
  • All the developers who've ever been frustrated by debugging

๐ŸŒŸ Star History

Star History Chart


Made with โค๏ธ by the unfuck team

"Because life's too short to debug" ๐Ÿš€

Website โ€ข Documentation โ€ข Discord โ€ข Twitter

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

python_unfuck-1.0.2.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_unfuck-1.0.2-py3-none-any.whl (41.9 kB view details)

Uploaded Python 3

File details

Details for the file python_unfuck-1.0.2.tar.gz.

File metadata

  • Download URL: python_unfuck-1.0.2.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for python_unfuck-1.0.2.tar.gz
Algorithm Hash digest
SHA256 da9ffc68809a9d564d410798690b0ad23612afb523e541956588d18fe5d1cb4a
MD5 09da07d0a77f68452013db4f327b5b6b
BLAKE2b-256 81750da07928921d6279d7650dc1e523979e87b9009c5c0527420c182e4646bf

See more details on using hashes here.

File details

Details for the file python_unfuck-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: python_unfuck-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 41.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for python_unfuck-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8fabcd5445fc1e7f032a10be69970a7886f701a80b199730b3de4f15e2e9a25f
MD5 c73b3b399a11843e19958e0a833a94f2
BLAKE2b-256 db30bbc677e38d934849ab8b42daa312eff3497ae1fa64401908816de1d5736e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page