Skip to main content

Interactive error handling and debugging for Python

Project description

Python Interactive Error Handling and Correction

This repository contains advanced tools for Python error handling and correction, designed to make Python development more efficient and user-friendly.

Decoher - Interactive Error Handling

Decoher provides interactive error handling capabilities for Python, allowing you to fix runtime errors on the fly without restarting your application.

Key Features

  • ✅ Interactive error correction at runtime
  • 🔄 Multiple correction options (fix single line, multiple lines, rewrite functions)
  • 📝 Error fix history tracking
  • 🛠️ Support for various error types:
    • Syntax errors
    • Indentation errors
    • Name errors
    • Type errors
    • Attribute errors
    • Import errors
    • Index errors
    • Key errors
    • Zero division errors
    • Value errors
  • 🔍 Automatic detection and suggestions for whitespace issues
  • 🔧 Automatic fix capabilities for common errors
  • 📊 PEP 8 style suggestions
  • 🔌 Simple enable/disable functionality

Basic Usage

from qfunc import decoher

# Enable interactive error handling
decoher.enable()

# Your code with potential errors
# When an error occurs, you'll get an interactive prompt to fix it

# Disable when done
decoher.disable()

# View history of fixes
decoher.show_fix_history()

Interactive Options

When an error is detected, Decoher provides several options:

  1. Apply automatic fix - For errors that can be automatically fixed
  2. Fix single line - Edit just the line with the error
  3. Fix multiple lines - Edit a range of lines
  4. Rewrite entire function - Replace the whole function containing the error
  5. Choose custom line range - Select specific lines to edit
  6. Show more context - View more lines around the error
  7. Continue execution - Ignore the error and continue
  8. Abort program - Stop execution
  9. Save a backup - Create a backup before making changes
  10. Show PEP 8 style suggestions - Get style recommendations

Error Detection and Correction

Decoher can detect and help fix various issues:

  • Indentation errors: Automatically fixes unexpected indentation, missing indentation after colons, and inconsistent indentation levels
  • Syntax errors: Suggests fixes for missing parentheses, quotes, colons, etc.
  • Whitespace issues: Detects mixed tabs/spaces, trailing whitespace, and inconsistent indentation
  • Variable errors: Suggests similar variable names when a name error occurs
  • Type errors: Provides guidance on argument types and operation compatibility

Use Cases

  • 🔰 Learning Python with reduced frustration
  • ⚡ Rapid prototyping and debugging
  • 🎬 Live coding demonstrations
  • 👨‍🏫 Teaching and mentoring
  • 🏛️ Legacy code maintenance

Limitations

  1. Not all errors can be fixed automatically
  2. Automatic fixes might not always match programmer intent
  3. Performance overhead during development
  4. Best used in development and educational contexts, not production

Best Practices

  1. Use during development for quick fixes
  2. Disable before deploying to production
  3. Use as a learning tool, not a substitute for proper coding practices
  4. Combine with proper linting tools for comprehensive code quality
##INSTALLATION

pip install qfunc

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

qfunc-0.3.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

qfunc-0.3.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file qfunc-0.3.0.tar.gz.

File metadata

  • Download URL: qfunc-0.3.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for qfunc-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8774e4bde3a1d82fe192754ee9d6a4d5c261a479983bf294db0741d1baf1f5b4
MD5 a60271fea8dfd689bfba0f9746c6986b
BLAKE2b-256 73f27df1138419c414b82c56f2e3aeb4138e9cb5430e2a2d8b3a2d66a8ed2f8b

See more details on using hashes here.

File details

Details for the file qfunc-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: qfunc-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for qfunc-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d202bfdd61dff6fa405d9df7d28440f7a6cfb89cc4af1911aaa574ce330620e
MD5 412814673cdac7b1a509427a2b5c9047
BLAKE2b-256 20018080eb5d1e903ab3a3f0ea567a79042e5c8689a464db6b6ad60ad4b18730

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