Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ploomber/debuglater
Store Python traceback for later debugging. 🐛
https://github.com/ploomber/debuglater
coredump debug debugging python
Last synced: about 2 months ago
JSON representation
Store Python traceback for later debugging. 🐛
- Host: GitHub
- URL: https://github.com/ploomber/debuglater
- Owner: ploomber
- License: mit
- Fork: true (elifiner/pydump)
- Created: 2022-07-21T00:42:10.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-25T01:11:22.000Z (8 months ago)
- Last Synced: 2024-07-10T08:44:04.364Z (3 months ago)
- Topics: coredump, debug, debugging, python
- Language: Python
- Homepage:
- Size: 95.7 KB
- Stars: 58
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `debuglater`: Store Python traceback for later debugging
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Community
|
Newsletter
|
|
|
Blog
|
Website
|
YouTube> [!TIP]
> Deploy AI apps for free on [Ploomber Cloud!](https://ploomber.io/?utm_medium=github&utm_source=debuglater)- `debuglater` writes the traceback object so you can use it later for debugging
- Works with `pdb`, `pudb`, `ipdb` and `pdbpp`
- You can use it to debug on a different machine, no need to have access to the source codeFor support, feature requests, and product updates: [join our community](https://ploomber.io/community), subscribe to our [newsletter](https://share.hsforms.com/1E7Qa_OpcRPi_MV-segFsaAe6c2g) or follow us on [Twitter](https://twitter.com/ploomber)/[LinkedIn](https://www.linkedin.com/company/ploomber/).
![demo](https://ploomber.io/images/doc/debuglater-demo/debug.gif)
[Click here to tell your friends on Twitter!](https://twitter.com/intent/tweet?text=I%20just%20discovered%20debuglater%20on%20GitHub%3A%20serialize%20Python%20tracebacks%20for%20later%20debugging%21%20%F0%9F%A4%AF&url=https://github.com/ploomber/debuglater/)
[Click here to tell your friends on LinkedIn!](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/ploomber/debuglater/)
## Installation
```sh
pip install debuglater
# for better serialization support (via dill)
pip install 'debuglater[all]'# ..or with conda
conda install debuglater -c conda-forge
```## Usage
```python
import sys
import debuglatersys.excepthook = debuglater.excepthook_factory(__file__)
```For more details and alternative usage, keep reading.
## Example
```sh
# get the example
curl -O https://raw.githubusercontent.com/ploomber/debuglater/master/examples/crash.py
``````sh tags=["raises-exception"]
# crash
python crash.py
```Debug:
```sh
dltr crash.dump
```Upon initialization, try printing the variables `x` and `y`:
```
Starting pdb...
> /Users/ploomber/debuglater/examples/crash.py(5)()
-> x / y
(Pdb) x
1
(Pdb) y
0
(Pdb) quit
```*Note: you can also use:* `debuglater crash.py.dump`
## Integration with Jupyter/IPython
> **Note**
> For an integration with papermill, see [ploomber-engine](https://github.com/ploomber/ploomber-engine)Add this at the top of your notebook/script:
```python
from debuglater import patch_ipython
patch_ipython()
``````sh
# get sample notebook
curl -O https://raw.githubusercontent.com/ploomber/debuglater/master/examples/crash.ipynb# install package to run notebooks
pip install nbclient
``````sh tags=["raises-exception"]
# run the notebook
jupyter execute crash.ipynb
```Debug:
```
dltr jupyter.dump
```Upon initialization, try printing the variables `x` and `y`:
```
Starting pdb...
-> x / y
(Pdb) x
1
(Pdb) y
0
(Pdb) quit
```*Note: you can also use:* `debuglater jupyter.dump`
## Motivation
The [Ploomber team](https://github.com/ploomber/ploomber) develops tools for
data analysis. When data analysis code executes non-interactively
(example: a daily cron job that generates a report), it becomes hard to debug
since logs are often insufficient, forcing data practitioners to re-run the
code from scratch, which can take a lot of time.However, `debuglater` is a generic tool that can be used for any use case to facilitate post-mortem debugging.
## Use cases
* Debug long-running code (e.g., crashed Machine Learning job)
* Debug multiprocessing code (generate one dump file for each process)## Credits
This project is a fork of [Eli Finer's pydump](https://github.com/elifiner/pydump).