ipython / ipython

Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.

Home Page:https://ipython.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could it be worthy to make `VerboseTB._tb_highlight_style` a public attribute?

dalthviz opened this issue · comments

Hi! Over QtConsole we are doing some work to use the changes done at #14138 to customize traceback syntax highlighting (see jupyter/qtconsole#608).

Following jupyter/qtconsole#608 (comment) and jupyter/qtconsole#608 (comment), wanted to check if making VerboseTB._tb_highlight_style a public attribute makes sense/could be possible.

Also, are there any plans related with changing the traceback syntax highlighting logic in the future? Any in info is greatly appreciated!

I think I would be ok to make it public, but in general it would be good to rethink some of the ultratb code, it could take the style as a configuration option in the constructor, and could use a lot of new CPython new features like actually use annotations, and also implement the "did you mean" when there are typoes.

In general it is also emitting directly ascii code; in a perfect world I'd like to return more structered data at at least a number of token, style pairs so that rendering could be better handled on a per-frontend basis.

Even in html we could make use of hover to see variable values; or collapse frames.

But all that needs time, and I barely have a few hours a month on IPython, so no no short term plan to change.

If you send a PR that make this value public (with I guess a property to warn of deprecation of the private attribute I'm happy to merge.