unstale

pypi / line-profiler

line-profiler

What changed in line-profiler 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.

4 breaking10 new APIs and options2 performance6 behavior and defaults17 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.3.1 on npm

line-profiler 535 changes

Breaking changes 3

  • Text output no longer defaults to alphabetical ordering of profiled functions.

    5.0.1release notes

  • Controls verbosity level, allowing diagnostic outputs or output suppression.

    5.0.0release notes

  • Controls verbosity level rather than acting as a boolean.

    5.0.0release notes

New APIs and options 9

  • LineStats aggregation is added, allowing line statistics to be aggregated.

    5.0.1release notes

  • Adds an IPython magic function for profiling with %%lprun_all.

    5.0.1release notes

  • Run and profile module, package, or inline-script execution instead of a script file.

    5.0.0release notes

  • Can now be used as a class decorator.

    5.0.0release notes

  • Run and profile a library module as a script.

    5.0.0release notes

  • Restore the previous behavior where -p targets are not imported and profiled unless directly imported by the run target.

    5.0.0release notes

  • A [tool.line_profiler.kernprof] section can set kernprof defaults, including line-by-line, rich, verbose, skip-zero, and prof-mod.

    5.0.0upgrade guide

  • Configure defaults for CLI options, GlobalProfiler, and profiler output formatting in pyproject.toml.

    5.0.0release notes

  • Specify modules or dotted function names to profile automatically, without requiring the @profile decorator.

    5.0.0upgrade guiderelease notes

Performance 1

  • Worst-case overhead is reduced, improving performance when profiling.

    5.0.1release notes

Behavior and default changes 6

  • Using '-' as the script-file name reads from and profiles stdin.

    5.0.0release notes

  • Multiple profiler instances can be used simultaneously.

    5.0.0release notes

  • Auto-profile top-level callables from imported targets; targets can be supplied across multiple -p flags.

    5.0.0release notes

  • On Python 3.11 and later, profiled objects are reported using their qualified names.

    5.0.0release notes

  • LineProfiler caches existing sys or sys.monitoring trace callbacks when enabled and restores them when disabled, rather than discarding them.

    5.0.0release notes

  • Profiling uses sys.monitoring on Python 3.12 and later, with fallback support; the legacy trace system can also be selected through an environment variable.

    5.0.0release notes

Fixes and other changes 16

  • Decorating a function no longer destroys its type.

    5.1.0release notes

  • Handling of multi-target from-import statements was fixed.

    5.1.0release notes

  • kernprof now always runs code in sys.modules['__main__']'s namespace.

    5.1.0release notes

  • Running kernprof.main no longer reverts the entirety of sys.modules.

    5.1.0release notes

  • Bytecode for profiled functions is always padded.

    5.1.0release notes

  • Recursive calls are now counted correctly.

    5.1.0release notes

  • The typing of ScopingPolicy members was fixed.

    5.1.0release notes

  • Unencodable characters are escaped instead of causing lines to be dropped.

    5.1.0release notes

  • A type fix was made to the base; the notes do not specify further details.

    5.0.2release notes

  • File resolution for files executed with kernprof -m now uses the import system.

    5.0.1release notes

  • Fixes and build changes improve compatibility with Python 3.14, including preventing duplicate output.

    5.0.1release notes

  • Reference-count leaks are fixed.

    5.0.1release notes

  • Profiling support is improved for class methods, static and bound methods, partial methods and objects, cached properties, and async generator functions.

    5.0.0release notes

  • Cleanup code now runs when exceptions occur inside the context.

    5.0.0release notes

  • Line tracing for Cython code is fixed.

    5.0.0release notes

  • Now includes profiling data from duplicate code objects.

    5.0.0release notes

line-profiler 44 changes

Breaking changes 1

  • The attribute is now indexed by a hash of the code block's bytecode and its line number; code that directly reads, processes, or edits it will likely break.

    4.0.0release notes

New APIs and options 1

  • Adds an option to output profiling data to the output file every n seconds, useful for long-running tasks that should not be stopped during processing.

    4.0.0release notes

Performance 1

  • Profiling overhead is drastically smaller, with reductions of 0.3 to 1 microseconds per line hit and speedups of up to 4x for some codebases.

    4.0.0release notes

Fixes and other changes 1