Skip to main content

Offline Python traceback translator and error explainer CLI that converts exceptions into clear explanations and actionable fixes.

Project description

Error Translator

PyPI Version Python 3.9+ GitHub Stars PyPI Downloads License Build Status

Error Translator is an offline Python traceback translator and exception explainer that converts raw errors into crystal-clear explanations and immediately actionable fixes. Built for local-first development workflows, it supports direct CLI usage, an automatic import hook, a programmatic Python API, and a FastAPI integration.

If this project saves you debugging time, please consider starring it on GitHub: https://github.com/gourabanandad/error-translator-cli-v2

Why Developers Like It

  • Fast Feedback Loop: Turn stack traces into direct next actions in seconds.
  • Works Offline: No telemetry dependency for core translation behavior.
  • Beginner-Friendly Output: Explanations are clear enough for learners, practical enough for teams.
  • Multiple Entry Points: CLI, import hook, Python API, and FastAPI all share one deterministic engine.

Key Features

  • CLI-First Architecture: Seamlessly process scripts, direct error strings, or piped logs via the explain-error command.
  • Professional Rich Terminal UI: Clean panels, syntax-highlighted code context, structured sections, and improved readability for day-to-day debugging.
  • Automatic Integration Mode: Inject the module via import error_translator.auto to automatically override sys.excepthook for graceful, translated crash reporting.
  • Extensible API Surfaces: Integrate natively within Python or expose the core engine over HTTP via the included FastAPI server.
  • Deterministic Rules Engine: High-performance, regex-based matching powered by rules.json guarantees offline and privacy-first translations.
  • Optional Native Acceleration: A C extension matcher (fast_matcher) can accelerate rule scanning, with automatic fallback to pure Python when unavailable.
  • Optional AST Insight Hooks: Registered handlers can append targeted hints (ast_insight) for selected error types.

Installation

Python requirement: 3.9 or newer.

Install the latest stable release directly from PyPI:

pip install error-translator-cli-v2

Verify the installation:

explain-error --version

Usage Guide

1. Command-Line Interface (CLI)

Run a Python script and catch any unhandled exceptions:

explain-error run script.py

Provide an error string directly:

explain-error "NameError: name 'usr_count' is not defined"

Pipe system or Docker logs into the engine:

cat error.log | explain-error

Emit structured JSON for scripting and automation:

explain-error --json "NameError: name 'x' is not defined"
# {"explanation": "...", "fix": "...", "matched_error": "...", "file": "...", "line": "...", "code": "...", "ast_insight": null}

Show an about screen with project metadata and quick usage examples:

explain-error --about

The --json flag works with every input mode (run <script>, raw string, piped log).

2. Automatic Import Hook

Catch and translate unhandled exceptions globally by importing the module:

import error_translator.auto

def main():
    # This TypeError will automatically trigger the error translator
    total = "Users: " + 42

if __name__ == "__main__":
    main()

3. FastAPI Service

Start the built-in HTTP server for remote translation services:

uvicorn error_translator.api.server:app --host 127.0.0.1 --port 8000 --reload

Submit a traceback payload via the exposed REST API:

curl -X POST http://127.0.0.1:8000/translate \
  -H "Content-Type: application/json" \
  -d "{\"traceback_setting\":\"Traceback (most recent call last):\\n  File 'app.py', line 14, in <module>\\n    total = 'Users: ' + 42\\nTypeError: can only concatenate str (not 'int') to str\"}"

Additional endpoints:

  • GET /health returns service status.
  • GET / serves the bundled web UI from error_translator/api/static/index.html.

4. Optional C Extension Build

The translation engine automatically attempts to import error_translator.fast_matcher. If it is not built or not available on the platform, Error Translator falls back to the pure Python regex loop with no behavior change.

Build the extension in-place from the repository root:

python setup_ext.py build_ext --inplace

This step is optional and intended for local performance optimization.

Documentation

Detailed documentation is located in the docs/ directory:

  • Real-World Examples: Practical demonstrations comparing raw tracebacks with their translated counterparts.
  • Architecture & Internals: Comprehensive teardown of the regex engine, AST integration, and internal design philosophy.
  • Contributing Guidelines: Standards, PR checklists, and instructions for utilizing our AI-Powered Rule Builder.

Maintainers

This project is actively developed and maintained by Gourabananda Datta alongside our open-source contributors.

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

