Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
49.69k stars 1.73k forks source link

[REQUEST] logging exceptions: highlight paths to my code #3492

Closed mustafa0x closed 3 weeks ago

mustafa0x commented 2 months ago

In exceptions, can rich automatically highlight paths of my code, to be able to distinguish from code in the virtualenv or external packages. For example, in the following exception, the middle path should be highlighted.

/Users/mustafa/Library/Caches/pypoetry/virtualenvs/foobar-Ra8Pwy-F-py3.12/lib/python3.12/site-packages/ninja/main.py:515
/Users/mustafa/dev/project/api.py:38
/Users/mustafa/Library/Caches/pypoetry/virtualenvs/foobar-Ra8Pwy-F-py3.12/lib/python3.12/site-packages/ninja/operation.py:121

Benefits

edit: claude suggested using excepthook. not sure if the solution makes sense.

github-actions[bot] commented 2 months ago

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

willmcgugan commented 3 weeks ago

You can exclude known libraries from tracebacks.

github-actions[bot] commented 3 weeks ago

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

mustafa0x commented 3 weeks ago

I want to exclude (or more accurately, de-emphaszie) everything in the venv.

Like vscode has a justMyCode configuration option.