lookback_tools.sync#

Sync tools.

Module Contents#

Classes#

Dep

Dependency.

Compiler

Compiler.

Compilation

Compilation.

Functions#

check_compilation

Check compilation, re-lock if incompatible, and return the requirements.

lock

Lock.

get_lockfile_key

Get the name of a dependency compilation.

get_lockfile

Get lockfile path.

get_uv_version

Get version of uv at bin/uv.

get_directs

Get directs.

compile

Compile dependencies.

get_subs

Get submodules.

get_submodule_info

Get submodule info.

escape

Escape a path, suitable for passing to e.g. run().

Data#

PYTEST

Resulting pytest configuration file.

PYTHON_VERSIONS_FILE

File containing supported Python versions.

REQS

Requirements.

DEV

Other development tools and editable local dependencies.

DEPS

Paths to compile dependencies for.

OVERRIDES

Overrides to satisfy otherwise incompatible combinations.

NODEPS

Path to dependencies which should not have their transitive dependencies compiled.

SECURITY_REQS

Security requirements.

SYS_PLATFORM

Platform identifier.

SYS_PYTHON_VERSION

Python version associated with this platform.

PROJECT_PLATFORM

This project’s default compilation platform.

PROJECT_PYTHON_VERSION

This project’s default Python version.

PLATFORMS

Supported platforms.

PYTHON_VERSIONS

Supported Python versions.

NAME_PAT

Regular expression for a legal Python package name.

OP_PAT

Regular expression for valid version separators.

API#

class lookback_tools.sync.Dep#

Dependency.

op: lookback_tools.types.Op#

None

Operator.

rev: str#

None

Revision.

model_dump() lookback_tools.types.Dep#

Dump model.

lookback_tools.sync.PYTEST#

‘Path(…)’

Resulting pytest configuration file.

lookback_tools.sync.PYTHON_VERSIONS_FILE#

‘Path(…)’

File containing supported Python versions.

lookback_tools.sync.REQS#

‘Path(…)’

Requirements.

lookback_tools.sync.DEV#

None

Other development tools and editable local dependencies.

lookback_tools.sync.DEPS#

()

Paths to compile dependencies for.

lookback_tools.sync.OVERRIDES#

None

Overrides to satisfy otherwise incompatible combinations.

lookback_tools.sync.NODEPS#

None

Path to dependencies which should not have their transitive dependencies compiled.

lookback_tools.sync.SECURITY_REQS#

None

Security requirements.

lookback_tools.sync.SYS_PLATFORM: lookback_tools.types.Platform#

None

Platform identifier.

lookback_tools.sync.SYS_PYTHON_VERSION: lookback_tools.types.PythonVersion#

‘join(…)’

Python version associated with this platform.

lookback_tools.sync.PROJECT_PLATFORM: lookback_tools.types.Platform#

‘linux’

This project’s default compilation platform.

lookback_tools.sync.PROJECT_PYTHON_VERSION: lookback_tools.types.PythonVersion#

‘3.11’

This project’s default Python version.

lookback_tools.sync.PLATFORMS: tuple[lookback_tools.types.Platform, ...]#

(‘linux’, ‘macos’, ‘windows’)

Supported platforms.

lookback_tools.sync.PYTHON_VERSIONS: tuple[lookback_tools.types.PythonVersion, ...]#

None

Supported Python versions.

lookback_tools.sync.check_compilation(
high: bool = False,
) str#

Check compilation, re-lock if incompatible, and return the requirements.

lookback_tools.sync.lock(
high: bool = False,
) str#

Lock.

lookback_tools.sync.get_lockfile_key(
platform: lookback_tools.types.Platform,
python_version: lookback_tools.types.PythonVersion,
) str#

Get the name of a dependency compilation.

Parameters#

  • platform: Platform to compile for.

  • python_version: Python version to compile for.

  • high: Highest dependencies.

lookback_tools.sync.get_lockfile(
high: bool,
) pathlib.Path#

Get lockfile path.

lookback_tools.sync.get_uv_version() str#

Get version of uv at bin/uv.

class lookback_tools.sync.Compiler#

Compiler.

uv: str#

‘field(…)’

Version of uv used to compile.

platform: lookback_tools.types.Platform#

None

Platform compiled for.

python_version: lookback_tools.types.PythonVersion#

None

Python version compiled for.

high: bool#

False

Highest dependencies.

no_deps: bool#

False

Without transitive dependencies.

overrides: pathlib.Path#

None

Overrides.

paths: tuple[pathlib.Path, ...]#

None

Paths compiled from, such as requirements.in or pyproject.toml.

get_command() tuple[datetime.datetime, list[str]]#

Command to reproduce compilation requirements.

get_lockfile_key() str#

Get lockfile key.

compile(
time: datetime.datetime = datetime.min,
directs: dict[str, lookback_tools.sync.Dep] | None = None,
) lookback_tools.sync.Compilation#

Compile dependencies.

classmethod from_lock(
platform: lookback_tools.types.Platform | None = None,
python_version: lookback_tools.types.PythonVersion | None = None,
high: bool = False,
) Self#

Get locked project compiler.

lookback_tools.sync.NAME_PAT#

‘[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9._-]*[A-Za-z0-9]’

Regular expression for a legal Python package name.

See: https://packaging.python.org/en/latest/specifications/name-normalization/#name-format

lookback_tools.sync.OP_PAT#

‘join(…)’

Regular expression for valid version separators.

lookback_tools.sync.get_directs(
requirements: str | None = None,
) dict[str, lookback_tools.sync.Dep]#

Get directs.

class lookback_tools.sync.Compilation#

Compilation.

compiler: lookback_tools.sync.Compiler#

‘field(…)’

Compiler used to compile.

time: datetime.datetime#

None

Time of compilation.

requirements: str = <Multiline-String>#

Result of compilation.

directs: dict[str, lookback_tools.sync.Dep]#

‘field(…)’

Direct dependencies and their revisions.

__post_init__()#
classmethod from_lock(
platform: lookback_tools.types.Platform | None = None,
python_version: lookback_tools.types.PythonVersion | None = None,
high: bool = False,
) Self#

Get locked project compiler.

lookback_tools.sync.compile(
compiler: lookback_tools.sync.Compiler,
) tuple[datetime.datetime, str]#

Compile dependencies.

lookback_tools.sync.get_subs() dict[str, lookback_tools.sync.Dep]#

Get submodules.

lookback_tools.sync.get_submodule_info(
kind: lookback_tools.types.SubmoduleInfoKind,
) list[str]#

Get submodule info.

lookback_tools.sync.escape(
path: str | pathlib.Path,
) str#

Escape a path, suitable for passing to e.g. run().