error_translator_cli_v2-3.0.5.tar.gz (45.5 kB view details)

Uploaded Source

Built Distributions

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

error_translator_cli_v2-3.0.5-cp313-cp313-win_amd64.whl (50.0 kB view details)

Uploaded CPython 3.13Windows x86-64

error_translator_cli_v2-3.0.5-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (54.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.5-cp313-cp313-macosx_11_0_arm64.whl (47.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

error_translator_cli_v2-3.0.5-cp313-cp313-macosx_10_13_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

error_translator_cli_v2-3.0.5-cp312-cp312-win_amd64.whl (50.0 kB view details)

Uploaded CPython 3.12Windows x86-64

error_translator_cli_v2-3.0.5-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (54.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.5-cp312-cp312-macosx_11_0_arm64.whl (47.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

error_translator_cli_v2-3.0.5-cp312-cp312-macosx_10_13_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

error_translator_cli_v2-3.0.5-cp311-cp311-win_amd64.whl (50.0 kB view details)

Uploaded CPython 3.11Windows x86-64

error_translator_cli_v2-3.0.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (54.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.5-cp311-cp311-macosx_11_0_arm64.whl (47.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

error_translator_cli_v2-3.0.5-cp311-cp311-macosx_10_9_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

error_translator_cli_v2-3.0.5-cp310-cp310-win_amd64.whl (50.0 kB view details)

Uploaded CPython 3.10Windows x86-64

error_translator_cli_v2-3.0.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (54.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.5-cp310-cp310-macosx_11_0_arm64.whl (47.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

error_translator_cli_v2-3.0.5-cp310-cp310-macosx_10_9_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

error_translator_cli_v2-3.0.5-cp39-cp39-win_amd64.whl (50.0 kB view details)

Uploaded CPython 3.9Windows x86-64

error_translator_cli_v2-3.0.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (53.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.5-cp39-cp39-macosx_11_0_arm64.whl (47.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

error_translator_cli_v2-3.0.5-cp39-cp39-macosx_10_9_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file error_translator_cli_v2-3.0.5.tar.gz.

File metadata

  • Download URL: error_translator_cli_v2-3.0.5.tar.gz
  • Upload date:
  • Size: 45.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for error_translator_cli_v2-3.0.5.tar.gz
Algorithm Hash digest
SHA256 c8a8b072a7f173e5fe99bfaee46c81ec8b599a110e1799485a2fa4c2e19ff74b
MD5 e199662965d79862e3c0558988f80a15
BLAKE2b-256 60b1bfdbe869afdb39b747e2717989067004f9e0adb6cf5402413528509320a5

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a1546e190e77abffe2e193f37da974c2737e99d371298b8a7a6facad563e418b
MD5 6d390f130f67738a63bd7d80e87431c9
BLAKE2b-256 855fe6043da3a3da8f6d1c4f5b329dbe575b6b7f536fabb082cd5b0e41e3d1ad

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b21a991e043e40552764bcac315940b80361e4cfcfc5f7d29b0c5f4b943f8639
MD5 50181ffffd840a9ce0b2b34f2f7f130a
BLAKE2b-256 a999cc8c9468e09a0603cd594146b751bc5b364dd6e8d36a381af06972c9fbc0

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c88d0dae8a64ac57380588e33bb4e959e16654ce1d6fc2bddeedf521d2a0d0a
MD5 717eb962253f94037c7411c8e7a3d90a
BLAKE2b-256 80a236e9eac7c9f1096cec77497bde70e8abdfb65e1218364227b5a5e6f67302

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 cd1bb3e1b865e21d09ed84ca75007daa2050111f18823236c9b19614c3a33596
MD5 964457e1dff6f6172cd7a91e52cfce82
BLAKE2b-256 ebbad0656bf8977d9b6933f4d5f53af177b58fe366a161b4b3a4cd1102ee925d

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4767a1da2c94c1701f5eed9d20037a755974c85c5714145e1f22fb64d71b896d
MD5 d74e9b5adfef5c1eb3f8527bcd4d72c7
BLAKE2b-256 7f45d9ea710a23e3b6128ce063004d806b4b17fa6c319e765ec9f05b13d480eb

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7ef4b4c8855029bb9e20bb2ef8a9e51073000d05e60aea781574d9335a08f72
MD5 161838fa247e3daf7eae65779829ab9f
BLAKE2b-256 d81c01e8cb8b0e9455b144fa8ee7cf939789e5c38518ad5fd2106284641e04a1

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc57b618ce138648baab1e25cd9c661949a3629e7ec3409e7007a74243e49897
MD5 842d8b8cbbf25941488e8139d69f3a83
BLAKE2b-256 f3e1e55e4a06bec86d732e620aa690445495b188ed3bf6204e15a4f1fb0a9de7

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 69161c0b6f72db78fbeedcc4dbe51d49fa45424dfc8d52cdecbc1b90e6141306
MD5 53e1c96bbd49aa967d9903d217258af2
BLAKE2b-256 e63b5b3033fb6624f19aad8c137ba104ac30abdf0e5717c93229b5f185044e57

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 11ca77a51e2905f8148d31beb0edec59bc3ff12e8f2a5f8dc986479f520a8f2d
MD5 e17b06e4bc770481c88b677ced3426b1
BLAKE2b-256 0142321843a3faadb33ad58ad6af431be4bf6eeb93dba19b4a48f1b42c9b8252

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27f0904f684465d88d516671b1498572ada024186d7e0e01af44b9f87455d1e4
MD5 954f5856533ee994abe890b91af5fc0a
BLAKE2b-256 686ef203ff403ae309bdd863d286cfb54bfb981525f71dca221f30b9eddc0d06

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ba9bd7d2b3679820533dd7bb91ad6816cc08d22be2170140259c7b805b9cf8c
MD5 7c1963bd5025a5762e2423ecaa4114c5
BLAKE2b-256 d4bb7e56f1bf87a73f5bf07f71746b80a58ec20cc1773b3f2a48f096af73e024

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7d852cdf38a801db83a3d64d4e6adde5fca054df7c269d89a88280ff819e34d3
MD5 3139657f959955d4c4b696b7f4377a17
BLAKE2b-256 fd6aa5447f60d57dd14c2bf1b528a64da3323584c64806a48a80bb1cd69627b4

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a2c5e5d1202b403846b3ad201a855d3d78d836615e4dc2cee169273010d902f4
MD5 fb3d4c58cf0518e88ef9cbc808809ddd
BLAKE2b-256 9607cc790f5b745359f651a1b8d22316b240abd2085eae99457fef288ca9e2b6

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 817e34a7ee7bc54ea50efc7a9931129dc52491fe2b45f9805b0b3a5138c503b6
MD5 3b49352eb85c708d1310947ea5bb94d1
BLAKE2b-256 469cb4955ed4b355753272ef365d9621c7883a935e2098676e07855aa7069047

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 012f9fea49885949bfbed92c412f6681cc988b127b815285e9dbc5be23629e9b
MD5 bb402c32f89f023c5515c90b78fddb16
BLAKE2b-256 bee0008a099bc02e36663f94d951d845e3c43e0450132a0a817d46195332d5c1

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d22b624518bf32993d0835b8ef386498af459f2da32bd847e8fdee708f223d6f
MD5 220051aded8f0fb7e2a6f6ffccd92465
BLAKE2b-256 c404000dbf1e21ad2af31c8b856b36ebf25174f0c0b4865502e2bac42b8fe58d

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4ed0a48eaacc8f416d34358a0a6f24d51a7d742358e87fd7650478c6c4ad9207
MD5 8739c90f668245855aa4ea0c045f13d4
BLAKE2b-256 5b012b52e24dfbda5476b8f80bdb721357b48266b2fb0e0babd90d4b768caad2

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e1f5f5661863c22428cadbea9a8f8b58cb2c8cf79712a012bbc2c8089505532
MD5 a24bd4d8085fb5f0a4c989c5e0375858
BLAKE2b-256 bf6238be63f131bb845db24c6b07ef10f42e37905179126a727d03a3fb790ccb

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0f93da01fa1ed8f450a01c56764bd2d30ea5ae9cfd39159bb78326619ed9d2e
MD5 a905cfaca37e8b51bc7c93190883700f
BLAKE2b-256 339381b7c4d84cee4eac749345ebaaf20c9598654e16fd3a730a7efde37ca90f

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.5-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 23500ef96134027e2f2a70fbd347de2461b6ff6b0ec2a0bdc9515fe8155a23cc
MD5 1023be198b69fc8b354b14aaa40ab47b
BLAKE2b-256 430ad33c93522b35c3757a0abc49925766d11f88558de1107dc11fb885e53b8a

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