repomatic.release.self_pin module¶
The pin a workflow holds on the upstream toolkit itself.
A workflow reaches the upstream toolkit from a run: command through an inline
pin: uvx 'repomatic==1.2.3' show-metadata. That pin moves in lockstep with the
uses: refs of the same workflows, whatever the cooldown, so the command also
carries a cooldown exemption for the package. On main of the source
repository, the workflows run the CLI from the lockfile instead, and the release
freeze swaps the one form for the other.
Every spelling of those commands lives here, for each of their writers and
checkers: the release freeze and unfreeze, the realignment of repomatic init,
the rewrite of sync-workflow-pins, and the checks of lint-repo. Each one
takes the package name: repomatic init --upstream-repo can point a repository
at a renamed fork, whose package is not repomatic.
- repomatic.release.self_pin.cooldown_exemption(package)[source]¶
The uv flag letting a just-published package install under the cooldown.
Every workflow exports a
UV_EXCLUDE_NEWERcovering all package resolution (seedocs/workflows.md§ Install-time cooldown), and it applies to the frozen'repomatic==X.Y.Z'self-pin like any other requirement. That pin moves in lockstep with theuses:refs pointing at the same tag, so the version it names is always minutes old: without an exemption every downstream repository would fail to resolve it until the window elapsed. A zero-length window sets the cutoff of that one package to “now”, and leaves the rest of the tree gated.uv exposes no environment variable for
--exclude-newer-package, so the exemption has to ride on the command line. That is why it sits beside the pin instead of the workflows declaring it once.Note
A
uvxresolution reads no project configuration at all, so moving the exemption into[tool.uv]or an adjacentuv.tomlwould not work either: both are ignored (verified against uv0.12.3). The one knob that does reach it,--config-file/UV_CONFIG_FILE, replaces discovered configuration instead of merging with it: set for a whole CI environment, it silently dropsrequired-version,exclude-newer,dependency-groupsandbuild-backendfrom every other uv command there, unless a complete mirror of[tool.uv]sits beside it.Todo
Declare the exemption once, instead of splicing it onto every frozen command line, as soon as uv grows a configuration or environment knob for
--exclude-newer-package: astral-sh/uv#20995. Glob exemptions (astral-sh/uv#20788) and pin-based bypasses (astral-sh/uv#19864, astral-sh/uv#18921) could settle it too.Spelled as the ISO 8601
P0Drather than the"0 day"used inpyproject.toml’sexclude-newer-packagetable: the flag travels through YAML folded scalars into a shell, where the space in0 daywould need quoting that survives both.P0Dneeds none.Caution
Every character here lands on 80-odd already-long workflow lines at freeze time.
tests/test_prepare_release.pysimulates a freeze and fails if the result breaches the 120-column cap of yamllint, so lengthening this string means reflowing the workflows that no longer fit.
- repomatic.release.self_pin.local_cli_invocation(package)[source]¶
How every workflow on
mainruns the CLI, before the freeze rewrites it.Resolving from
uv.lockrather than from the index is what keeps the cooldown off the critical path here. A lockfile entry is pinned and hash-verified, so it is strictly stronger than a publication-age gate, and it cannot be made unsatisfiable by one:uvx --from .re-resolves[project.dependencies]on every call, and reads neitheruv.locknor[tool.uv] exclude-newer-package, so a floor naming a release younger than the window took every workflow down at once with nowhere to record the bypass.--frozenuses the lockfile as-is instead of asserting it is current, which is deliberate:--lockedwould fail every job the momentpyproject.tomldrifted ahead ofuv.lock, including thesync-uv-lockjob whose whole purpose is to close that gap.
- repomatic.release.self_pin.frozen_cli_invocation(package, version)[source]¶
Render the frozen, cooldown-exempt
uvxinvocation of package.The one spelling both writers emit: the release freeze writes it whole, and
add_cooldown_exemption()converges an exemption-less command onto the same bytes, sofrozen_cli_re()has one shape to recognize.
- repomatic.release.self_pin.frozen_cli_re(package: str) Pattern[str][source]¶
Match
frozen_cli_invocation()at any version.What the release unfreeze turns back into
local_cli_invocation().
- repomatic.release.self_pin.inline_pin_re(package: str) Pattern[str][source]¶
Match an inline
{package}==X.Y.Zpin, in any shape a workflow writes it.The one matcher of the pinned version: the
lint-repolockstep check reads it, andrepomatic initandsync-workflow-pinsrewrite it, so the check never flags a pin the rewrite cannot fix. Quoted or bare, with or without extras:uvx 'repomatic==1.2.3',--with 'repomatic[cli]==1.2.3',pip install repomatic==1.2.3.The lookbehind leaves out a longer name ending in package, like
papaya-repomatic==1.0. The exemption ofcooldown_exemption()never matches: it joins the package to its window with a single=.Memoized: every caller asks for the same package, once per workflow file.
- repomatic.release.self_pin.find_inline_pins(content, package)[source]¶
The versions the inline pins of package name, in the order they appear.
- repomatic.release.self_pin.align_inline_pins(content, package, version)[source]¶
Rewrite every inline pin of package onto version, in either direction.
The refs are the source of truth, so a pin ahead of them is drift the same way one behind them is.
- Parameters:
- Return type:
- Returns:
The updated text, and one
(package, old, new)triple per pin that moved.
- repomatic.release.self_pin.cooldown_exemptions(content, package)[source]¶
Whether each
uvxcommand pinning package carries its exemption.
- repomatic.release.self_pin.add_cooldown_exemption(content, package)[source]¶
Splice the exemption into every
uvxcommand pinning package.The inline pin moves in lockstep with the
uses:refs, regardless of the cooldown, so the version it names can be minutes old. Every workflow exports aUV_EXCLUDE_NEWERcovering all resolution, anduvxreads no per-package exemption from the environment or frompyproject.toml, so without the flag on the command line the freshly aligned pin fails to resolve until the window elapses.Idempotent: a command already carrying the exemption is left untouched.