NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #2938 most downloaded on PyPI
Line-by-line profiler
Latest stable
5.1.0
Last release 1 months ago
18 Oct 2026
Ships fairly regularly
a new release about every 6 months
Nearly every release is documented
notes for 29 of 32 stable releases
1 version withdrawn
withdrawn after publishing
18 years old
36 releases · first in 2009
Drag across the ruler to compare, or tap a release to open it.
Automatic Release Notes. TODO: improve
Automatic Release Notes. TODO: improve
kernprof to always run code in sys.modules['__main__']'s namespace by @TTsangSC in https://github.com/pyutils/line_profiler/pull/423ScopingPolicy members by @TTsangSC in https://github.com/pyutils/line_profiler/pull/427sys.modules after running kernprof.main by @TTsangSC in https://github.com/pyutils/line_profiler/pull/437Full Changelog: https://github.com/pyutils/line_profiler/compare/v5.0.2...v5.1.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Automatic Release Notes. TODO: improve
kernprof to always run code in sys.modules['__main__']'s namespace by @TTsangSC in #423ScopingPolicy members by @TTsangSC in #427sys.modules after running kernprof.main by @TTsangSC in #437Full Changelog: v5.0.2...v5.1.0
Type fix base by @Erotemic in #419
Full Changelog: https://github.com/pyutils/line_profiler/compare/v5.0.1...refs/heads/release
FIX: DeprecationWarning emitted by how line_profiler.toml_config uses importlib.resources by @TTsangSC in https://github.com/pyutils/line_profiler/pul…
Mostly bug fixes, 3.14 support, and minor UX tweaks.
ConfigSource doc by @TTsangSC in https://github.com/pyutils/line_profiler/pull/367LineStats aggregation by @TTsangSC in https://github.com/pyutils/line_profiler/pull/380kernprof -m by @TTsangSC in https://github.com/pyutils/line_profiler/pull/389tests/test_cli.py by @TTsangSC in https://github.com/pyutils/line_profiler/pull/401DeprecationWarning emitted by how line_profiler.toml_config uses importlib.resources by @TTsangSC in https://github.com/pyutils/line_profiler/pull/406Full Changelog: https://github.com/pyutils/line_profiler/compare/v5.0.0...refs/heads/release
Mostly bug fixes, 3.14 support, and minor UX tweaks.
ConfigSource doc by @TTsangSC in #367LineStats aggregation by @TTsangSC in #380kernprof -m by @TTsangSC in #389tests/test_cli.py by @TTsangSC in #401DeprecationWarning emitted by how line_profiler.toml_config uses importlib.resources by @TTsangSC in #406Full Changelog: v5.0.0...refs/heads/release
FIX: Prevented duplicate or inconsistent profiler output under Python 3.14 when multiprocessing is used.
ENH: Add %%lprun_all for more beginner-friendly profiling in IPython/Jupyter #383
FIX: mitigate speed regressions introduced in 5.0.0
ENH: Added capability to combine profiling data both programmatically (LineStats.__add__()) and via the CLI (python -m line_profiler) (#380, originally proposed in #219)
FIX: search function in online documentation
FIX: ref-count leaks #372
FIX: mitigate speed regressions introduced in 5.0.0 #376
FIX: Use import system to locate module file run by kernprof -m #389
FIX: Fixed build on Windows-ARM64 and now building wheels therefor in CI #391
FIX: Move away from older, (temporarily-)deprecated importlib.resources APIs in line_profiler.toml_config #406
CHANGE: remove default alphabetical sorting of profiled functions
FIX: Restored building and testing of Linux-ARM64 wheels #402
This is a major update to the line-profiler package. All APIs should still be backwards compatible with the 4.x branch, but we decided to bump the the
This is a major update to the line-profiler package. All APIs should still be backwards compatible with the 4.x branch, but we decided to bump the the new major version 5.x due to the number of new features and changes in the underlying C code. We do plan to introduce changes in defaults in the next 6.x release in an effort to streamline usage.
Big thanks to @TTsangSC who put an enormous amount of work into this :pray: .
[tool.line_profiler] in pyproject.toml. See docs for an example.-p <modname> or prof-mod in config to profile top-level callables-m, inline scripts with -c, and profile from stdin with -sys.monitoring on Python 3.12+ (with fallback support)functools.partialFIX: win32 encoding issues
ENH: Add support for sys.monitoring (Python >= 3.12)
FIX: Fixed issue when calling kernprof with neither the -l nor -b flag; also refactored common methods to LineProfiler and ContextualProfile
FIX: Fixed auto-profiling of async function definitions #330
ENH: Added CLI argument -m to kernprof for running a library module as a script; also made it possible for profiling targets to be supplied across multiple -p flags
FIX: Fixed explicit profiling of class methods; added handling for profiling static, bound, and partial methods, functools.partial objects, (cached) properties, and async generator functions
FIX: Fixed namespace bug when running kernprof -m on certain modules (e.g. calendar on Python 3.12+).
FIX: Fixed @contextlib.contextmanager bug where the cleanup code (e.g. restoration of sys attributes) is not run if exceptions occurred inside the context
ENH: Added CLI arguments -c to kernprof for (auto-)profiling module/package/inline-script execution instead of that of script files; passing '-' as the script-file name now also reads from and profiles stdin
ENH: In Python >=3.11, profiled objects are reported using their qualified name.
ENH: Highlight final summary using rich if enabled
ENH: Made it possible to use multiple profiler instances simultaneously
ENH: various improvements related to auto-profiling:
kernprof -p target entities are now imported and profiled regardless of
whether they are directly imported in the run script/module/code (old
behavior restored by passing --no-preimports)kernprof -v and the new -q now control the verbosity level instead
of being a boolean, allowing diagnostic outputs or output suppressionLineProfiler can now be used as a class decoratorFIX: Fixed line tracing for Cython code; superseded use of the legacy tracing system with sys.monitoring
FIX: Fixed edge cases where:
LineProfiler.get_stats() neglected data from duplicate code objects
(#348)LineProfiler instances may stop receiving tracing events when multiple
instances were used (#350)raise statements and finally:
bodies when using sys.monitoring (#355)FIX: Tracing-system-related fixes (#333):
LineProfiler now caches the existing sys or sys.monitoring trace
callbacks in .enable() and restores them in .disable(), instead of
always discarding them on the way outENH: Added capability to parse TOML config files for defaults (#335):
kernprof and python -m line_profiler CLI optionsGlobalProfiler configurations, andLineProfiler.print_stats()) formattingsys.monitoring compliance by @TTsangSC in https://github.com/pyutils/line_profiler/pull/327kernprof erroring out in non--l, non--b mode in Python 3.12+ by @TTsangSC in https://github.com/pyutils/line_profiler/pull/326async def by @TTsangSC in https://github.com/pyutils/line_profiler/pull/331LineProfiler.__call__() by @TTsangSC in https://github.com/pyutils/line_profiler/pull/332kernprof -m: presence of the executed module as sys.modules['__main__'] by @TTsangSC in https://github.com/pyutils/line_profiler/pull/339@contextlib.contextmanager by @TTsangSC in https://github.com/pyutils/line_profiler/pull/340stdin or literal snippets by @TTsangSC in https://github.com/pyutils/line_profiler/pull/338sys.monitoring by @TTsangSC in https://github.com/pyutils/line_profiler/pull/352LineProfiler.last_time always empty (and sometimes errors out) by @TTsangSC in https://github.com/pyutils/line_profiler/pull/344raise statements and finally: ... bodies in Python 3.12+ by @TTsangSC in https://github.com/pyutils/line_profiler/pull/356Full Changelog: https://github.com/pyutils/line_profiler/compare/v4.2.0...refs/heads/release
This is a major update to the line-profiler package. All APIs should still be backwards compatible with the 4.x branch, but we decided to bump the the new major version 5.x due to the number of new features and changes in the underlying C code. We do plan to introduce changes in defaults in the next 6.x release in an effort to streamline usage.
Big thanks to @TTsangSC who put an enormous amount of work into this 🙏 .
[tool.line_profiler] in pyproject.toml. See docs for an example.-p <modname> or prof-mod in config to profile top-level callables-m, inline scripts with -c, and profile from stdin with -sys.monitoring on Python 3.12+ (with fallback support)functools.partialFIX: win32 encoding issues
ENH: Add support for sys.monitoring (Python >= 3.12)
FIX: Fixed issue when calling kernprof with neither the -l nor -b flag; also refactored common methods to LineProfiler and ContextualProfile
FIX: Fixed auto-profiling of async function definitions #330
ENH: Added CLI argument -m to kernprof for running a library module as a script; also made it possible for profiling targets to be supplied across multiple -p flags
FIX: Fixed explicit profiling of class methods; added handling for profiling static, bound, and partial methods, functools.partial objects, (cached) properties, and async generator functions
FIX: Fixed namespace bug when running kernprof -m on certain modules (e.g. calendar on Python 3.12+).
FIX: Fixed @contextlib.contextmanager bug where the cleanup code (e.g. restoration of sys attributes) is not run if exceptions occurred inside the context
ENH: Added CLI arguments -c to kernprof for (auto-)profiling module/package/inline-script execution instead of that of script files; passing '-' as the script-file name now also reads from and profiles stdin
ENH: In Python >=3.11, profiled objects are reported using their qualified name.
ENH: Highlight final summary using rich if enabled
ENH: Made it possible to use multiple profiler instances simultaneously
ENH: various improvements related to auto-profiling:
kernprof -p target entities are now imported and profiled regardless of--no-preimports)kernprof -v and the new -q now control the verbosity level insteadLineProfiler can now be used as a class decoratorFIX: Fixed line tracing for Cython code; superseded use of the legacy tracing system with sys.monitoring
FIX: Fixed edge cases where:
FIX: Tracing-system-related fixes (#333):
LineProfiler now caches the existing sys or sys.monitoring trace.enable() and restores them in .disable(), instead ofENH: Added capability to parse TOML config files for defaults (#335):
kernprof and python -m line_profiler CLI optionsGlobalProfiler configurations, andLineProfiler.print_stats()) formattingsys.monitoring compliance by @TTsangSC in #327kernprof erroring out in non--l, non--b mode in Python 3.12+ by @TTsangSC in #326async def by @TTsangSC in #331LineProfiler.__call__() by @TTsangSC in #332kernprof -m: presence of the executed module as sys.modules['__main__'] by @TTsangSC in #339@contextlib.contextmanager by @TTsangSC in #340stdin or literal snippets by @TTsangSC in #338sys.monitoring by @TTsangSC in #352LineProfiler.last_time always empty (and sometimes errors out) by @TTsangSC in #344raise statements and finally: ... bodies in Python 3.12+ by @TTsangSC in #356Full Changelog: v4.2.0...refs/heads/release
Added support for annotated assignments in the static parser by @TTsangSC in https://github.com/pyutils/line_profiler/pull/280
Automatic Release Notes.
Full Changelog: https://github.com/pyutils/line_profiler/compare/v4.1.3...refs/heads/release
Automatic Release Notes.
Full Changelog: v4.1.3...refs/heads/release
FIX: Fix issue with auto-profile of editable installs #279
FIX: Lookup OP-codes instead of hard coding them #284
CHANGE: Drop support for Python 3.6 and Python 3.7
ENH: Add support for Python 3.13
FIX: duration summary now respects the stripzeros argument.
Full Changelog: https://github.com/pyutils/line_profiler/compare/v4.1.2...refs/heads/release
Full Changelog: v4.1.2...refs/heads/release
ENH: Add support for Python 3.12 #246
FIX: get_stats is no longer slowed down when profiling many code sections #236
4.1.1
* FIX: ``get_stats`` is no longer slowed down when profiling many code sections #236
Thanks @klauer
This new version contains big quality of life improvements.
This new version contains big quality of life improvements.
Documentation: We now have readthedocs documentation that covers usage tutorials and the API.
Explicit Decorator: There is now a global profile decorator. In your code import line_profiler and decorate functions with @line_profiler.profile. Your code runs as normal by default. Setting the environment variable LINE_PROFILE=1 will enable profiling. For details see the docs.
Auto-Profiling: Users can now run kernprof with -p <modname> to profile all functions in a module without explicitly decorating them. For details see the docs.
show_text now increases column sizes or switches to scientific notation to maintain alignmentshow_text now has new options: sort and summarize-srm to line_profiler to control sorting, rich printing, and summary printing.profile function that can be enabled by --profile or LINE_PROFILE=1.kernprof that will profile all functions in specified modules.Thanks to @Erotemic @ta946 @Theelx @notEVIL
FIX: Stop requiring bleeding-edge Cython unless necesasry (for Python 3.12). #206
4.0.3
* FIX: Stop requiring bleeding-edge Cython unless necesasry (for Python 3.12). #206
FIX: AttributeError on certain methods. #191
FIX: Profiling classmethods works again. #183
ENH: Python 3.11 is now supported.
-i <# of seconds> option to the kernprof script. This uses the threading module to output profiling data to the output file every n seconds, and is useful for long-running tasks that shouldn't be stopped in the middle of processing.Thanks to @Theelx and others for all of their hard work on this!
FIX: #19 line profiler now works on async functions again
3.5.1
* FIX: #19 line profiler now works on async functions again
FIX: #109 kernprof fails to write to stdout if stdout was replaced
Thanks to @Nodd @yarula @ctw
Drop support for Python <= 3.5.x
There was a minor issue in the CI release process. Wheels were produced correctly on the CI, but the upload to pypi step expected them to be in the wheelhouse (not dist) directory. So most wheels were uploaded manually a few hours after the main release. This should be fixed for future releases.
FIX: Fix bug where lines were not displayed in Jupyter>=6.0 via #93
FIX: Fix bug where lines were not displayed in Jupyter>=6.0 via #93
CHANGE: moving forward, new pypi releases will be signed with the GPG key 2A290272C174D28EA9CA48E9D7224DAF0347B114 for PyUtils-CI openpyutils@gmail.com. For reference, older versions were signed with either 262A1DF005BE5D2D5210237C85CD61514641325F or 1636DAF294BA22B89DBB354374F166CFA2F39C18.
* New CI for building wheels.
New CI for building wheels.
FIX: Update MANIFEST.in to package pyproj.toml and missing pyx file
FIX: Update MANIFEST.in to package pyproj.toml and missing pyx file
CHANGE: Removed version experimental augmentation.
FIX: Update MANIFEST.in to package nested c source files in the sdist
FIX: Update MANIFEST.in to package nested c source files in the sdist
FIX: Update MANIFEST.in to package nested CMakeLists.txt in the sdist
FIX: Update MANIFEST.in to package nested CMakeLists.txt in the sdist
The sdist now contains CMakeLists.txt Fixed an error with 3.5 support
Fixes minor issues.
The sdist now contains CMakeLists.txt Fixed an error with 3.5 support
FIX: Use ImportError instead of ModuleNotFoundError while 3.5 is being supported
FIX: Add MANIFEST.in to package CMakeLists.txt in the sdist
ENH: Added better error message when c-extension is not compiled.
ENH: Added better error message when c-extension is not compiled.
FIX: Kernprof no longer imports line_profiler to avoid side effects.
Nothing published for this version
Dropped 2.7 support, manylinux docker images no longer support 2.7
Dropped 2.7 support, manylinux docker images no longer support 2.7
ENH: Add command line option to specify time unit and skip displaying functions which have not been profiled.
ENH: Unified versions of line_profiler and kernprof: kernprof version is now identical to line_profiler version.
* ENH: fix Python 3.9
ENH: fix Python 3.9
BUG: fix __version__ attribute in Python 2 CLI.
BUG: fix __version__ attribute in Python 2 CLI.
BUG: fix calling the package from the command line
BUG: fix calling the package from the command line
* ENH: Fix Python 3.7 * ENH: Restructure into package
ENH: Fix Python 3.7
ENH: Restructure into package
Nothing published for this version
Nothing published for this version
BUG: Added support for IPython 5.0+, removed support for IPython <=0.12
BUG: Added support for IPython 5.0+, removed support for IPython <=0.12
ENH: kernprof.py is now installed as kernprof.
ENH: kernprof.py is now installed as kernprof.
ENH: Python 3 support. Thanks to the long-suffering Mikhail Korobov for being patient.
Dropped 2.6 as it was too annoying.
ENH: The stripzeros and add_module options. Thanks to Erik Tollerud for contributing it.
ENH: Support for IPython cell blocks. Thanks to Michael Forbes for adding this feature.
ENH: Better warnings when building without Cython. Thanks to David Cournapeau for spotting this.
BUG: Update for compatibility with newer versions of Cython. Thanks to Ondrej Certik for spotting the bug.
ENH: Profile generators.
BUG: Update for compatibility with newer versions of Cython. Thanks to Ondrej Certik for spotting the bug.
BUG: Update IPython compatibility for 0.11+. Thanks to Yaroslav Halchenko and others for providing the updated imports.
BUG: fixed line timing overflow on Windows.
BUG: fixed line timing overflow on Windows.
DOC: improved the README.
* Initial release.
Initial release.
One column per quarter.