rich-tracebacks


Namerich-tracebacks JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/celsiusnarhwal/rich-tracebacks
SummaryAutomatic installation of Rich's traceback handler
upload_time2023-01-04 19:33:56
maintainer
docs_urlNone
authorcelsius narhwal
requires_python>=3.6.3,<4.0.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # rich-tracebacks

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rich-tracebacks?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/rich-tracebacks)
[![PyPI](https://img.shields.io/pypi/v/rich-tracebacks?logo=pypi&color=green&logoColor=white&style=for-the-badge)](https://pypi.org/project/rich-tracebacks)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/celsiusnarhwal/rich-tracebacks?logo=github&color=orange&logoColor=white&style=for-the-badge)](https://github.com/celsiusnarhwal/rich-tracebacks/releases)
[![PyPI - License](https://img.shields.io/pypi/l/rich-tracebacks?color=03cb98&style=for-the-badge)](https://github.com/celsiusnarhwal/rich-tracebacks/blob/main/LICENSE)

rich-tracebacks automates the installation
of [Rich's traceback handler](https://rich.readthedocs.io/en/stable/traceback.html#traceback-handler) in Python
programs. Compared to Rich's
own [sanctioned method](https://rich.readthedocs.io/en/stable/traceback.html#automatic-traceback-handler)
of automatically installing its traceback handler, rich-tracebacks is markedly simpler and agnostic to your virtual
environment.

## Installation

```bash
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.

```bash
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.

```bash
unset RICH_TRACEBACKS
```

### Configuration

You can configure the traceback handler with
its [supported options](https://rich.readthedocs.io/en/stable/reference/traceback.html#rich.traceback.install)
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:

```python
# rt_config.py

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

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.

#### A note on the `suppress` option

Rich's traceback handler supports a `suppress` option to which you can pass an iterable of modules and paths to be
excluded from tracebacks. To suppress a module, you would normally need to import the module and then pass the
module object to the `suppress` option. For example:

```python
import loctocat
from rich.traceback import install

install(suppress=[loctocat])
```

With rich-tracebacks, you also have the option of simply passing the module's name as a string. For example:

```python
# rt_config.py

config = {
    "suppress": ["loctocat"],
    ...
}
```

rich-tracebacks will do the work of importing the module for you and passing the module object to Rich.
Names it can't import will be passed to Rich as literal strings, which will in turn treat them as paths.

## FAQ

### Q: I use PyCharm and rich-tracebacks doesn't seem to be working if my program calls `sys.excepthook` while I'm using the debugger, please help.

A: Congratulations on encountering this ridiculously niche isssue. Setting the `RICH_TRACEBACKS_PYCHARM` environment
variable in the relevant run configuration will apply a very much experimental fix for this issue. If it doesn't work,
[open an issue](https://github.com/celsiusnarhwal/rich-tracebacks/issues/new) and I will try to help you as best I can.

## License

rich-tracebacks is licensed under
the [MIT License](https://github.com/celsiusnarhwal/rich-tracebacks/blob/main/LICENSE.md).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/celsiusnarhwal/rich-tracebacks",
    "name": "rich-tracebacks",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.3,<4.0.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "celsius narhwal",
    "author_email": "hello@celsiusnarhwal.dev",
    "download_url": "https://files.pythonhosted.org/packages/33/82/fe355aa934083bdd84b6f942904359f2a55d01a498e7f2004e4044fdc4f4/rich_tracebacks-1.2.1.tar.gz",
    "platform": null,
    "description": "# rich-tracebacks\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rich-tracebacks?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/rich-tracebacks)\n[![PyPI](https://img.shields.io/pypi/v/rich-tracebacks?logo=pypi&color=green&logoColor=white&style=for-the-badge)](https://pypi.org/project/rich-tracebacks)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/celsiusnarhwal/rich-tracebacks?logo=github&color=orange&logoColor=white&style=for-the-badge)](https://github.com/celsiusnarhwal/rich-tracebacks/releases)\n[![PyPI - License](https://img.shields.io/pypi/l/rich-tracebacks?color=03cb98&style=for-the-badge)](https://github.com/celsiusnarhwal/rich-tracebacks/blob/main/LICENSE)\n\nrich-tracebacks automates the installation\nof [Rich's traceback handler](https://rich.readthedocs.io/en/stable/traceback.html#traceback-handler) in Python\nprograms. Compared to Rich's\nown [sanctioned method](https://rich.readthedocs.io/en/stable/traceback.html#automatic-traceback-handler)\nof automatically installing its traceback handler, rich-tracebacks is markedly simpler and agnostic to your virtual\nenvironment.\n\n## Installation\n\n```bash\npip install rich-tracebacks\n```\n\n## Usage\n\n### Enabling\n\nSet the `RICH_TRACEBACKS` environment variable. The value of the variable doesn't matter, but we'll use `1` as an\nexample.\n\n```bash\nexport RICH_TRACEBACKS=1\n```\n\nThat's it. Rich's traceback handler will be automatically installed each time you run your program.\n\n### Disabling\n\nUnset the `RICH_TRACEBACKS` environment variable.\n\n```bash\nunset RICH_TRACEBACKS\n```\n\n### Configuration\n\nYou can configure the traceback handler with\nits [supported options](https://rich.readthedocs.io/en/stable/reference/traceback.html#rich.traceback.install)\nby creating an `rt_config.py` file at your project's root. The file should contain a dictionary named `config`\nthat maps option names to their intended values. For example:\n\n```python\n# rt_config.py\n\nconfig = {\n    \"show_locals\": True,\n    \"width\": 120,\n    \"theme\": \"monokai\",\n    ...\n}\n```\n\nOptions that are not defined in `rt_config.py` will fall back to their default values. If `rt_config.py`\ndoes not exist, all options will fall back to their default values.\n\n#### A note on the `suppress` option\n\nRich's traceback handler supports a `suppress` option to which you can pass an iterable of modules and paths to be\nexcluded from tracebacks. To suppress a module, you would normally need to import the module and then pass the\nmodule object to the `suppress` option. For example:\n\n```python\nimport loctocat\nfrom rich.traceback import install\n\ninstall(suppress=[loctocat])\n```\n\nWith rich-tracebacks, you also have the option of simply passing the module's name as a string. For example:\n\n```python\n# rt_config.py\n\nconfig = {\n    \"suppress\": [\"loctocat\"],\n    ...\n}\n```\n\nrich-tracebacks will do the work of importing the module for you and passing the module object to Rich.\nNames it can't import will be passed to Rich as literal strings, which will in turn treat them as paths.\n\n## FAQ\n\n### Q: I use PyCharm and rich-tracebacks doesn't seem to be working if my program calls `sys.excepthook` while I'm using the debugger, please help.\n\nA: Congratulations on encountering this ridiculously niche isssue. Setting the `RICH_TRACEBACKS_PYCHARM` environment\nvariable in the relevant run configuration will apply a very much experimental fix for this issue. If it doesn't work,\n[open an issue](https://github.com/celsiusnarhwal/rich-tracebacks/issues/new) and I will try to help you as best I can.\n\n## License\n\nrich-tracebacks is licensed under\nthe [MIT License](https://github.com/celsiusnarhwal/rich-tracebacks/blob/main/LICENSE.md).\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Automatic installation of Rich's traceback handler",
    "version": "1.2.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f287ef45111078f5875ab6081caf528e9c397814797961672d80a3d886af652",
                "md5": "c6ee149f0c5cb0c5b5011f3743856a39",
                "sha256": "2bba596aa753e045c6acd26f977b14f5e6ba2e3a86d928789393c361b72c6dac"
            },
            "downloads": -1,
            "filename": "rich_tracebacks-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c6ee149f0c5cb0c5b5011f3743856a39",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.3,<4.0.0",
            "size": 4113,
            "upload_time": "2023-01-04T19:33:55",
            "upload_time_iso_8601": "2023-01-04T19:33:55.162429Z",
            "url": "https://files.pythonhosted.org/packages/7f/28/7ef45111078f5875ab6081caf528e9c397814797961672d80a3d886af652/rich_tracebacks-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3382fe355aa934083bdd84b6f942904359f2a55d01a498e7f2004e4044fdc4f4",
                "md5": "253e08f526ceca0042d535f5ee2775b4",
                "sha256": "0613d0510254d27f11c5e8148388118e001f075e77b932ccdfc8967e2e69186b"
            },
            "downloads": -1,
            "filename": "rich_tracebacks-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "253e08f526ceca0042d535f5ee2775b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.3,<4.0.0",
            "size": 3998,
            "upload_time": "2023-01-04T19:33:56",
            "upload_time_iso_8601": "2023-01-04T19:33:56.298595Z",
            "url": "https://files.pythonhosted.org/packages/33/82/fe355aa934083bdd84b6f942904359f2a55d01a498e7f2004e4044fdc4f4/rich_tracebacks-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-04 19:33:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "celsiusnarhwal",
    "github_project": "rich-tracebacks",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "rich-tracebacks"
}
        
Elapsed time: 0.02581s