No project description provided
Project description
Mortuary is a dead-simple post-mortem debugging tool for Python. It provides a context manager to grab uncaught exceptions, dumps a traceback into a portable pickle format, and later allows you to attach a debugger to the traceback file.
- Dead simple: Mortuary is a single < 500 line Python file.
- No dependencies: Mortuary has no dependencies outside the standard library.
dill
andipdb
are optional dependencies. - Portable: Mortuary's dump files are portable between different versions of Python and different machines. Attach dump files to tickets to share a debugging context between developers.
Example
Here is a script with an error in it.
import mortuary
def is_even(number):
return number % 2 == 0
def add(a, b):
return a + b
with mortuary.context():
is_even(add("1", "2"))
Running this script will raise a ValueError
and print a traceback.
Additionally Mortuary will create a traceback-dump.pkl
file.
$ python script.py
Traceback (most recent call last):
File "script.py", line 13, in <module>
is_even(add("1", "2"))
File "script.py", line 5, in is_even
return number % 2 == 0
~~~~~~~^~~
TypeError: not all arguments converted during string formatting
$ ls | grep dump.pkl
traceback-dump.pkl
Later, we can open a debugger session using the dump file
$ python -m mortuary traceback-dump.pkl
> script.py(5)is_even()
-> return number % 2 == 0
(Pdb) p number
'12'
Installation
Mortuary is distributed on PyPI and is pip-installable
pip install mortuary
Alternatively, you can simply copy the mortuary.py
file directly into your project.
Similar projects
License
mortuary
is distributed under the terms of the MIT license.
Credits
Mortuary's traceback dump is based on debuglater and pydump.
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
File details
Details for the file mortuary-0.1.1.tar.gz
.
File metadata
- Download URL: mortuary-0.1.1.tar.gz
- Upload date:
- Size: 50.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2e1dd3c3aa14e7105ea194f4b37739f05c08cc085c0bf6bc64e18d9aab527dd |
|
MD5 | 53e321c1d9fd27428e413c3b375d6899 |
|
BLAKE2b-256 | 082a48b05716d162f9033877730163364a180ca3a9a7d88826fc2d0d656b9b63 |
File details
Details for the file mortuary-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: mortuary-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1031e3edbf70b99b9f02dc7d48c9b1d5652091ac959a93568dfa12f799645e09 |
|
MD5 | ded65c0a9e40208d63164f393702283e |
|
BLAKE2b-256 | 19304e1fdfe7b3505765c26a19a36b99df1ced42f7dafaf8bcc1ca29688488c5 |