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.1.tar.gz (50.4 kB view details)

Uploaded Source

Built Distribution

mortuary-0.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

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

Hashes for mortuary-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d2e1dd3c3aa14e7105ea194f4b37739f05c08cc085c0bf6bc64e18d9aab527dd
MD5 53e321c1d9fd27428e413c3b375d6899
BLAKE2b-256 082a48b05716d162f9033877730163364a180ca3a9a7d88826fc2d0d656b9b63

See more details on using hashes here.

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

Hashes for mortuary-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1031e3edbf70b99b9f02dc7d48c9b1d5652091ac959a93568dfa12f799645e09
MD5 ded65c0a9e40208d63164f393702283e
BLAKE2b-256 19304e1fdfe7b3505765c26a19a36b99df1ced42f7dafaf8bcc1ca29688488c5

See more details on using hashes here.

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