Pydumpling
English | 简体中文
Pydumpling saves Python exception or live stack snapshots to compressed .dump
files. Print a traceback, inspect saved variables with pdb, or open a remote
debugger. Derived from elifiner/pydump.
Requires Python 3.11+. Capturing another process requires CPython 3.14+.
Install
python -m pip install pydumpling
pydumpling --version
These examples describe 0.2.0.
Save an exception
Save this complete example as example.py and run python example.py:
from pydumpling import save_dumping
def calculate():
quantity = 3
price = "12.50"
return quantity + price
try:
calculate()
except TypeError:
save_dumping("error.dump", strict=True)
pydumpling --print error.dump
pydumpling --debug error.dump
# The module entry point also works:
python -m pydumpling --print error.dump
--print writes the traceback and exception text to standard output, so it
survives a pipe or a redirect; the omission notice stays on standard error.
Useful pdb commands include bt, u, d, list, ll, and pp price.
A snapshot lets you inspect saved state; it cannot resume the original program.
Save the current stack
from pydumpling import dump_current_traceback
def calculate():
quantity = 3
price = 12.5
dump_current_traceback("current.dump", strict=True)
return quantity * price
calculate()
Call catch_any_exception() once at application startup to capture unhandled
main-thread exceptions. It installs sys.excepthook and retains the previous
hook for normal exception reporting. It does not install thread or asyncio
exception handlers.
Limit capture overhead
DumpOptions() applies these defaults:
| Setting | Default |
|---|---|
max_frames |
64 frames |
max_depth |
5 nested levels |
max_items |
100 items per container |
max_string_bytes |
4,096 bytes per captured string value |
max_nodes |
10,000 visited values |
max_dump_bytes |
16 MiB of uncompressed serialized data |
Values may be summarized when a budget is reached. Customize the budget or explicitly request unrestricted capture:
from pydumpling import DumpOptions, dump_current_traceback
dump_current_traceback(
"small.dump",
options=DumpOptions(max_frames=16, max_depth=3, max_items=25),
strict=True,
)
dump_current_traceback("unlimited.dump", options=DumpOptions.unlimited(), strict=True)
Unrestricted capture can consume substantial resources and permits custom
object serialization hooks to execute. Omission reasons and applied budgets are
recorded in the loaded snapshot's snapshot_meta dictionary.
Unrestricted original objects can depend on their original environment or
custom loading hooks; successful round-trips are not guaranteed for every object.
The default readable snapshot mode is unaffected.
save_dumping(filename=None, exc_info=None, *, options=None, strict=False) and
dump_current_traceback(filename=None, *, options=None, strict=False) report
capture/write failures as warnings by default. Use strict=True to raise them.
catch_any_exception(*, options=None) accepts the same budgets.
Loading and debugging default to at most 64 MiB of decompressed dump data.
load_dumpling(path, max_bytes=None) or debug_dumpling(path, max_bytes=None)
disables this limit; the CLI equivalent is --max-load-mib 0.
Capture a running process by PID
Run this target program with CPython 3.14+ and updated Pydumpling installed:
import os
import time
import pydumpling
print(f"PID: {os.getpid()}", flush=True)
counter = 0
while True:
counter += 1
time.sleep(0.1)
In another terminal, replace 12345 with the printed PID:
pydumpling --capture-pid 12345 --output live.dump --timeout 30
pydumpling --print live.dump
The API is capture_pid(pid, filename, *, options=None, timeout=30) -> Path.
Controller and target must use the same CPython version on the same machine,
under the same user, with shared process and filesystem namespaces. The target
must have updated Pydumpling installed and permit CPython remote execution.
Operating system permissions may also prevent attachment.
A timeout stops waiting; an already dispatched request can still execute later.
The CLI prints the retained request directory on timeout. Avoid submitting
repeated requests while one is pending. Use --unlimited to remove capture
budgets explicitly.
Remove retained request files only after status.json confirms completion or
the target process has exited.
Remote inspection
The debugger defaults to 127.0.0.1:4444:
# Server:
pydumpling --rdebug error.dump --host 127.0.0.1 --port 4444
# Workstation:
ssh -L 4444:127.0.0.1:4444 user@server
# A second local terminal:
nc 127.0.0.1 4444
Remote pdb allows Python expression execution and has no built-in authentication or encryption. Keep it on loopback and use an SSH tunnel.
Trust and privacy
Only load trusted dumps: dill and pickle deserialization can execute code. Size limits do not make an untrusted file safe. Snapshots can contain local variables, credentials, personal data, and other application state; control file access, retention, and sharing.
Inspect dumps with matching Python and source versions. Cross-version loading and third-party debugger compatibility are not guaranteed. Old 0.1 dumps remain readable when their objects are compatible with the interpreter. See 0.2 migration notes.
Development
uv sync --locked --dev --extra doc
uv run --locked ruff check .
uv run --locked ruff format --check .
uv run --locked pytest --cov=pydumpling --cov-report=term-missing
uv run --locked --extra doc sphinx-build -W --keep-going -b html docs/source docs/build/html
uv build --sdist
uv build --wheel dist/pydumpling-0.2.0.tar.gz
uv run --locked twine check --strict dist/*
uv.lock is committed. Run uv lock after deliberately changing dependencies
and include the updated lockfile. CI checks Linux on Python 3.11–3.15 and Python
3.14 on Windows/macOS, with an 85% coverage floor, strict documentation builds,
and installed-wheel checks outside the source checkout. Hatchling builds
distributions; uv manages development environments.
Metadata
Release files for pydumpling 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydumpling-0.2.0.tar.gz | 169.9 kB | Without provenance | Details for pydumpling-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydumpling-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pydumpling-0.2.0-py3-none-any.whl |
Total release size: 203.6 kB
Release files / pydumpling-0.2.0.tar.gz
| Download URL | pydumpling-0.2.0.tar.gz |
|---|---|
| Size | 169.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bb85184a13112d338d89fc41b6b2a383d654a722a6fed719d6ef4ad554d619b
|
|
BLAKE2b-256 checksum How to use checksums |
821f1ab9829c2d693b0ba43c27ef78fda183296bfcdf6d9a362549357e3d8e1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / pydumpling-0.2.0-py3-none-any.whl
| Download URL | pydumpling-0.2.0-py3-none-any.whl |
|---|---|
| Size | 33.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4bd81a1dcf0526f40ddad4e3ecd4eeed4ca21b2b85f49bb953d94fa61312598
|
|
BLAKE2b-256 checksum How to use checksums |
97e8950bf1e0bdbc49e66f15bf2c33b48a3b002268d68f438e4224d1cef3b8f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for pydumpling 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.