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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: offline-debug
3
- Version: 0.1.1
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
  [![Tests](https://github.com/INTODAN/offline-debug/actions/workflows/ci.yml/badge.svg)](https://github.com/INTODAN/offline-debug/actions)
17
17
  [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/INTODAN/offline-debug)
18
18
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
19
- [![Ty checked](https://img.shields.io/badge/ty-checked-blue.svg)](https://github.com/intodan/ty)
19
+ [![Ty checked](https://img.shields.io/badge/ty-checked-blue.svg)](https://github.com/astral-sh/ty)
20
20
 
21
21
  ## Overview
22
- 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.
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
- ## Technical Implementation
31
- - **True Frame Reconstruction**: Uses `ctypes` to call `PyFrame_New` from the Python C API. This creates real `frame` objects which are required for a valid `types.TracebackType`.
32
- - **Python 3.13 Compatibility**: Leverages PEP 667 features where `f_locals` is a write-through proxy, allowing for accurate local variable restoration.
33
- - **Robust Serialization**:
34
- - `pickle` is used for exceptions and variables.
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
  [![Tests](https://github.com/INTODAN/offline-debug/actions/workflows/ci.yml/badge.svg)](https://github.com/INTODAN/offline-debug/actions)
5
5
  [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/INTODAN/offline-debug)
6
6
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
7
- [![Ty checked](https://img.shields.io/badge/ty-checked-blue.svg)](https://github.com/intodan/ty)
7
+ [![Ty checked](https://img.shields.io/badge/ty-checked-blue.svg)](https://github.com/astral-sh/ty)
8
8
 
9
9
  ## Overview
10
- 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.
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
- ## Technical Implementation
19
- - **True Frame Reconstruction**: Uses `ctypes` to call `PyFrame_New` from the Python C API. This creates real `frame` objects which are required for a valid `types.TracebackType`.
20
- - **Python 3.13 Compatibility**: Leverages PEP 667 features where `f_locals` is a write-through proxy, allowing for accurate local variable restoration.
21
- - **Robust Serialization**:
22
- - `pickle` is used for exceptions and variables.
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
+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "offline-debug"
3
- version = "0.1.1"
3
+ version = "0.2.0"
4
4
  description = "Debug exceptions offline by saving them to a dump and raising them at a later point."
5
5
  readme = "README.md"
6
6
  authors = [