offline-debug 0.1.1__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {offline_debug-0.1.1 → offline_debug-0.2.0}/PKG-INFO +41 -24
- {offline_debug-0.1.1 → offline_debug-0.2.0}/README.md +40 -23
- {offline_debug-0.1.1 → offline_debug-0.2.0}/pyproject.toml +1 -1
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/__init__.py +0 -0
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/_inner/__init__.py +0 -0
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/_inner/c_api/__init__.py +0 -0
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/_inner/c_api/_create_frame.py +0 -0
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/_inner/c_api/_link_frame.py +0 -0
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/_inner/load_traceback.py +0 -0
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/_inner/models.py +0 -0
- {offline_debug-0.1.1 → offline_debug-0.2.0}/offline_debug/_inner/save_traceback.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: offline-debug
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Debug exceptions offline by saving them to a dump and raising them at a later point.
|
|
5
5
|
Author: Itai Elidan
|
|
6
6
|
Author-email: Itai Elidan <itaielidan@gmail.com>
|
|
@@ -16,43 +16,60 @@ Description-Content-Type: text/markdown
|
|
|
16
16
|
[](https://github.com/INTODAN/offline-debug/actions)
|
|
17
17
|
[](https://github.com/INTODAN/offline-debug)
|
|
18
18
|
[](https://github.com/astral-sh/ruff)
|
|
19
|
-
[](https://github.com/
|
|
19
|
+
[](https://github.com/astral-sh/ty)
|
|
20
20
|
|
|
21
21
|
## Overview
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
A Python package for high-fidelity serialization and deserialization of exceptions and their complete tracebacks. Unlike other
|
|
24
|
+
solutions, `offline-debug` reconstructs **actual** `types.FrameType` objects using the Python C API, ensuring that re-raised
|
|
25
|
+
exceptions look and feel genuine to debuggers and introspection tools.
|
|
23
26
|
|
|
24
27
|
## Core Functions
|
|
25
|
-
- `save_traceback(exc: Exception, file_path: str)`:
|
|
26
|
-
Serializes an exception, its traceback, and all picklable local/global variables to a binary file.
|
|
27
|
-
- `load_traceback(file_path: str) -> typing.Never`:
|
|
28
|
-
Loads the serialized state, reconstructs the exception and its full traceback chain (including `__cause__` and `__context__`), and raises it.
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- `marshal` is used for code objects.
|
|
36
|
-
- Non-picklable items are gracefully handled by storing their `repr`.
|
|
37
|
-
|
|
38
|
-
## Development & Tooling
|
|
39
|
-
- **Package Manager**: `uv`
|
|
40
|
-
- **Minimum Python**: 3.12
|
|
41
|
-
- **Testing**: `pytest`
|
|
42
|
-
- **Commands**:
|
|
43
|
-
- Add dependencies: `uv add <package>`
|
|
44
|
-
- Run tests: `uv run pytest`
|
|
29
|
+
- `save_traceback(exc: BaseException, file: Path | BytesIO)`:
|
|
30
|
+
Serializes an exception, its traceback, and all picklable local/global variables to a binary file or buffer.
|
|
31
|
+
- `load_traceback(file: Path | BytesIO) -> Never`:
|
|
32
|
+
Loads the serialized state, reconstructs the exception and its full traceback chain (including `__cause__` and `__context__`),
|
|
33
|
+
and raises it.
|
|
45
34
|
|
|
46
35
|
## Usage Example
|
|
36
|
+
|
|
37
|
+
to get started, install with:
|
|
38
|
+
`pip install offline-debug` or `uv add offline-debug`
|
|
39
|
+
|
|
47
40
|
```python
|
|
41
|
+
from pathlib import Path
|
|
48
42
|
from offline_debug import save_traceback, load_traceback
|
|
49
43
|
|
|
50
44
|
try:
|
|
51
45
|
# Code that might fail
|
|
52
46
|
some_complex_operation()
|
|
53
47
|
except Exception as e:
|
|
54
|
-
save_traceback(e, "crash_report.dump")
|
|
48
|
+
save_traceback(e, Path("crash_report.dump"))
|
|
55
49
|
|
|
56
50
|
# To debug or re-examine later:
|
|
57
|
-
load_traceback("crash_report.dump")
|
|
51
|
+
load_traceback(Path("crash_report.dump"))
|
|
58
52
|
```
|
|
53
|
+
|
|
54
|
+
## Technical Implementation
|
|
55
|
+
|
|
56
|
+
- **True Frame Reconstruction**: Uses `ctypes` to call `PyFrame_New` from the Python C API. This creates real `frame` objects
|
|
57
|
+
which are required for a valid `types.TracebackType`.
|
|
58
|
+
- **Python 3.13 Compatibility**: Leverages PEP 667 features where `f_locals` is a write-through proxy, allowing for accurate local
|
|
59
|
+
variable restoration.
|
|
60
|
+
- **Support python 3.12 as well**
|
|
61
|
+
- **Robust Serialization**:
|
|
62
|
+
- `pickle` is used for exceptions and variables.
|
|
63
|
+
- `marshal` is used for code objects.
|
|
64
|
+
- Non-picklable items are gracefully handled by storing their `repr`.
|
|
65
|
+
|
|
66
|
+
## Development & Tooling
|
|
67
|
+
|
|
68
|
+
- **Package Manager**: `uv`
|
|
69
|
+
- **Minimum Python**: 3.12
|
|
70
|
+
- **Testing**: `pytest`
|
|
71
|
+
- **Commands**:
|
|
72
|
+
- Add dependencies: `uv add <package>`
|
|
73
|
+
- Run tests: `uv run pytest`
|
|
74
|
+
|
|
75
|
+
|
|
@@ -4,43 +4,60 @@
|
|
|
4
4
|
[](https://github.com/INTODAN/offline-debug/actions)
|
|
5
5
|
[](https://github.com/INTODAN/offline-debug)
|
|
6
6
|
[](https://github.com/astral-sh/ruff)
|
|
7
|
-
[](https://github.com/
|
|
7
|
+
[](https://github.com/astral-sh/ty)
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
A Python package for high-fidelity serialization and deserialization of exceptions and their complete tracebacks. Unlike other
|
|
12
|
+
solutions, `offline-debug` reconstructs **actual** `types.FrameType` objects using the Python C API, ensuring that re-raised
|
|
13
|
+
exceptions look and feel genuine to debuggers and introspection tools.
|
|
11
14
|
|
|
12
15
|
## Core Functions
|
|
13
|
-
- `save_traceback(exc: Exception, file_path: str)`:
|
|
14
|
-
Serializes an exception, its traceback, and all picklable local/global variables to a binary file.
|
|
15
|
-
- `load_traceback(file_path: str) -> typing.Never`:
|
|
16
|
-
Loads the serialized state, reconstructs the exception and its full traceback chain (including `__cause__` and `__context__`), and raises it.
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- `marshal` is used for code objects.
|
|
24
|
-
- Non-picklable items are gracefully handled by storing their `repr`.
|
|
25
|
-
|
|
26
|
-
## Development & Tooling
|
|
27
|
-
- **Package Manager**: `uv`
|
|
28
|
-
- **Minimum Python**: 3.12
|
|
29
|
-
- **Testing**: `pytest`
|
|
30
|
-
- **Commands**:
|
|
31
|
-
- Add dependencies: `uv add <package>`
|
|
32
|
-
- Run tests: `uv run pytest`
|
|
17
|
+
- `save_traceback(exc: BaseException, file: Path | BytesIO)`:
|
|
18
|
+
Serializes an exception, its traceback, and all picklable local/global variables to a binary file or buffer.
|
|
19
|
+
- `load_traceback(file: Path | BytesIO) -> Never`:
|
|
20
|
+
Loads the serialized state, reconstructs the exception and its full traceback chain (including `__cause__` and `__context__`),
|
|
21
|
+
and raises it.
|
|
33
22
|
|
|
34
23
|
## Usage Example
|
|
24
|
+
|
|
25
|
+
to get started, install with:
|
|
26
|
+
`pip install offline-debug` or `uv add offline-debug`
|
|
27
|
+
|
|
35
28
|
```python
|
|
29
|
+
from pathlib import Path
|
|
36
30
|
from offline_debug import save_traceback, load_traceback
|
|
37
31
|
|
|
38
32
|
try:
|
|
39
33
|
# Code that might fail
|
|
40
34
|
some_complex_operation()
|
|
41
35
|
except Exception as e:
|
|
42
|
-
save_traceback(e, "crash_report.dump")
|
|
36
|
+
save_traceback(e, Path("crash_report.dump"))
|
|
43
37
|
|
|
44
38
|
# To debug or re-examine later:
|
|
45
|
-
load_traceback("crash_report.dump")
|
|
39
|
+
load_traceback(Path("crash_report.dump"))
|
|
46
40
|
```
|
|
41
|
+
|
|
42
|
+
## Technical Implementation
|
|
43
|
+
|
|
44
|
+
- **True Frame Reconstruction**: Uses `ctypes` to call `PyFrame_New` from the Python C API. This creates real `frame` objects
|
|
45
|
+
which are required for a valid `types.TracebackType`.
|
|
46
|
+
- **Python 3.13 Compatibility**: Leverages PEP 667 features where `f_locals` is a write-through proxy, allowing for accurate local
|
|
47
|
+
variable restoration.
|
|
48
|
+
- **Support python 3.12 as well**
|
|
49
|
+
- **Robust Serialization**:
|
|
50
|
+
- `pickle` is used for exceptions and variables.
|
|
51
|
+
- `marshal` is used for code objects.
|
|
52
|
+
- Non-picklable items are gracefully handled by storing their `repr`.
|
|
53
|
+
|
|
54
|
+
## Development & Tooling
|
|
55
|
+
|
|
56
|
+
- **Package Manager**: `uv`
|
|
57
|
+
- **Minimum Python**: 3.12
|
|
58
|
+
- **Testing**: `pytest`
|
|
59
|
+
- **Commands**:
|
|
60
|
+
- Add dependencies: `uv add <package>`
|
|
61
|
+
- Run tests: `uv run pytest`
|
|
62
|
+
|
|
63
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|