Files
Holocron/plugins/kyberforge/.apm/skills/apm-install/references/uv-pin.md
T
Defame1297andClaude Opus 5.5 b81af32425 feat(kyberforge): document the per-repo uv pin of apm in apm-install
Add a dispatch on where apm comes from: a repo that pins apm with uv, a
repo that wants the pin, or a global install. The new uv-pin reference
covers the pyproject.toml dev group, the committed uv.lock, running as
uv run --frozen apm, the one-time online sync, upgrading the pin, and why
uvx and uv tool are not used. It closes with a worked example of one
pinned and one unpinned repo.

Raise the pip floor to Python 3.11, which apm requires since 0.36.0, add
the package-manager installs, and note the 0.39.2 minimum for v4 locks.
Bump metadata.version to 1.0.2.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:59:17 +00:00

4.3 KiB

source_keys
source_keys
apm-cli-0-39-3-uv-experiments
apm-v0-39-3-docs
pypi-apm-cli

Pinning apm per repo with uv

Reached from SKILL.md Step 1. apm has no apm.yml field for a minimum apm version, and upstream advises pinning apm outside the manifest. A uv pin gives every checkout of the repo the same apm and the same transitive dependencies, whatever is installed globally. apm's docs do not describe this method. It was tested with uv 0.11.24 and apm-cli 0.39.3.

Set up the pin

  1. Add this pyproject.toml at the repo root:

    [project]
    name = "<repo>-tooling"
    version = "0.0.0"
    requires-python = ">=3.11"
    dependencies = []
    
    [tool.uv]
    package = false
    
    [dependency-groups]
    dev = ["apm-cli==0.39.3"]
    
    • There is no [build-system], and package = false keeps uv from ever building the project, so uv installs only the dev group. uv sync installs that group by default.
    • >=3.11 is apm-cli's own floor.
    • Pin with ==. Choose 0.39.2 or later. Older versions refuse a lockfile that 0.39.2 or later rewrote.
    • If the repo already has a pyproject.toml for a real Python project, add apm-cli==<version> to a dependency group there. Do not add package = false to a project that builds.
  2. Run uv lock. Commit pyproject.toml and uv.lock, and gitignore .venv/. The lock hashes apm-cli and every transitive dependency.

  3. On each checkout, run uv sync --frozen once. The first sync on a machine needs the network, because a cold uv cache cannot download wheels offline.

  4. Run uv run --frozen apm install. The first install with apm 0.39 or later also needs the network once, to record commit verdicts.

  5. Check the version with uv run --frozen apm --version.

Run it

  • Spell every apm command in the repo as uv run --frozen apm <args>. --frozen runs from uv.lock as committed and never re-resolves it. It still syncs the environment to the lock first. After the one-time sync that costs nothing, and when a pull moves the pin it brings the environment up to the new version.
  • In a script that may run from a subdirectory, add --project <repo root>.
  • Offline, uv run --frozen --offline apm … works once the uv cache is warm, even with no .venv. With a cold cache it fails.
  • A hook with a short timeout must never sync. Use --no-sync --offline, and check first that .venv exists, because even --no-sync creates an empty one.

Upgrade the pin

Change the == version, then run uv lock and uv sync --frozen, and commit both files. Then follow apm's own upgrade notes for the versions crossed. Every machine and CI job that runs apm install or apm audit --ci on the repo's lockfile needs an apm at least as new as the one that last wrote it. apm audit --ci fails on lockfile fields it does not know.

Why not uvx or uv tool

  • uvx apm-cli@<version> pins only apm-cli. Its transitive dependencies float between runs and nothing is locked. A cache warmed by uv add also did not satisfy uvx --offline.
  • uv tool install apm-cli is machine-global, the same drift as a global pipx install under another name.

uv installs the apm tool and nothing else. Packages, skills and agents still come from apm install.

Worked example: one pinned repo, one unpinned

Repo A pins apm. The user asks to install the repo's apm dependencies. The root pyproject.toml has dev = ["apm-cli==0.39.3"], and uv.lock sits beside it.

  1. Detect the pin: grep -q '"apm-cli' pyproject.toml && test -f uv.lock.
  2. Run uv sync --frozen, the first time on this checkout.
  3. Run uv run --frozen apm --version. It prints 0.39.3.
  4. Run uv run --frozen apm install.

Wrong moves: a bare apm install, because the PATH apm may be 0.28.0, which refuses the v4 lock. pipx upgrade apm-cli, because that changes every repo on the machine. uvx [email protected] install, because its dependencies are unlocked.

Repo B does not pin apm. It has no pyproject.toml naming apm-cli, or no uv.lock.

  1. Run apm --version. If nothing answers, install apm globally (SKILL.md Step 2).
  2. If apm is older than the repo's lock needs (0.39.2 or later for a lock 0.39.2 or later wrote), upgrade the global apm, or propose a per-repo pin. Do not add the pin unasked: it is a repo change the user should approve.
  3. Run apm install.