repomatic.deps.uv module¶
Build uv and uvx command lines, and run them.
The leaf of the dependency package: it imports nothing else from it, so the
tool runner and the docs builder reach the builders without loading the lock
and report machinery. The lock views live in repomatic.deps.lockfile,
the cooldown lifecycle in repomatic.deps.cooldown.
- repomatic.deps.uv.uv_cmd(subcommand, *, frozen=False, no_project=False, exclude_newer=None)[source]¶
Build a
uv <subcommand>command prefix with standard flags.Always includes
--no-progress. Adds--frozenwhen requested (appropriate forrun,export,sync, never forlock). Adds--no-projectto skip project discovery entirely, and--exclude-newerto gate a resolution by a cooldown, mirroringuvx_cmd().
- repomatic.deps.uv.uvx_cmd(exclude_newer=None)[source]¶
Build a
uvxcommand prefix with standard flags.When exclude_newer is set (a
YYYY-MM-DDdate), adds--exclude-newerso the isolated resolution honors theminimum-release-agecooldown, gating the tool’s transitive dependencies by upload date.
- repomatic.deps.uv.uv_lock_command(*extra, exclude_newer='', exclude_newer_packages=None)[source]¶
Build a
uv lockargv carrying a cooldown window.The one builder behind every re-lock this package runs with a window (
sync-uv-lock, the dep-sources swap,audit --fix, the held-back probe), so none of them can forget the explicit--exclude-newerthat keeps CI’s ambientUV_EXCLUDE_NEWERfrom retiming the lock: seerepomatic.deps.cooldown.UvSettings.window.relock()alone runs a plainuv lock.- Parameters:
extra (
str) – Extrauv lockarguments (--upgrade,--upgrade-package, …), placed before the cooldown flags.exclude_newer (
str) – The window, in any form uv accepts. Empty leaves the flag off.exclude_newer_packages (
Mapping[str,str] |None) – Package name to its own window, for this run only. A flag on the command line beats thepyproject.tomlentry of the same package.
- Return type:
- Returns:
The argv to run, with
cwdset to the project directory.
- exception repomatic.deps.uv.UvError(returncode, cmd, output=None, stderr=None)[source]¶
Bases:
CalledProcessErrorA
uvcommand that exited non-zero, carrying what it printed on stderr.
- repomatic.deps.uv.run_uv(cmd, *, cwd=None, check=True)[source]¶
Run a
uvcommand and capture its output.The one runner behind every
uvcall of this package. The output is captured, never streamed: a resolution summary printed while a progress trail is on screen lands on the trail’s own row. The decoding is pinned to UTF-8, since an SBOM carries package descriptions and author names that the platform default cannot always decode.- Parameters:
- Return type:
- Returns:
The completed process,
stdoutandstderras text.- Raises:
UvError – When the command fails and check is set. Its message carries the command’s stderr. Also when the command cannot start, with no
uvonPATHor no cwd, whatever check: the exit status is then 127, the one a shell gives a command it cannot find.
- repomatic.deps.uv.relock()[source]¶
Refresh
uv.lockafter a version bump, and nothing else in it.A plain
uv lock, on purpose.bump-my-versionrewrites the project’s version inpyproject.tomlbut not inuv.lock, and a bump committed without the re-lock leaves the project ahead of its own lock entry: the nextuv run --frozenthen reinstalls the project, and two nested syncs of a release build can delete a console script the other one is running, a sharing violation on Windows.uv lock --upgradewould re-resolve every dependency instead. With a"0 day"exclude-newer-packagebypass in place, it fast-forwards that dependency across a release still inside its cooldown, on an unreviewed bump pull request.uv syncwould leave the lock in a state thesync-uv-lockjob rewrites into a redundant follow-up pull request. Dependency upgrades stay the job ofsync-uv-lock, in their own pull request.