Repository navigation
fix(magic): use ConsoleRenderer for text config instead of HTMLRenderer - #446
Merged
joerick merged 4 commits intoJul 29, 2026
Merged
Conversation
The Jupyter magic called compute_render_options with HTMLRenderer for both the HTML and text renderer configs. The text config should use ConsoleRenderer so that renderer-specific options (unicode, color) are properly set. This fixes --render-option=time=percent_of_total and other ConsoleRenderer-specific options being silently ignored in the text output of %%pyinstrument. Fixes joerick#419
joerick
approved these changes
Jul 29, 2026
Owner
|
thanks! |
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
The Jupyter
%%pyinstrumentmagic callscompute_render_optionstwice — once for the HTML renderer config and once for the text renderer config. Both calls were passingrenderer_class=HTMLRenderer, which means renderer-specific options forConsoleRenderer(likeunicode,color, andtime) were never set in the text config.This caused
--render-option=time=percent_of_total(and otherConsoleRenderer-specific options) to be silently ignored in the text output.Fix
Changed the second call to use
renderer_class=ConsoleRendererso that:unicodeandcolorare properly set in the text config (they were previously being hardcoded toTrueat line 196–197, which masked the bug for those specific options)timeand otherConsoleRenderer-specific constructor kwargs (likeflat,flat_time,short_mode) are now correctly parsed from--render-optionflagsprocessor_options(hide/show regex) are properly passed to the text rendererTesting
--render-option=time=percent_of_totalnow correctly shows percentages in the text output--hide,--show,--show-allcontinue to work for both HTML and text output--unicode,--colorflags continue to work for both renderersFixes #419