Automatic installation of Rich's traceback handler
Project description
rich-tracebacks
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 to 1
.
export RICH_TRACEBACKS=1
That's it. Rich's traceback handler will be automatically installed each time you run your program.
Disabling
Set the RICH_TRACEBACKS
environment variable to 0
.
export RICH_TRACEBACKS=0
Alternatively, you can unset the variable entirely.
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
Built Distribution
File details
Details for the file rich_tracebacks-1.0.0.tar.gz
.
File metadata
- Download URL: rich_tracebacks-1.0.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 686c231c652a916affa4934e986f4359b1d087208893b5b6bab48c5750e7c90d |
|
MD5 | 119241b17d211a934e980c1db5376d7c |
|
BLAKE2b-256 | d24f9e25ce893d335888f4be81a37ad276a56bde9de19f1c105b0c29282b2c6f |
File details
Details for the file rich_tracebacks-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: rich_tracebacks-1.0.0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8189f5f9bf565c7708166525b4de8b07ed364caefb389990abac81cc85815e59 |
|
MD5 | a11a817f3f2ab6ba4dc3d342853577b8 |
|
BLAKE2b-256 | e2cf76e81fa07c464d8c4b44ef54450d350cc23c3bdd1cbd1e8b7836a00ad035 |