Skip to main content

Tooling for debugging later

Project description

Wipeout 🌊

Savable/debuggable exceptions

Note: this project contains code taken from the awesome, but no longer maintained pydump

Motivation

Ever wish you could just jump into debugging an error that happened in production?

Wipeout will let you do that (with a few limitations at the moment)

It overrides the python system exception hook (the thing that happens when python crashes out due to an unhandled error) so that before exiting, a rerunnable traceback will be saved.

Wipeout also makes use of the great library fsspec so that you can save/load debug sessions to a variety of storage options (local, s3, azure blob, ssh, etc etc).

How to

Install

pip install wipeout

Use to store and load exceptions

Here's a simple example to save to a static file:

import wipeout

wipeout.install(lambda: "~/coolfile.wipeout")

After that, if the code hits an error, it'll save a debug session to that location, which can later be triggered with:

python -m wipeout.load --file ~/coolfile.wipeout

The above command will open up a postmortem session in your debugger of choice (based on your PYTHONBREAKPOINT environment variable) where your error happened.

You might want to include a date or something so that multiple errors don't overwrite each other.

from datetime import datetime

import wipeout

def filename_function():
  date_string = datetime.now().strftime("%Y%m%d%H%S%f")
  return f"~/cool_{date_string}.wipeout"

wipeout.install(filename_function)

And you can pass in storage options plus an fsspec prefix if you wanted to save in the cloud (see fsspec for more details):

from datetime import datetime

import wipeout

def filename_function():
  date_string = datetime.now().strftime("%Y%m%d%H%S%f")
  return f"abfs://someplace/cool_{date_string}.wipeout"

wipeout.install(filename_function, storage_options={"account_name": "blobstore", "anon": False})

Run mode

Wipeout also has a "run mode" which is a quick command to support running a python script as normal, but jumping into a debug session if an error is raised:

python -m wipeout.run rad/python/script.py

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

wipeout-0.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

wipeout-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file wipeout-0.0.1.tar.gz.

File metadata

  • Download URL: wipeout-0.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for wipeout-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8e16aca29ca579abc7db8b1baed6b9a4bf1340b8d984f602c56132d077c6c8ca
MD5 547c7e0bfce2334193611e7cc26f8254
BLAKE2b-256 4e09de34311937820597b74fefca9018598daf16e6cbb3e0eeec0e1c3a1862be

See more details on using hashes here.

File details

Details for the file wipeout-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: wipeout-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for wipeout-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b16406b0fbebaca63a12e2e7db6e3050b86a492447f015e1f165ada5f067dec
MD5 59761eea97eb12e8100ee5539d79c6a6
BLAKE2b-256 c0500f92a5f395d335bbf8a6d3ad36a8abe829969038b8b3d673bd757a795547

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