Skip to content

latent.version_check

Version pinning utilities for latent-py consumer projects.

Consumer repos declare their required latent-py version in pyproject.toml:

[tool.latent-py]
version = "3.3.0"

This module provides: - read_pinned_version() — read the pinned version from pyproject.toml - check_version() — compare pinned vs installed, return mismatch info - scaffold_version_pin() — add [tool.latent-py] section to pyproject.toml

Classes

VersionCheckResult

VersionCheckResult(pinned: str | None, installed: str, compatible: bool, message: str)

Result of a version compatibility check.

Functions

check_version

check_version(pyproject_path: Path | None = None) -> VersionCheckResult

Check if installed latent version matches the pinned version.

Returns a VersionCheckResult with compatibility info.

get_installed_version

get_installed_version() -> str

Get the currently installed latent version.

read_pinned_version

read_pinned_version(pyproject_path: Path | None = None) -> str | None

Read [tool.latent-py].version from pyproject.toml.

Returns None if the section or key doesn't exist.

scaffold_version_pin

scaffold_version_pin(pyproject_path: Path | None = None) -> Path

Add or update [tool.latent-py].version in pyproject.toml.

Returns the path to the modified file.

Attributes

TOOL_SECTION

VERSION_KEY