Skip to main content

Automatic installation of Rich's traceback handler

Project description

rich-tracebacks

PyPI - Python Version PyPI GitHub release (latest SemVer) PyPI - License

rich-tracebacks automates the installation of Rich's traceback handler in Python programs. Compared to Rich's own sanctioned method of automatically installing its traceback handler, rich-tracebacks is markedly simpler and agnostic to your virtual environment.

Installation

pip install rich-tracebacks

Usage

Enabling

Set the RICH_TRACEBACKS environment variable. The value of the variable doesn't matter, but we'll use 1 as an example.

export RICH_TRACEBACKS=1

That's it. Rich's traceback handler will be automatically installed each time you run your program.

Disabling

Unset the RICH_TRACEBACKS environment variable.

unset RICH_TRACEBACKS

Configuration

You can configure the traceback handler with its supported options by creating an rt_config.py file at your project's root. The file should contain a dictionary named config that maps option names to their intended values. For example:

# rt_config.py

config = {
    "show_locals": True,
    "width": 120,
    "theme": "monokai",
    ...
}

Of special note is the console option, which takes a Rich Console object. To use this option, you must import the Console class in your rt_config.py file. For example:

# rt_config.py

from rich.console import Console

config = {
    "console": Console(file=open("traceback.log", "w")),
    ...
}

Options that are not defined in rt_config.py will fall back to their default values. If rt_config.py does not exist, all options will fall back to their default values.

License

rich-tracebacks is licensed under the MIT License.

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

rich_tracebacks-1.0.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

rich_tracebacks-1.0.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file rich_tracebacks-1.0.1.tar.gz.

File metadata

  • Download URL: rich_tracebacks-1.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure

File hashes

Hashes for rich_tracebacks-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a63f04e12eea26523b7edc485d0eecf4ef26a4b890971c31a6fe51cf050fa2cd
MD5 0749707c8ff587de81ffab8ef59c297c
BLAKE2b-256 495d03ef1b4796ff3833dc8fff30f769a872bb33c0c0accb6c0011ff8600fbac

See more details on using hashes here.

File details

Details for the file rich_tracebacks-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: rich_tracebacks-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure

File hashes

Hashes for rich_tracebacks-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce5f9337d28b3004a3d43d72d9f8b3a72ebc141deacf790d17172d6d6e1ec1a6
MD5 cbb8e9a8decbf1a02cba229de72009bb
BLAKE2b-256 f451ee8d5e08c359a1cd150c76196f3231d4f06585235f0931331bd0dc439749

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