Changes
=======


5.0.1
~~~~~
* ENH: improved type annotations and moved them inline


5.0.1
~~~~~
* 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

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
* 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
* ENH: Added capability to combine profiling data both programmatically (``LineStats.__add__()``) and via the CLI (``python -m line_profiler``) (#380, originally proposed in #219)

4.2.0
~~~~~
* 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

4.1.3
~~~~~
* FIX: duration summary now respects the stripzeros argument.
* FIX: minor test fixes.
* ENH: building osx wheels for x86 and arm64.
* ENH: documentation improvements.
* ENH: signed wheels are now hosted on github and published as release artifacts.

4.1.2
~~~~~
* ENH: Add support for Python 3.12 #246
* ENH: Add osx universal2 and arm64 wheels #251
* ENH: Fix issue with integer overflow on 32 bit systems #249

4.1.1
~~~~~
* FIX: ``get_stats`` is no longer slowed down when profiling many code sections #236

4.1.0
~~~~~
* FIX: skipzeros now checks for zero hits instead of zero time
* FIX: Fixed errors in Python 3.11 with duplicate functions.
* FIX: ``show_text`` now increases column sizes or switches to scientific notation to maintain alignment
* ENH: ``show_text`` now has new options: sort and summarize
* ENH: Added new CLI arguments ``-srm`` to ``line_profiler`` to control sorting, rich printing, and summary printing.
* ENH: New global ``profile`` function that can be enabled by ``--profile`` or ``LINE_PROFILE=1``.
* ENH: New auto-profile feature in ``kernprof`` that will profile all functions in specified modules.
* ENH: Kernprof now outputs instructions on how to view results.
* ENH: Added readthedocs integration: https://kernprof.readthedocs.io/en/latest/index.html

4.0.3
~~~~~
* FIX: Stop requiring bleeding-edge Cython unless necesasry (for Python 3.12).  #206

4.0.2
~~~~~
* FIX: AttributeError on certain methods. #191

4.0.1
~~~~~
* FIX: Profiling classmethods works again. #183

4.0.0
~~~~~
* ENH: Python 3.11 is now supported.
* ENH: Profiling overhead is now drastically smaller, thanks to reimplementing almost all of the tracing callback in C++. You can expect to see reductions of between 0.3 and 1 microseconds per line hit, resulting in a speedup of up to 4x for codebases with many lines of Python that only do a little work per line.
* ENH: Added the ``-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.
* CHANGE: Cython's native cythonize function is now used to compile the project, instead of scikit-build's convoluted process.
* CHANGE: Due to optimizations done while reimplementing the callback in C++, the profiler's code_map and last_time attributes now are indexed by a hash of the code block's bytecode and its line number. Any code that directly reads (and processes) or edits the code_map and/or last_time attributes will likely break.

3.5.2
~~~~~
* FIX: filepath test in is_ipython_kernel_cell for Windows #161
* ADD: setup.py now checks LINE_PROFILER_BUILD_METHOD to determine how to build binaries
* ADD: LineProfiler.add_function warns if an added function has a __wrapped__ attribute

3.5.1
~~~~~
* FIX: #19 line profiler now works on async functions again

3.5.0
~~~~~
* FIX: #109 kernprof fails to write to stdout if stdout was replaced
* FIX: Fixes max of an empty sequence error #118
* Make IPython optional
* FIX: #100 Exception raise ZeroDivisionError

3.4.0
~~~~~
* Drop support for Python <= 3.5.x
* FIX: #104 issue with new IPython kernels

3.3.1
~~~~~
* 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.

3.3.0
~~~~~
* New CI for building wheels.

3.2.6
~~~~~
* FIX: Update MANIFEST.in to package pyproj.toml and missing pyx file
* CHANGE: Removed version experimental augmentation.

3.2.5
~~~~~
* FIX: Update MANIFEST.in to package nested c source files in the sdist

3.2.4
~~~~~
* FIX: Update MANIFEST.in to package nested CMakeLists.txt in the sdist

3.2.3
~~~~~
* FIX: Use ImportError instead of ModuleNotFoundError while 3.5 is being supported
* FIX: Add MANIFEST.in to package CMakeLists.txt in the sdist

3.2.2
~~~~~
* ENH: Added better error message when c-extension is not compiled.
* FIX: Kernprof no longer imports line_profiler to avoid side effects.

3.2.0
~~~~~
* 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.

3.1.0
~~~~~
* ENH: fix Python 3.9

3.0.2
~~~~~
* BUG: fix ``__version__`` attribute in Python 2 CLI.

3.0.1
~~~~~
* BUG: fix calling the package from the command line

3.0.0
~~~~~
* ENH: Fix Python 3.7
* ENH: Restructure into package

2.1
~~~
* ENH: Add support for Python 3.5 coroutines
* ENH: Documentation updates
* ENH: CI for most recent Python versions (3.5, 3.6, 3.6-dev, 3.7-dev, nightly)
* ENH: Add timer unit argument for output time granularity spec

2.0
~~~
* BUG: Added support for IPython 5.0+, removed support for IPython <=0.12

1.1
~~~
* BUG: Read source files as bytes.

1.0
~~~
* 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.

1.0b3
~~~~~

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

1.0b2
~~~~~

* BUG: fixed line timing overflow on Windows.
* DOC: improved the README.

1.0b1
~~~~~

* Initial release.
