# What changed in pyinstrument

> 15 changes in pyinstrument 5 from its official release notes, upgrade guides and advisories: 6 new APIs and options. Each one cited. Sources checked 2026-10-25. HTML: https://unstale.sh/pypi/pyinstrument/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## pyinstrument 5

### New APIs and options

- Can now run preprocessors on the input to manipulate the call tree before writing to HTML. (5.1.2) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.2)
- Sets the interval for the Django middleware. (5.1.2) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.2)
- Adds a CLI option to customize the description. (5.1.2) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.2)
- View options can now be changed inside the webpage instead of being passed at the command line. (5.0.0) — [upgrade guide](https://joerick.me/posts/2024/10/3/pyinstrument-5/)
- Calls to `profiler.start()` can pass a `target_description` parameter, which is displayed in the profile readout. (5.0.0) — [upgrade guide](https://joerick.me/posts/2024/10/3/pyinstrument-5/), [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.0.0)
- HTML reports now include a purpose-built timeline visualization alongside the existing call stack view. (5.0.0) — [upgrade guide](https://joerick.me/posts/2024/10/3/pyinstrument-5/), [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.0.0)

### Behavior and default changes

- The Call stack view now supports arrow key navigation. (5.0.0) — [upgrade guide](https://joerick.me/posts/2024/10/3/pyinstrument-5/), [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.0.0)
- HTML mode options are interactive instead of needing to be set upfront. (5.0.0) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.0.0)
- 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.0) — [upgrade guide](https://joerick.me/posts/2024/10/3/pyinstrument-5/), [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.0.0)

### Tooling

- Context-manager type annotations let type checkers infer that profile is a Profiler in with Profiler() as profile: blocks. (5.1.3) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.3)

### Fixes and other changes

- Long program and command names now wrap cleanly instead of overflowing the header in HTML reports. (5.1.3) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.3)
- Jupyter text output now correctly applies console-specific render options, including time=percent_of_total, flat, short_mode, color, and Unicode settings. (5.1.3) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.3)
- Django middleware now respects PYINSTRUMENT_SHOW_CALLBACK when PYINSTRUMENT_PROFILE_DIR is configured, allowing profiles to be selectively written to disk. (5.1.3) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.3)
- Fixes errors caused by mismatched starts and stops. (5.1.2) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.2)
- Limits the sample count so the browser can load the sample. (5.1.2) — [release notes](https://github.com/joerick/pyinstrument/releases/tag/v5.1.2)
