-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom tracebacks #2223
Custom tracebacks #2223
Conversation
"""render traceback to a list of lines""" | ||
return (self.traceback or "No traceback available").splitlines() | ||
|
||
# Previous name retained for backwards compatibility. | ||
render_traceback = _render_traceback_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reverse this alias, because render_traceback
is a real public API (not deprecated), and _render_traceback_
is the custom IPython-specific semi-private API.
I know there's no real difference, but I think this way gives the wrong idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've done that.
I know it's technically adding a new API, but it seems like we should include this in 0.13.1 to avoid the inappropriate imports. Do you agree? |
Once we're confident it works, I think the flaw is significant enough to warrant backporting the fix, yes. |
Do we want to add a test to catch this sort of thing in the future? i.e. start a fresh subprocess IPython, and verify that 'numpy' and I don't remember what the state of our subprocess tests is. |
A subprocess test turned out to be pretty easy. I'm running test_pr now. |
Test results for commit 464d50a merged into master
Not available for testing: |
Great, then I think it should be good to go. |
I'll leave it overnight (my time) in case anyone else wants to look at it, then I'll merge tomorrow. Thanks for the review. |
|
||
Both the notebook and the Qt console can display ``svg``, ``png`` and ``jpeg`` | ||
representations. The notebook can also display ``html``, ``javascript``, | ||
``json`` and ``latex``. If the methods don't exist, or return ``None``, it falls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, is there any example of something using display_json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, and it seems it doesn't actually work in the notebook. I'll take it out of the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do have a display_json
in IPython.display
do we want to write a warning that not many frontend support it ?
I've updated the docs. |
I'm ok with merging this. About json, what is/was the use of it ? |
OK, I'll merge this now. Thanks. I'm not sure about displaying json, but I think maybe it's the future tense we need - what will be the use of it? |
Custom traceback API Closes gh-2221
hum... to exchange data with widget, maybe, but then i wouldn't call it |
Pretty much every js widget I have written uses display_json. |
Rather than special casing IPython.parallel errors (which led to issue #2221), this adds a simple API where exception classes can offer a custom traceback, by defining a `_render_traceback_(self)` method. It also adds some documentation on how third parties can integrate packages with IPython. 'Configuration & customisation' seemed the most natural home for this. We should remember to close #2221 when we merge this - I forgot to put it in a commit message.
Rather than special casing IPython.parallel errors (which led to issue #2221), this adds a simple API where exception classes can offer a custom traceback, by defining a `_render_traceback_(self)` method. It also adds some documentation on how third parties can integrate packages with IPython. 'Configuration & customisation' seemed the most natural home for this. We should remember to close #2221 when we merge this - I forgot to put it in a commit message.
* commit 'rel-0.13-33-gcfc5692': (33 commits) Backport PR ipython#2347: adjust division error message checking to account for Python 3 Backport PR ipython#2305: RemoteError._render_traceback_ calls self.render_traceback Backport PR ipython#2280: fix SSH passwordless check for OpenSSH Backport PR ipython#2270: SSHLauncher tweaks Backport PR ipython#2261: Fix: longest_substr([]) -> '' Backport PR ipython#2250: fix html in notebook example Backport PR ipython#2235: remove spurious print statement from setupbase.py fixup Backport PR ipython#2223: Custom tracebacks Backport PR ipython#2214: use KernelApp.exec_lines/files in IPEngineApp Backport PR ipython#2212: catch errors in markdown javascript Backport PR ipython#2194: clean nan/inf in json_clean Backport PR ipython#2177: remove numpy install from travis/tox scripts Backport PR ipython#2169: ipdb: pdef, pdoc, pinfo magics all broken Backport PR ipython#2186: removed references to h5py dependence in octave magic documentation Backport PR ipython#2185: added test for %store, fixed storemagic Backport PR ipython#2170: Fix tab completion with IPython.embed_kernel(). Backport PR ipython#2163: fix 'remote_profie_dir' typo in SSH launchers Backport PR ipython#2117: use explicit url in notebook example Backport PR ipython#2126: ipcluster broken with any batch (PBS/LSF/SGE) ...
Custom traceback API Closes ipythongh-2221
Rather than special casing IPython.parallel errors (which led to issue #2221), this adds a simple API where exception classes can offer a custom traceback, by defining a
_render_traceback_(self)
method.It also adds some documentation on how third parties can integrate packages with IPython. 'Configuration & customisation' seemed the most natural home for this.
We should remember to close #2221 when we merge this - I forgot to put it in a commit message.