Skip to main content
LineScope logo

Your code. In the spotlight.

A source profiler for Python and Spark


📜 Overview

General Information
Repository Project Status: Active License: MIT Downloads PyPI version
Build Publish Linting and tests codecov
Code Python uv-managed PEP8 ruff ty

LineScope overview with the most expensive source lines LineScope full-source heatmap with clickable function calls
LineScope function timings and source links LineScope notebook session with captured cells
LineScope Spark actions and operator costs LineScope project source files and measured timings

💡 Introduction

Profile Python source line by line, including notebook cells and Spark actions. Reports contain source snapshots, timings, memory measurements, and definition links in one HTML file. Library work is attributed to the calling project line.


📦 Install

Python 3.11–3.15 is supported. Install in your script or notebook's environment:

uv pip install -U linescope
Extra Adds
linescope[notebook] IPython cell magics and inline reports
linescope[scalene] CPU sampling and GPU metrics on Python 3.11–3.14
linescope[full] Both extras

For unreleased changes:

uv pip install -U git+https://github.com/tvdboom/linescope.git@main

Spark and Databricks use the runtime's PySpark and SDK. Enable Spark observation with spark=True or --spark.


🚀 Use

💻 Terminal

linescope --memory --output report.html your_script.py
linescope --output report.html -m your_package.your_module

The report opens in a browser. Add --display none to save without opening it. Put profiler options before the target; subsequent arguments go to your program.

🐍 Python

from linescope import profile

with profile(memory=True, display="none") as session:
    total = sum(value * value for value in range(100_000))

session.save("report.html")

Trace is the default. Select backend="scalene" for sampling or GPU collection, or backend="tachyon" for sampling on Python 3.15.

📓 Notebook

%load_ext linescope
%%profile --display cell-summary

total = sum(value * value for value in range(100_000))

📘 Documentation

Relevant links
⭐ About See what LineScope measures and how reports present it.
🚀 Getting started Install LineScope and generate your first report.
👨‍💻 User guide Choose a backend, configure profiling, and read reports.
📓 Notebooks and Databricks Profile individual cells or a whole notebook session.
⚡ Spark Trace Spark actions back to source lines and interpret plan metrics.
✨ AI suggestions Request performance suggestions for profiled code from a report.
🎛️ API reference Look up Python APIs, configuration, and result models.
💻 CLI reference Look up command-line options for profiling scripts and modules.
❔ FAQ Find answers to common profiling questions.
🔧 Contributing Set up a development environment and run the project checks.
🌳 Dependencies Review required packages and optional integrations.
📃 License Read the MIT license terms.

Metadata

Release files for linescope 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linescope 0.1.1
File Size Uploaded Provenance Actions
linescope-0.1.1.tar.gz 4.4 MB Without provenance Details for linescope-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for linescope 0.1.1
File Interpreter ABI Platform Actions
linescope-0.1.1-py3-none-any.whl Python 3 none any Details for linescope-0.1.1-py3-none-any.whl

Total release size: 5.0 MB

Release files / linescope-0.1.1.tar.gz

Download URL linescope-0.1.1.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
18fc4d88723c08b057b48beea9af100cac22ec2db3df6747241aa45ac2088b46
BLAKE2b-256 checksum
How to use checksums
c980fe84f0465e4633d6b2f698475d49d87e59f395dd98a702fdd36c2d0c9d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / linescope-0.1.1-py3-none-any.whl

Download URL linescope-0.1.1-py3-none-any.whl
Size 563.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1611d185d43498161b30e51a41e30303c3d627f0f6b7bce6f1040401f4f997c2
BLAKE2b-256 checksum
How to use checksums
643a5d6106618642fd2907ec0406494d86b1f4d2d6bbafcc09ebb3bdb1e88739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for linescope 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page