Skip to content

Timenet.provenance

timenet.provenance source

Read the git commit of the installed TimeNet code, for the manifest's build_env.git block.

EditableInstall dataclass source

Bases: InstallSource

An editable install (pip install -e, or a uv workspace member).

Python imports the code from the checkout itself, so git reports its commit and local changes.

package_name instance-attribute source

package_name: PackageName

project_directory instance-attribute source

project_directory: Path

read_git_source source

read_git_source() -> GitSource

Ask git for the commit of the checkout and whether the package directory has changes.

GitInstall dataclass source

Bases: InstallSource

An install from a git URL (pip install git+https://...). Pip recorded the commit.

commit_id instance-attribute source

commit_id: str

package_name instance-attribute source

package_name: PackageName

read_git_source source

read_git_source() -> GitSource

Return the commit that pip installed, which has no local changes.

InstallSource dataclass source

Bases: ABC

Where one package was installed from: a git checkout, a git URL, or a wheel.

Each kind records its git provenance in a different place.

package_name instance-attribute source

package_name: PackageName

read_git_source abstractmethod source

read_git_source() -> GitSource

Return the commit of the code that this install runs. Raises TimeNetBuildError if it is unknown.

InstalledDistribution source

One distribution that is installed in this interpreter.

name property source

The package name that pip installs, for example timenet-connectors.

version property source

version: str

The installed version.

from_name classmethod source

from_name(name: PackageName) -> Self

Find an installed package by name, such as timenet.

Note: An extra like timenet[zarr] is not a name, and from_name would not find it.

Returns:

Type Description
Self

The installed package.

Raises:

Type Description
PackageNotFoundError

If it is not installed.

install_source source

install_source() -> InstallSource

Return how this distribution was installed, which decides where its commit is recorded.

path_to_ondisk_project_directory source

path_to_ondisk_project_directory() -> Path | None

Return the project directory of an editable or local path install, else None.

read_git_source source

read_git_source() -> GitSource

Return the commit of the code that this distribution runs. Raises TimeNetBuildError if it is unknown.

PackageSnapshot source

Bases: Snapshot

The commit of one package that pip installed, such as timenet or timenet-connectors.

Note: Not a subpackage such as timenet.registry.

model_config class-attribute instance-attribute source

model_config = ConfigDict(
    frozen=True, validate_by_name=True
)

package_name instance-attribute source

package_name: PackageName

The name pip installs, for example timenet-connectors.

source instance-attribute source

source: GitSource

read classmethod source

read(package_name: PackageName) -> Self

Read the commit of an installed package. Raises TimeNetBuildError if it is not installed.

read_if_installed classmethod source

read_if_installed(package_name: PackageName) -> Self | None

Read the commit of a package, or return None if it is not installed.

to_source_map source

to_source_map() -> GitSourceMap

Return this package's commit in the form that a manifest records.

Snapshot source

Bases: BaseModel, ABC

The commit of some installed code, read at one point in time.

model_config class-attribute instance-attribute source

model_config = ConfigDict(
    frozen=True, validate_by_name=True
)

to_source_map abstractmethod source

to_source_map() -> GitSourceMap

Return the commits in the form that a manifest records.

TimeNetSnapshot source

Bases: Snapshot

The commit of each installed TimeNet package, read at one point in time.

model_config class-attribute instance-attribute source

model_config = ConfigDict(
    frozen=True, validate_by_name=True
)

timenet instance-attribute source

timenet: PackageSnapshot

timenet_connectors class-attribute instance-attribute source

timenet_connectors: PackageSnapshot | None = Field(
    default=None, alias="timenet-connectors"
)

None if timenet-connectors is not installed.

from_source_map classmethod source

from_source_map(sources: GitSourceMap) -> Self

Return the typed view of the commits that a manifest records.

package_names classmethod source

package_names() -> tuple[PackageName, ...]

Return the name of each TimeNet package, in field order.

packages_with_local_changes source

packages_with_local_changes() -> list[PackageSnapshot]

Return each installed TimeNet package whose code has local changes.

read classmethod source

read() -> Self

Read the commit of each installed TimeNet package. Raises TimeNetBuildError if one is unknown.

to_source_map source

to_source_map() -> GitSourceMap

Return the commit of each installed TimeNet package.

WheelInstall dataclass source

Bases: InstallSource

An install from a wheel, including a path install that is not editable (pip builds a wheel first).

The installed code is a copy, so a checkout can differ from it. The wheel carries the git provenance record baked into it at build time (_build_info.json).

BUILD_INFO_FILE class-attribute source

BUILD_INFO_FILE: str = '_build_info.json'

The commit record in each wheel. scripts/build_dists.py writes it.

build_info instance-attribute source

build_info: Path

package_name instance-attribute source

package_name: PackageName

read_git_source source

read_git_source() -> GitSource

Read the commit that scripts/build_dists.py wrote into the package.