A Python library for explaining and debugging errors in ML/data pipelines with variable snapshots and LLM-ready prompts.
Project description
errorex
Explain errors better.
errorex is a Python library that automatically explains and logs runtime errors in your code by capturing:
- Code traceback (excluding library noise)
- Local variable snapshots
- Suggestions for common errors
- LLM-ready GPT prompts
💡 Example
from errorex import explain_errors
...
@explain_errors(log=True, suggest=True)
def run():
df = pd.read_csv("somefile.csv")
model.fit(df[['feature']], df['label']) # Will fail if NaNs or mismatch
run()
🛠 Features
📍 User-focused Tracebacks: Filters out noisy frames from libraries.
🧠 Local Variable Snapshot: Captures all in-scope variables at the error line.
💡 Error Suggestions: Auto-suggests common fixes (e.g., NaNs, shape mismatches).
🤖 LLM Debug Prompt: Structured error message ready to paste into ChatGPT.
📝 Markdown Report Logging: Saves error reports to logs/error_report_<timestamp>.md.
📦 Installation
bash
Copy
Edit
pip install errorex
(Or, if you're developing locally)
bash
Copy
Edit
git clone https://github.com/minalbansal14/errorex.git
cd errorex
pip install -e .
🧪 Tests
bash
Copy
Edit
pytest tests/
🧠 Example Output (Markdown Log)
markdown
Copy
Edit
## ⚠️ Exception:
ValueError: Input y contains NaN
## 📍 Traceback:
- File: `simple_pipeline.py`, Line: 21
```python
model.fit(X, y)
🧠 Local Variables:
y: 0.0, 1.0, NaN
💡 Suggestions:
It looks like your data contains missing values. Try using df.dropna().
🤖 GPT Prompt:
mathematica
Copy
Edit
Here’s the error and variables. How can I fix it?
👤 Author
Created by Minal Bansal
Contributions welcome via issues or PRs.
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
errorex-0.1.0.tar.gz
(4.7 kB
view details)
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 errorex-0.1.0.tar.gz.
File metadata
- Download URL: errorex-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7b4ed09145b7d70e6c7fa7c7db19d1ee97bb99705c2a6b7a03b57559959ed7b
|
|
| MD5 |
c548a05f875541ad3b0e0750bf72b092
|
|
| BLAKE2b-256 |
a0cfdad91716b0d55047831943778eabaad680f99ea88c3861a4e5dee937086e
|
File details
Details for the file errorex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: errorex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81e93505329bfd289c31fe21e04417a7bcd302cf64eb0d67f6cd88396f335a3e
|
|
| MD5 |
d396047bfd09e5163d6fc24f5f36a91c
|
|
| BLAKE2b-256 |
583132dabcbc881f4f078c7fb7752e9d8fe89f142ef452803497d4e40195300d
|