Skip to main content

Improve stack traces with the values associated with each argument in each frame.

Project description

ReprTraceback

ReprTraceback is a module that utilizes the sys.excepthook to throw custom traceback messages. Specifically, it includes values of positional, var, and keyword arguments.

Before & After

Before

Traceback (most recent call last):
  File "main.py", line 17, in <module>
    main()
  File "main.py", line 13, in main
    get_element(n, verbose, *args, **kwargs)
  File "main.py", line 5, in get_element
    return my_list[k]
           ~~~~~~~^^^
IndexError: list index out of range
# What is k? What was passed in? We'll never know. Hopefully it's easy to reproduce.

After

Traceback (most recent call last):
  File "main.py", line 17, in <module>
    main()
  File "main.py", line 13, in main
    main()
         ^^
  File "main.py", line 5, in get_element
    get_element(k=5, verbose=True, args=('my', 'var', 'args'), kwargs={'Repr': 'Traceback'})
                ^^^^^^^^^^
IndexError: list index out of range

Installation

You can install the project using pip:

pip install ReprTraceback

Usage

Import and Init ReprTraceback.

import ReprTraceback

# Call the init() function to set up the new traceback handler
ReprTraceback.init()

# ...
# Your code here
# ...

# When an exception occurs, the traceback will include the actual argument values
# passed to functions, providing better insight into the code flow and bug diagnosis.

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

ReprTraceback-1.0.2.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

ReprTraceback-1.0.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file ReprTraceback-1.0.2.tar.gz.

File metadata

  • Download URL: ReprTraceback-1.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for ReprTraceback-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ba6197a9331ec89e7477093f384a75d2a9d78025f2e73c215faef9faf04f2d8c
MD5 6a9a54312dea86b08a70d91857767c9b
BLAKE2b-256 c1058d70c37c9afe4e8d95de6207d09536d16933eab16c3f20b80103058cad16

See more details on using hashes here.

File details

Details for the file ReprTraceback-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ReprTraceback-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8dde8732c088a9e9dc4b4e07e392c8908b1545ceb72328a5b364296939fbf5e0
MD5 e26070d2d6b5f9fd928e8338478062a8
BLAKE2b-256 2a43a85439eac57840a05b410f9805c0ff6a1963d30afc201f868218d2d8fe84

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