unstale

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 init

@unstale/cli 0.2.6 on npm

pyinstrument 515 changes

New APIs and options 6

  • Can now run preprocessors on the input to manipulate the call tree before writing to HTML.

    5.1.2release notes

  • Sets the interval for the Django middleware.

    5.1.2release notes

  • Adds a CLI option to customize the description.

    5.1.2release notes

  • View options can now be changed inside the webpage instead of being passed at the command line.

    5.0.0upgrade guide

  • Calls to profiler.start() can pass a target_description parameter, which is displayed in the profile readout.

    5.0.0upgrade guiderelease notes

  • HTML reports now include a purpose-built timeline visualization alongside the existing call stack view.

    5.0.0upgrade guiderelease notes

Behavior and default changes 3

  • The Call stack view now supports arrow key navigation.

    5.0.0upgrade guiderelease notes

  • HTML mode options are interactive instead of needing to be set upfront.

    5.0.0release notes

  • Library code is now detected using captured Python install and active virtualenv/conda paths rather than the /lib/ path substring, reducing false positives.

    5.0.0upgrade guiderelease notes

Tooling 1

  • Context-manager type annotations let type checkers infer that profile is a Profiler in with Profiler() as profile: blocks.

    5.1.3release notes

Fixes and other changes 5

  • Long program and command names now wrap cleanly instead of overflowing the header in HTML reports.

    5.1.3release notes

  • Jupyter text output now correctly applies console-specific render options, including time=percent_of_total, flat, short_mode, color, and Unicode settings.

    5.1.3release notes

  • Django middleware now respects PYINSTRUMENT_SHOW_CALLBACK when PYINSTRUMENT_PROFILE_DIR is configured, allowing profiles to be selectively written to disk.

    5.1.3release notes

  • Fixes errors caused by mismatched starts and stops.

    5.1.2release notes

  • Limits the sample count so the browser can load the sample.

    5.1.2release notes