pypi / pyinstrument
pyinstrument
What changed in pyinstrument 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-25.
6 new APIs and options3 behavior and defaults1 tooling5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpyinstrument 515 changes
New APIs and options 6
Can now run preprocessors on the input to manipulate the call tree before writing to HTML.
Sets the interval for the Django middleware.
Adds a CLI option to customize the description.
View options can now be changed inside the webpage instead of being passed at the command line.
Calls to
profiler.start()can pass atarget_descriptionparameter, which is displayed in the profile readout.HTML reports now include a purpose-built timeline visualization alongside the existing call stack view.
Behavior and default changes 3
The Call stack view now supports arrow key navigation.
HTML mode options are interactive instead of needing to be set upfront.
Library code is now detected using captured Python install and active virtualenv/conda paths rather than the
/lib/path substring, reducing false positives.
Tooling 1
Context-manager type annotations let type checkers infer that profile is a Profiler in with Profiler() as profile: blocks.
Fixes and other changes 5
Long program and command names now wrap cleanly instead of overflowing the header in HTML reports.
Jupyter text output now correctly applies console-specific render options, including time=percent_of_total, flat, short_mode, color, and Unicode settings.
Django middleware now respects PYINSTRUMENT_SHOW_CALLBACK when PYINSTRUMENT_PROFILE_DIR is configured, allowing profiles to be selectively written to disk.
Fixes errors caused by mismatched starts and stops.
Limits the sample count so the browser can load the sample.