Add support for IPython #126
Comments
Great ! Thanks; if you ever get to it I would be ok to have friendly TB be automatically enabled in IPython if installed. |
@Carreau I just released a new version (0.2.0) of Friendly-traceback with experimental support for IPython. It's not ideal, but it is a first step. I took three screenshots to illustrate the project status. First, an example using Friendly-traceback's own console, running on Windows with the new Windows terminal and using Rich (https://github.com/willmcgugan/rich) Above, I used Next, showing how to enable Friendly-traceback within IPython, running the exact same example as above, but without any syntax colouring. Finally, using Rich to provide colours, I display the same result as before. The result is clearly not satisfying. I'm using my own styles instead of Rich's default which might be why this happens. So, it is ready for experimentation, but more work is needed before it could be considered for serious work. = = = |
I just noticed that |
Take note of the overlap:
|
I know that IPython uses stack_data. I spent a few hours trying to use it as a replacement for the formatter I wrote, as I like how it works with "pieces" instead of lines. However, I could not get it to work reliably both in the console and when running an external file; it was also giving some problems when dealing with SyntaxErrors. One problem I have is that I remove from the stack frames that belong to friendly_traceback modules and some Python modules. I also do this now for embedding with IPython; other users (such as hackinscience) do that as well. |
This logic may predate me joining the project, so I would have to dig into it to figure this out; I'd also love to have a way to render traceback to HTML without having to go through the ansi escape code. |
After doing some relatively minor changes, I've added a section to the documentation about using Friendly-traceback with IPython, either in console environments or in notebook environments. The documentation can be found here: https://aroberge.github.io/friendly-traceback-docs/docs/html/ipython.html Closing this issue as I consider the original goal accomplished. |
After the backlog issue is taken care of, I should look at seeing how to integrate with IPython.
The text was updated successfully, but these errors were encountered: