Skip to main content

reverse_tb is a jupyter notebook magic that reverses the order of the traceback, making it easier to see the most relevant information at the top of the cell output.

Project description

reverse_tb

reverse_tb is a jupyter notebook magic that reverses the order of the traceback, making it easier to see the most relevant information at the top of the cell output.

Install

pip install reverse_tb

How to use

from reverse_tb.core import reverse_tb
def foo():
    return bar()

def bar():
    return baz()

def baz():
    try:
        qux()
    except KeyError as e:
        raise Exception
    return qux()

def qux():
    d = {}
    return d['key']
foo()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[2], line 9, in baz()
      8 try:
----> 9     qux()
     10 except KeyError as e:

Cell In[2], line 16, in qux()
     15 d = {}
---> 16 return d['key']

KeyError: 'key'

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 foo()

Cell In[2], line 2, in foo()
      1 def foo():
----> 2     return bar()

Cell In[2], line 5, in bar()
      4 def bar():
----> 5     return baz()

Cell In[2], line 11, in baz()
      9     qux()
     10 except KeyError as e:
---> 11     raise Exception
     12 return qux()

Exception: 
%%reverse_tb
foo()
---------------------------------------------------------------------------
KeyError                                  Traceback (last call first)
KeyError: 'key'
Cell In[2], line 16, in qux()
     15 d = {}
---> 16 return d['key']
        d = {}

Cell In[2], line 9, in baz()
      8 try:
----> 9     qux()
     10 except KeyError as e:


During handling of the above exception, another exception occurred:

Exception                                 Traceback (last call first)
Exception: 
Cell In[2], line 11, in baz()
      9     qux()
     10 except KeyError as e:
---> 11     raise Exception
     12 return qux()

Cell In[2], line 5, in bar()
      4 def bar():
----> 5     return baz()

Cell In[2], line 2, in foo()
      1 def foo():
----> 2     return bar()

Cell In[4], line 1
----> 1 foo()
from reverse_tb.on import *
foo()
---------------------------------------------------------------------------
KeyError                                  Traceback (last call first)
KeyError: 'key'
Cell In[2], line 16, in qux()
     15 d = {}
---> 16 return d['key']
        d = {}

Cell In[2], line 9, in baz()
      8 try:
----> 9     qux()
     10 except KeyError as e:


During handling of the above exception, another exception occurred:

Exception                                 Traceback (last call first)
Exception: 
Cell In[2], line 11, in baz()
      9     qux()
     10 except KeyError as e:
---> 11     raise Exception
     12 return qux()

Cell In[2], line 5, in bar()
      4 def bar():
----> 5     return baz()

Cell In[2], line 2, in foo()
      1 def foo():
----> 2     return bar()

Cell In[4], line 1
----> 1 foo()
reverse_tb_off()
foo()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[2], line 9, in baz()
      8 try:
----> 9     qux()
     10 except KeyError as e:

Cell In[2], line 16, in qux()
     15 d = {}
---> 16 return d['key']

KeyError: 'key'

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 foo()

Cell In[2], line 2, in foo()
      1 def foo():
----> 2     return bar()

Cell In[2], line 5, in bar()
      4 def bar():
----> 5     return baz()

Cell In[2], line 11, in baz()
      9     qux()
     10 except KeyError as e:
---> 11     raise Exception
     12 return qux()

Exception: 

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

reverse_tb-0.0.4.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

reverse_tb-0.0.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file reverse_tb-0.0.4.tar.gz.

File metadata

  • Download URL: reverse_tb-0.0.4.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for reverse_tb-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8f103e5e2bb797f42707ecc59983480e92458d75a109bd95a1244a6f66e8603b
MD5 16abf2d5c5462ad7a1cbb69d6ea024ad
BLAKE2b-256 18fd5023a4f5fc073402a309bafbbf81c8b59273a1fa885c8de790570b79654d

See more details on using hashes here.

File details

Details for the file reverse_tb-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: reverse_tb-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for reverse_tb-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d3a2a6027a2d1755d9027dbdea6f0b7fad632c6e9fa9d84fbba30e9c32f88bb5
MD5 c05df9415ba4e3338f66be0703bd7ade
BLAKE2b-256 f2fa03360c08e1f1b1afa4605e12c7496e81d1eee66cae78ade9098bd2a6d08d

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