feat: add built-in IPython traceback integration#157
Open
Question86 wants to merge 1 commit into
Open
Conversation
Open
Author
|
Follow-up on why this integration is structured this way:\n\n- Supports %load_ext better_exceptions directly via top-level load_ipython_extension, plus explicit integrations.ipython loading.\n- Keeps fallback behavior for special IPython paths (e.g. SyntaxError, �xception_only, compiled-code tracebacks) by delegating to original showtraceback.\n- Includes compatibility fallback for older IPython signatures that do not accept newer kwargs (e.g. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class IPython support so
better_exceptionsworks inside IPython shells, while preserving IPython behavior for cases that should still be handled by IPython.Changes
better_exceptions/integrations/ipython.py:install()/uninstall()(plushook()/unhook()aliases)showtracebackSyntaxErrorexception_only=Truefilename/tb_offsetpathsrunning_compiled_code=Trueshowtracebacksignatures that do not accept extra kwargs.better_exceptions.hook()to auto-install the IPython adapter when running under IPython.load_ipython_extension()andunload_ipython_extension()so%load_ext better_exceptionsworks directly.README.mdwith%load_extand programmatic usage.test/test_ipython.pycovering:Validation
python -m py_compile better_exceptions/__init__.py better_exceptions/integrations/ipython.py test/test_ipython.pyPYTHONPATH=. python test/test_ipython.pyPYTHONPATH=. python test/test_logging.pyCloses #10