Skip to content

Config

dataclass linescope.config.Config[source]

Configure a single profiling session.

Parameters

backend : str | Backend, default=default_backend()

Built-in or registered collector name. Defaults to Trace.

memory : bool, default=False

Collect process RAM and retained Python allocations separately.

gpu : bool, default=False

Collect supported Scalene GPU utilization and device memory. Trace warns and continues Python profiling without GPU measurements.

sample_rate : int | None, default=None

Target samples per second for Scalene or Tachyon. None uses 1000. Trace ignores this setting; the achieved rate can vary.

root : str | None, default=None

Project directory; otherwise discover the nearest pyproject.toml.

include : tuple[str, ...], default=()

Package names, filesystem paths, or project-relative glob patterns.

exclude : tuple[str, ...], default=()

Package names, filesystem paths, or project-relative glob patterns.

spark : bool, default=False

Observe existing Spark actions. Requires PySpark; no actions are forced.

notebooks : bool, default=True

Capture executed notebook cells and their source links.

child_notebooks : bool, default=True

Profile Databricks child notebooks through temporary workspace copies. Requires SDK access and workspace permissions.

display : str | DisplayMode, default=DisplayMode.END

Full report at stop (end), cumulative report after each cell (cell), compact cell results (cell-summary), or no automatic display (none).

output : str | None, default=None

Explicit report destination. None opens a temporary HTML report.


See Also

profile

Create a session with Config options.

Session

Collect source measurements and render an HTML report.


Example

>>> from linescope.config import Config

>>> Config(backend="trace").memory
False