Debug exceptions offline by saving them to a dump and raising them at a later point.
Project description
Traceback Serializer Project (offline-debug)
Overview
A Python package for high-fidelity serialization and deserialization of exceptions and their complete tracebacks. Unlike other solutions, offline-debug reconstructs actual types.FrameType objects using the Python C API, ensuring that re-raised exceptions look and feel genuine to debuggers and introspection tools.
Core Functions
save_traceback(exc: Exception, file_path: str): Serializes an exception, its traceback, and all picklable local/global variables to a binary file.load_traceback(file_path: str) -> typing.Never: Loads the serialized state, reconstructs the exception and its full traceback chain (including__cause__and__context__), and raises it.
Technical Implementation
- True Frame Reconstruction: Uses
ctypesto callPyFrame_Newfrom the Python C API. This creates realframeobjects which are required for a validtypes.TracebackType. - Python 3.13 Compatibility: Leverages PEP 667 features where
f_localsis a write-through proxy, allowing for accurate local variable restoration. - Robust Serialization:
pickleis used for exceptions and variables.marshalis used for code objects.- Non-picklable items are gracefully handled by storing their
repr.
Development & Tooling
- Package Manager:
uv - Minimum Python: 3.12
- Testing:
pytest - Commands:
- Add dependencies:
uv add <package> - Run tests:
uv run pytest
- Add dependencies:
Usage Example
from offline_debug import save_traceback, load_traceback
try:
# Code that might fail
some_complex_operation()
except Exception as e:
save_traceback(e, "crash_report.dump")
# To debug or re-examine later:
load_traceback("crash_report.dump")
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 offline_debug-0.1.1.tar.gz.
File metadata
- Download URL: offline_debug-0.1.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
286a3e34f1113b340f3cabc7c38ee5d16829608a6d855440bcfaba3a2b46a540
|
|
| MD5 |
29b4ae187667c5e5b464abee5d757252
|
|
| BLAKE2b-256 |
21c47d50008c7c68ecb23882e155f945ffdf2ff41f80c255585b0be6f2102a0c
|
Provenance
The following attestation bundles were made for offline_debug-0.1.1.tar.gz:
Publisher:
ci.yml on INTODAN/offline-debug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
offline_debug-0.1.1.tar.gz -
Subject digest:
286a3e34f1113b340f3cabc7c38ee5d16829608a6d855440bcfaba3a2b46a540 - Sigstore transparency entry: 1306942387
- Sigstore integration time:
-
Permalink:
INTODAN/offline-debug@f98ec011479b38c5d421b4c4239fd1fad96e723a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/INTODAN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@f98ec011479b38c5d421b4c4239fd1fad96e723a -
Trigger Event:
push
-
Statement type:
File details
Details for the file offline_debug-0.1.1-py3-none-any.whl.
File metadata
- Download URL: offline_debug-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c42d7808cd9dabcacb8636ba44b561d4de9f8c7df95c8e62090ad68d0990795
|
|
| MD5 |
7cc8bfe1ffe06629ede7512d6a944aba
|
|
| BLAKE2b-256 |
0cb477adfcd20d0535d6e5ffe8b47552ba44cfcd677c458b8c50e4852e937e27
|
Provenance
The following attestation bundles were made for offline_debug-0.1.1-py3-none-any.whl:
Publisher:
ci.yml on INTODAN/offline-debug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
offline_debug-0.1.1-py3-none-any.whl -
Subject digest:
0c42d7808cd9dabcacb8636ba44b561d4de9f8c7df95c8e62090ad68d0990795 - Sigstore transparency entry: 1306942545
- Sigstore integration time:
-
Permalink:
INTODAN/offline-debug@f98ec011479b38c5d421b4c4239fd1fad96e723a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/INTODAN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@f98ec011479b38c5d421b4c4239fd1fad96e723a -
Trigger Event:
push
-
Statement type: