{"id":13595612,"url":"https://github.com/sanic-org/tracerite","last_synced_at":"2025-12-28T07:34:08.247Z","repository":{"id":57446120,"uuid":"211874043","full_name":"sanic-org/tracerite","owner":"sanic-org","description":"Tracebacks for Humans (in Jupyter notebooks)","archived":false,"fork":false,"pushed_at":"2025-01-20T14:36:19.000Z","size":1053,"stargazers_count":12,"open_issues_count":8,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T19:50:34.361Z","etag":null,"topics":["jupyter","public-domain","python","traceback"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanic-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-09-30T14:04:16.000Z","updated_at":"2025-01-20T14:36:21.000Z","dependencies_parsed_at":"2023-09-30T08:05:37.657Z","dependency_job_id":"5c31747a-a52a-4c41-ab4e-2148948b3cde","html_url":"https://github.com/sanic-org/tracerite","commit_stats":{"total_commits":56,"total_committers":4,"mean_commits":14.0,"dds":0.2321428571428571,"last_synced_commit":"4417b7018d61987293c1d4604654dfb4223489de"},"previous_names":["tronic/niceback"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Ftracerite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Ftracerite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Ftracerite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanic-org%2Ftracerite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanic-org","download_url":"https://codeload.github.com/sanic-org/tracerite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248651925,"owners_count":21139914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter","public-domain","python","traceback"],"created_at":"2024-08-01T16:01:53.592Z","updated_at":"2025-12-28T07:34:08.241Z","avatar_url":"https://github.com/sanic-org.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# TraceRite\n\n**Beautiful, readable error messages for Python, with terminal and HTML formatting.**\n\n## Platforms\n\n### Python scripts or REPL\n\n```sh\npip install tracerite\n```\n\n```python\nimport tracerite; tracerite.load()\n```\n\nAny error message after that call will be prettified.\n\n### IPython or Jupyter Notebook\n\n```ipython\n%pip install tracerite\n%load_ext tracerite\n```\n\nThis enables tracebacks in text or HTML format depending on where you are running. Add to `~/.ipython/profile_default/startup/tracerite.ipy` to make it load automatically for all your ipython and notebook sessions. Alternatively, put the two lines at the top of your notebook.\n\n### FastAPI\n\nAdd the extension loader at the top of your app module:\n\n```python\nfrom tracerite import patch_fastapi; patch_fastapi()\n```\n\nThis monkeypatches Starlette error handling and FastAPI routing to work with HTML tracebacks. Note: this runs regardless of whether you are in production mode or debug mode, so you might want to call that function only conditionally in the latter.\n\n### Sanic\n\nComes with TraceRite built in whenever running in debug mode.\n\n## What It Looks Like\n\n| | |\n|---|---|\n| ![NumPy error](https://raw.githubusercontent.com/sanic-org/tracerite/main/docs/numpy.webp) | ![Complex call chain](https://raw.githubusercontent.com/sanic-org/tracerite/main/docs/complex.webp) |\n| **NumPy error** — Variable inspector shows array shapes and values at a glance. | **Complex call chains** — Library internals collapsed, your code front and center. |\n| ![Exception chain](https://raw.githubusercontent.com/sanic-org/tracerite/main/docs/excchain.webp) | ![IPython](https://raw.githubusercontent.com/sanic-org/tracerite/main/docs/ipython.webp) |\n| **Exception chains** — Chained exceptions organized with the most relevant on top. | **Terminal** — Compact clean error messages in terminals. |\n\n## Features\n\n- **Only relevant things shown** - Shows library internals but focuses on where the flow touched your code, and the variables used at the spot.\n- **Variable inspection** - See the values of your variables in a pretty printed HTML format (or JSON-compatible machine-readable dict)\n- **JSON output** - Intermediady dict format is JSON-compatible, useful for machine processing and used by our HTML module.\n- **HTML output** - Works in Jupyter, Colab, and web frameworks such as FastAPI and Sanic as the debug mode error handler.\n- **TTY output** - Colorful, formatted tracebacks for terminal applications.\n- **Custom CSS** - Implement dark mode or custom look like that in the Sanic Framework with CSS variable overrides.\n\n## Usage\n\n### `html_traceback(exc)`\n\nRenders an exception as interactive HTML that can be included on a page. Pass an exception object, or call with no arguments inside an `except` block to use the current exception.\n\n### `extract_chain(exc)`\n\nExtracts exception information as a list of dictionaries—useful for logging, custom formatting, or machine processing.\n\n### `prettyvalue(value)`\n\nFormats any value with smart truncation, array shape display, and SI-scaled numerics. Useful beyond exceptions for debugging tools or custom logging.\n\n### `extract_variables(locals, source)`\n\nExtracts and formats variables mentioned in a line of source code.\n\n### `load()` / `unload()`\n\nLoad or remove TraceRite as the default exception handler for terminal applications. Handles both `sys.excepthook` and `threading.excepthook`.\n\n### `tty_traceback(exc)`\n\nRenders an exception as colorful terminal output with ANSI escape codes. Pass an exception object, or call with no arguments inside an `except` block.\n\nSee the [API documentation](https://github.com/sanic-org/tracerite/blob/main/docs/API.md) for details, or [Development guide](https://github.com/sanic-org/tracerite/blob/main/docs/Development.md) for contributors.\n\n## License\n\nPublic Domain or equivalent.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanic-org%2Ftracerite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanic-org%2Ftracerite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanic-org%2Ftracerite/lists"}