Intelligent Python debugging library – explains errors, identifies root causes, and suggests fixes.
Project description
CodeMedic
Intelligent Python debugging library. Explains errors in plain English, identifies root causes, and suggests practical fixes.
Features
- Human-friendly explanations – Beginner and professional modes
- Root cause analysis – Pinpoints the exact file, line, and variable state
- Fix suggestions – Non-destructive patch recommendations with confidence scores
- Static analysis – 14 AST-based checks for common issues
- Security scanning – Detects
eval(), pickle, hardcoded secrets, weak hashes - Multiple report formats – HTML, JSON, Markdown
- Terminal UI – Rich formatting with syntax highlighting
- Extensible knowledge base – 40+ built-in exceptions, customizable
Installation
pip install codemedic
Requires Python 3.11+.
Usage
Command Line
Run a script with full error analysis:
codemedic run script.py
Analyze for static issues:
codemedic analyze script.py
Explain an exception:
codemedic explain TypeError
Show system diagnostics:
codemedic doctor
Generate report from a previous result:
codemedic report --format html --input result.json
Python API
Analyze a file:
from codemedic import Runner
runner = Runner(mode="beginner")
result = runner.run_file("script.py")
if not result.success:
print(result.explanation["simple_explanation"])
for fix in result.fixes:
print(f"Line {fix.line_number}: {fix.description}")
Analyze a callable:
from codemedic import Runner
def process_data():
return data["key"]
runner = Runner()
result = runner.run_with_capture(process_data)
if not result.success:
print(result.trace.exception_type)
Generate reports:
from codemedic import Runner, ReportGenerator, Config
config = Config(output_folder="./reports")
runner = Runner(config=config)
result = runner.run_file("script.py")
if not result.success:
gen = ReportGenerator(config)
gen.generate(result.to_dict(), format="html")
gen.generate(result.to_dict(), format="json")
Static analysis:
from codemedic import CodeAnalyzer
analyzer = CodeAnalyzer()
issues = analyzer.analyze_file("script.py")
for issue in issues:
print(f"[{issue.severity}] Line {issue.line}: {issue.message}")
Security scanning:
from codemedic.security import check_file
warnings = check_file("script.py")
for w in warnings:
print(f"[{w.code}] {w.message}: {w.recommendation}")
Architecture
runner.py– Script execution and exception capturetrace.py– Stack frame collection and structuringexplanations.py– Explanation generationfixer.py– Patch suggestion generatoranalyzer.py– Static analysis (AST-based checks)security.py– Security scanningdatabase.py– SQLite knowledge base (40+ exceptions)formatter.py– Terminal UI with Richreport.py– HTML, JSON, Markdown report generationcli.py– Command-line interfaceconfig.py– Configuration managementutils.py– Shared utilities
Contributing
See CONTRIBUTING.md.
License
MIT. See 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 codemedic-1.0.0.tar.gz.
File metadata
- Download URL: codemedic-1.0.0.tar.gz
- Upload date:
- Size: 54.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a9110d1848c4983827b00bf5797989cbd830656bfa9f06df3337d95597dc76e
|
|
| MD5 |
790085463de7d502c22e2d4977947180
|
|
| BLAKE2b-256 |
032ebf3c1300dcbd700d1b2e2049294dfde967127f093226490c7dde42d1a472
|
File details
Details for the file codemedic-1.0.0-py3-none-any.whl.
File metadata
- Download URL: codemedic-1.0.0-py3-none-any.whl
- Upload date:
- Size: 47.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
091664561610fe5201ddc0af6a3d1675eecd167cd10111fc093fa30bf404f937
|
|
| MD5 |
215094405ba7978bee84dc6e6d3c843e
|
|
| BLAKE2b-256 |
a0cad52db2383535914f243f0c9ec30efc4b4aeb424148bafe4f730a89029f51
|