Skip to content

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jul 28, 2025

Bumps line-profiler from 4.2.0 to 5.0.0.

Release notes

Sourced from line-profiler's releases.

Version 0.5.0

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 🙏 .

Highlights

  • New TOML configuration files: control defaults via [tool.line_profiler] in pyproject.toml. See docs for an example.
  • Much better auto-profiling: use -p <modname> or prof-mod in config to profile top-level callables
  • New CLI modes: run modules with -m, inline scripts with -c, and profile from stdin with -
  • Switched to sys.monitoring on Python 3.12+ (with fallback support)
  • Improved support for profiling class methods, properties, async generators, and functools.partial
  • Output now shows qualified names (Python ≥ 3.11)
  • Multiple profiler instances can now be used at the same time
  • Many other fixes and improvements

CHANGELOG

  • FIX: 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 suppression
    • On-import profiling is now more aggressive so that it doesn't miss entities like class methods and properties
    • LineProfiler can now be used as a class decorator
  • FIX: 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)
    • Line events were not reported for raise statements and finally: bodies when using sys.monitoring (#355)
  • FIX: Tracing-system-related fixes (#333):

... (truncated)

Changelog

Sourced from line-profiler's changelog.

5.0.0

* FIX: 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](https://github.com/pyutils/line_profiler/issues/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 suppression

  • On-import profiling is now more aggressive so that it doesn't miss entities like class methods and properties

  • LineProfiler can now be used as a class decorator

  • FIX: 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)
    • Line events were not reported for 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 out
    • Also added experimental support for calling (instead of suspending) said callbacks during profiling
    • Now allowing switching back to the "legacy" trace system on Python 3.12+, controlled by an environment variable
  • ENH: Added capability to parse TOML config files for defaults (#335):

    • kernprof and python -m line_profiler CLI options
    • GlobalProfiler configurations, and
    • profiler output (e.g. LineProfiler.print_stats()) formatting
Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [line-profiler](https://github.com/pyutils/line_profiler) from 4.2.0 to 5.0.0.
- [Release notes](https://github.com/pyutils/line_profiler/releases)
- [Changelog](https://github.com/pyutils/line_profiler/blob/main/CHANGELOG.rst)
- [Commits](pyutils/line_profiler@v4.2.0...v5.0.0)

---
updated-dependencies:
- dependency-name: line-profiler
  dependency-version: 5.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update python code labels Jul 28, 2025
@meta-cla meta-cla bot added the cla signed label Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed dependencies Pull requests that update a dependency file python Pull requests that update python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants