Skip to main content

No project description provided

Project description

alt text

Tests Documentation PyPI - Version PyPI - Python Version


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 and ipdb 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mortuary-0.1.0.tar.gz (49.0 kB view hashes)

Uploaded Source

Built Distribution

mortuary-0.1.0-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page