line-profiler 5.1.0


pip install line-profiler

  Latest version

Released: Oct 18, 2026

Project Links

Meta
Author: Robert Kern
Requires Python: >=3.10

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15

Topic
  • Software Development :: Libraries :: Python Modules
  • Utilities

Pypi ReadTheDocs Downloads CircleCI GithubActions Codecov

This is the official line_profiler repository. The most recent version of line-profiler on pypi points to this repo. The original line_profiler package by @rkern is unmaintained. This fork is the official continuation of the project.

Github

https://github.com/pyutils/line_profiler

Pypi

https://pypi.org/project/line_profiler

ReadTheDocs

https://kernprof.readthedocs.io/en/latest/


line_profiler is a module for doing line-by-line profiling of functions. Use it when function-level profiling identifies a slow function, but you need to see which individual source lines account for the time. kernprof is the command-line helper included with the package.

They are available under a BSD license.

Installation

Releases of line_profiler can be installed using pip:

$ pip install line_profiler

Current releases require Python 3.10 or newer. Older Python versions require older line_profiler releases.

Installation while ensuring a compatible IPython version can also be installed using pip:

$ pip install line_profiler[ipython]

Source installs may require a C compiler. Git checkouts also require Cython. Wheels are published for common platforms. If no wheel is available for your platform or Python version, installation may build from source.

Quick Start

The recommended way to use line_profiler is to import profile and enable profiling with the LINE_PROFILE environment variable.

To profile a python script:

  • Install line_profiler: pip install line_profiler.

  • In the relevant file(s), import profile and decorate function(s) you want to profile:

    from line_profiler import profile
    
    
    @profile
    def slow_function():
        ...
  • Set the environment variable LINE_PROFILE=1 and run your script as normal. When the script ends a summary of profile results, files written to disk, and instructions for inspecting details will be written to stdout.

For more details and a short tutorial see Line Profiler Basic Usage.

Older kernprof workflow

The older kernprof -l workflow is still supported, but it is no longer the main README quick start. See Usage Notes and FAQ for the previous README material covering kernprof, IPython, lower-level API usage, related tools, and FAQ entries.

The short version is:

$ kernprof -lv script_to_profile.py

Documentation

Bugs and Such

Bugs and pull requests can be submitted on GitHub.

Wheel compatibility matrix

Platform CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13 CPython 3.14 CPython 3.15
macosx_10_13_x86_64
macosx_10_15_x86_64
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux_2_24_aarch64
manylinux_2_24_x86_64
manylinux_2_28_aarch64
manylinux_2_28_x86_64
win_amd64

Files in release

line_profiler-5.1.0-cp310-cp310-macosx_10_9_x86_64.whl (297.4KiB)
line_profiler-5.1.0-cp310-cp310-macosx_11_0_arm64.whl (284.3KiB)
line_profiler-5.1.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
line_profiler-5.1.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.3MiB)
line_profiler-5.1.0-cp310-cp310-win_amd64.whl (463.9KiB)
line_profiler-5.1.0-cp311-cp311-macosx_10_9_x86_64.whl (296.5KiB)
line_profiler-5.1.0-cp311-cp311-macosx_11_0_arm64.whl (283.6KiB)
line_profiler-5.1.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
line_profiler-5.1.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.3MiB)
line_profiler-5.1.0-cp311-cp311-win_amd64.whl (464.3KiB)
line_profiler-5.1.0-cp312-cp312-macosx_10_13_x86_64.whl (292.3KiB)
line_profiler-5.1.0-cp312-cp312-macosx_11_0_arm64.whl (280.5KiB)
line_profiler-5.1.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
line_profiler-5.1.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.3MiB)
line_profiler-5.1.0-cp312-cp312-win_amd64.whl (460.9KiB)
line_profiler-5.1.0-cp313-cp313-macosx_10_13_x86_64.whl (294.1KiB)
line_profiler-5.1.0-cp313-cp313-macosx_11_0_arm64.whl (281.3KiB)
line_profiler-5.1.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
line_profiler-5.1.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.3MiB)
line_profiler-5.1.0-cp313-cp313-win_amd64.whl (460.9KiB)
line_profiler-5.1.0-cp314-cp314-macosx_10_15_x86_64.whl (294.3KiB)
line_profiler-5.1.0-cp314-cp314-macosx_11_0_arm64.whl (283.1KiB)
line_profiler-5.1.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
line_profiler-5.1.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.3MiB)
line_profiler-5.1.0-cp314-cp314-win_amd64.whl (470.8KiB)
line_profiler-5.1.0-cp315-cp315-macosx_10_15_x86_64.whl (294.2KiB)
line_profiler-5.1.0-cp315-cp315-macosx_11_0_arm64.whl (282.9KiB)
line_profiler-5.1.0-cp315-cp315-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (1.3MiB)
line_profiler-5.1.0-cp315-cp315-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.3MiB)
line_profiler-5.1.0-cp315-cp315-win_amd64.whl (470.9KiB)
line_profiler-5.1.0.tar.gz (193.2KiB)
Extras:
Dependencies:
tomli
typing_extensions