Skip to content

Conversation

@pyup-bot
Copy link
Collaborator

@pyup-bot pyup-bot commented Jan 4, 2026

This PR updates pyinstrument from 3.2.0 to 5.1.2.

Changelog

5.1.2

-   Adds the ability to customize description using CLI option `--target-description` (408)
-   You can set the interval for the Django middleware using the PYINSTRUMENT_INTERVAL option (416)
-   HTMLRenderer can now run preprocessors on the input, to manipulate the call tree before writing to HTML (403)
-   Fix a bug where mismatched start/stops can produce "call stack without an active session" errors (406)
-   Limit sample count for the HTML renderer to ensure the browser can load the sample (407)

5.1.1

-   Fix some memory leaks in the low-level C extension (394)

5.1.0

-   Precision of printed durations now adapts to the interval of the profile. This allows you to see more detail when the interval, and hides unnecessary detail when the interval is large. (390)
-   Adds an option to the Django middleware to customise the filename of saved profile runs using a callback (393)
-   Adds an aiohttp.web example to the documentation (389)

5.0.2

-   Fix a bug that caused jupyter notebooks to continue to run after a profiled cell was interrupted with Ctrl-C (373)
-   Fix a type annotation issue when using mypy and import pyinstrument (373)

5.0.1

-   Adds a Django option to customise the filename of saved profile runs (339)
-   Improve the FastAPI integration docs (355)
-   Include more options in the IPython magic (350)

5.0.0

Loads of improvements to the HTML renderer!

-   Timeline mode - see and zoom into an interactive linear timeline!

 ![timeline mode](https://github.com/user-attachments/assets/4d234f10-da4e-4bcd-aee1-922999bcf804)
-   HTML mode now has interactive options, rather than needing to set the upfront.
-   Streamlined the design of the HTML page header.
-   HTML Call stack view supports arrow key navigation.
-   The way ‘library’ code is detected has been changed. Previously, if the string ‘/lib/’ occurred in the file path, that was considered library code (and collapsed by default). Now, pyinstrument captures the paths of the Python install and any active virtualenv/conda env at profile time. Files that are stored there are considered library. That should give fewer false positives.
-   Calls to profiler.start() can now pass a target_description parameter, which is displayed in the profile readout.

Check my [blog post](https://joerick.me/posts/2024/10/3/pyinstrument-5/) for more info on the new features.

4.7.3

-   Fix a bug introduced in 4.7.0 which would cause the profiler to crash when profiling code with unusual locals, notably some pytest extensions (332)
-   Fix a bug that causes pyinstrument to fail to import packages like `glom` on Python 3.12 or later, which mutate the locals() dict. (336)
-   Fix a bug that caused a `UnicodeDecodeError` on some platforms (330)
-   Fix a DivideByZero error that occurs in some situations (335)
-   The IPython integration takes greater step to ensure a clean profile output, by ensuring internal frames are trimmed before printing. (321)

4.7.2

-   Add CPython 3.13 wheels
-   Fix a bug that caused the HTML output to fail to render in some browser contexts (328)

4.7.0

-   Adds a new, convenient API for [profiling chunks of Python code](https://pyinstrument.readthedocs.io/en/latest/guide.html#profile-a-specific-chunk-of-code)! You can now profile simply using a `with` block, or a function/method decorator. This will profile the code and print a short readout into the terminal. (327)
-   Adds new, lower overhead timing options. Pyinstrument calls timers on every Python function call, which is fine on systems with fast timing available, but it adds significant overhead on systems that require a syscall for each, such as some Docker environments. Pyinstrument will now detect slow timers present a warning with two choices. You can enable a 'timing thread', which offloads the timing workload from the profiled thread, or, if you're happy with lower resolution, you can opt to use a 'coarse' timer, which is provided on some Linux systems. (273)
-   Alt-click rows in the HTML output to collapse/expand the whole tree (325)
-   Adds a `flat` argument to the console output, to present a flat list of functions (294)
-   Adds a Litestar example config and docs (284)
-   Preliminary Python 3.13 support (322)

4.6.0

-   Adds a feature `-c`, which allows profiling code directly from the command line, like `python -c`. (271)
-   Adds a convenience method [`Profiler.write_html`](https://pyinstrument.readthedocs.io/en/latest/reference.html#pyinstrument.Profiler.write_html), for writing HTML output to a file directly. (266)

4.5.3

- Fix a problem in the packaging process that prevented upload to PyPI

4.5.2

-   Show the program name in the header of the HTML output (260)
-   Improve program name capture through resilience to other programs modifying sys.argv (258)
-   Add support for Python 3.12 (246)

4.5.1

-   Fix a bug that caused `[X frames hidden]` in the output when frames were deleted due to `__tracebackhide__` (255)
-   Fix a bug causing built-in code to display the filepath `None` in the console output (254)
-   Some docs improvements (251)

4.5.0

-   Adds a flat mode to the console renderer, which can be enabled by passing `-p flat` on the command line. This mode shows the heaviest frame as measured by self-time, which can be useful in some codebases. (240)
-   Adds the ability to save `pstats` files. This is the file format used by cprofile in the stdlib. It's less detailed than pyinstrument profiles, but it's compatible with more tools. (236)
-   Fixes a detail of the `--show-all` option - pyinstrument will no longer remove Python-internal frames when this option is supplied. (239)
-   Internally to the HTML renderer, it now uses Svelte to render the frontend, meaning profile HTML files bundle less javascript and so are smaller. (222)
Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants