Author SHA1 Message Date
Defame1297 595f517b49 chore(apm): pin apm with uv
Build / build (pull_request) Successful in 28s
Molecule / select (pull_request) Successful in 5s
Lint / lint (pull_request) Successful in 4m16s
Molecule / scenarios (pull_request) Successful in 34m33s
Molecule / Result (pull_request) Successful in 1s
A bare `apm` is whatever version a machine has. apm 0.37.0 to 0.39.1
refuse an apm.lock.yaml rewritten by 0.39.2 or later, and versions before
0.39.0 drop `disable-model-invocation` from the deployed Claude commands.
uv now runs one pinned version, from a .venv of its own.

apm-cli leaves requirements-dev.txt, so there is one pin. Its lock loses 40
packages and no other version moves. apm.lock.yaml is regenerated with the
pinned apm.

Refs: #517
Assisted-by: Claude Code
2026-12-04 21:48:53 +00:00
Defame1297 d732ac0a71 Merge pull request 'chore(dev): move the dev tools from .venv to .venv-dev' (#519) from chore/516-venv-dev into main
Reviewed-on: #519
Reviewed-by: Defame1297 <[email protected]>
2026-12-04 21:16:58 +00:00
Defame1297 f62097a748 chore(dev): move the dev tools from .venv to .venv-dev
Build / build (pull_request) Successful in 34s
Molecule / select (pull_request) Successful in 3s
Molecule / scenarios (pull_request) Skipped
Molecule / Result (pull_request) Successful in 1s
Lint / lint (pull_request) Successful in 1m49s
uv uses .venv as its project environment, and `uv sync --frozen` removes
every package that is not in uv.lock. The tools the git hooks need would
go with it, so they get a directory of their own.

Re-running scripts/dev-setup.sh switches the hooks of an older clone and
leaves its .venv alone. Ignore rules and prunes cover both directories.

Refs: #516
Assisted-by: Claude Code
2026-12-04 20:45:49 +00:00
22 changed files with 2045 additions and 1216 deletions

No files matched your search

+1
View File
@@ -6,6 +6,7 @@ profile: production
exclude_paths: exclude_paths:
- .gitea - .gitea
- .venv - .venv
- .venv-dev
- apm_modules - apm_modules
- apm.lock.yaml - apm.lock.yaml
- changelogs - changelogs
+3 -3
View File
@@ -94,13 +94,13 @@ jobs:
# ansible-galaxy dereferences symlinks when it builds, so a symlink in the source tree # ansible-galaxy dereferences symlinks when it builds, so a symlink in the source tree
# reaches the archive as a regular file with the target's content, where # reaches the archive as a regular file with the target's content, where
# scripts/check_tarball.py cannot see it. Refuse them in the tree instead: this step # scripts/check_tarball.py cannot see it. Refuse them in the tree instead: this step
# is the only guard against a file symlink. The two -prune paths below (./.venv, # is the only guard against a file symlink. The -prune paths below (./.git, ./.venv,
# ./.git) are skipped only because the build skips them too (galaxy.yml build_ignore, # ./.venv-dev) are skipped only because the build skips them too (galaxy.yml build_ignore,
# and ansible-galaxy's own .git exclusion): the two lists must stay in step, and # and ansible-galaxy's own .git exclusion): the two lists must stay in step, and
# tests/scripts/test_check_tarball.py fails when a pruned directory is not ignored. # tests/scripts/test_check_tarball.py fails when a pruned directory is not ignored.
- name: Refuse symlinks in the source tree - name: Refuse symlinks in the source tree
run: | run: |
links="$(find . -path ./.git -prune -o -path ./.venv -prune -o -type l -print)" links="$(find . -path ./.git -prune -o -path ./.venv -prune -o -path ./.venv-dev -prune -o -type l -print)"
if [ -n "$links" ]; then if [ -n "$links" ]; then
echo "::error::symlinks in the source tree would be dereferenced into the Collection archive:" echo "::error::symlinks in the source tree would be dereferenced into the Collection archive:"
echo "$links" echo "$links"
+1
View File
@@ -1,6 +1,7 @@
# Built collection archives and local tooling # Built collection archives and local tooling
*.tar.gz *.tar.gz
/.venv/ /.venv/
/.venv-dev/
/venv/ /venv/
__pycache__/ __pycache__/
*.pyc *.pyc
+1
View File
@@ -3,6 +3,7 @@ extends: default
ignore: | ignore: |
.venv/** .venv/**
.venv-dev/**
apm_modules/** apm_modules/**
# Generated by apm install; its list indentation fails the rules below. # Generated by apm install; its list indentation fails the rules below.
apm.lock.yaml apm.lock.yaml
+2
View File
@@ -34,4 +34,6 @@ GLOSSARY\\.md @Defame1297
\\.claude/.* @Defame1297 \\.claude/.* @Defame1297
apm\\.yml @Defame1297 apm\\.yml @Defame1297
apm\\.lock\\.yaml @Defame1297 apm\\.lock\\.yaml @Defame1297
pyproject\\.toml @Defame1297
uv\\.lock @Defame1297
\\.mcp\\.json @Defame1297 \\.mcp\\.json @Defame1297
+6 -6
View File
@@ -1,6 +1,6 @@
lockfile_version: '4' lockfile_version: '4'
generated_at: '2026-11-29T13:12:37.842657+00:00' generated_at: '2026-12-04T21:33:07.493501+00:00'
apm_version: 0.38.1 apm_version: 0.39.3
manifest_targets: manifest_targets:
- claude - claude
dependencies: dependencies:
@@ -220,8 +220,8 @@ dependencies:
.claude/agents/plan-researcher.md: sha256:eda0457d2007cf0c6cb4745383a0369d03a26ed252d7251a1f5250003a89ef85 .claude/agents/plan-researcher.md: sha256:eda0457d2007cf0c6cb4745383a0369d03a26ed252d7251a1f5250003a89ef85
.claude/agents/plan-validator.md: sha256:a56e7a710fd9e7a9dd9e2601f1f2701b98fd229f3e014bba4bda4dfe5977ecae .claude/agents/plan-validator.md: sha256:a56e7a710fd9e7a9dd9e2601f1f2701b98fd229f3e014bba4bda4dfe5977ecae
.claude/commands/next.md: sha256:8e16330ec0f16dbbc86d44fca94699e33e393c9a8af76f45d3f3bd2b9c8bfa1f .claude/commands/next.md: sha256:8e16330ec0f16dbbc86d44fca94699e33e393c9a8af76f45d3f3bd2b9c8bfa1f
.claude/commands/plan.md: sha256:2538b3dbb3860ebe93a39cad95cd5a1adcbeded19f404a84201b3e8aa7ce91c7 .claude/commands/plan.md: sha256:c5216fb6c443ca9de45ad5cb69351a4e3193bcb5ffca4d59567495fcb5d7ec71
.claude/commands/ship.md: sha256:f108f73e60a884f46285955027fba47d6309fed6a89812948f577e27be180af8 .claude/commands/ship.md: sha256:c3c9f516b9b01cb7f879d7d331187b12f697f73104b0eafdc813d64b73091284
.claude/skills/plan-track/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525 .claude/skills/plan-track/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
.claude/skills/plan-track/SKILL.md: sha256:fee5062c8c63b49f66368b290c8ebd8cfff744137670d0c037da1a49c455c047 .claude/skills/plan-track/SKILL.md: sha256:fee5062c8c63b49f66368b290c8ebd8cfff744137670d0c037da1a49c455c047
.claude/skills/research-docs/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525 .claude/skills/research-docs/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
@@ -843,7 +843,7 @@ deployments:
owners: owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan - git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:2538b3dbb3860ebe93a39cad95cd5a1adcbeded19f404a84201b3e8aa7ce91c7 content_hash: sha256:c5216fb6c443ca9de45ad5cb69351a4e3193bcb5ffca4d59567495fcb5d7ec71
- kind: project-relative - kind: project-relative
target: claude target: claude
value: .claude/commands/ship.md value: .claude/commands/ship.md
@@ -852,7 +852,7 @@ deployments:
owners: owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan - git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:f108f73e60a884f46285955027fba47d6309fed6a89812948f577e27be180af8 content_hash: sha256:c3c9f516b9b01cb7f879d7d331187b12f697f73104b0eafdc813d64b73091284
- kind: project-relative - kind: project-relative
target: claude target: claude
value: .claude/skills/code-review value: .claude/skills/code-review
+7 -1
View File
@@ -9,7 +9,7 @@ held by review until an offline link check exists.
## The clone ## The clone
- **Run `scripts/dev-setup.sh` once per clone, and again after a change to `requirements-dev.txt`, its - **Run `scripts/dev-setup.sh` once per clone, and again after a change to `requirements-dev.txt`, its
lock `requirements-dev.lock`, `requirements.yml` or the hook types.** It creates `.venv` with the lock `requirements-dev.lock`, `requirements.yml` or the hook types.** It creates `.venv-dev` with the
pinned tools on the Python named in `.python-version`, installs the collections of `requirements.yml` pinned tools on the Python named in `.python-version`, installs the collections of `requirements.yml`
into `.ansible/collections`, and installs the git hooks (pre-commit, commit-msg, pre-push) with the into `.ansible/collections`, and installs the git hooks (pre-commit, commit-msg, pre-push) with the
virtualenv first on their `PATH`. virtualenv first on their `PATH`.
@@ -63,6 +63,12 @@ held by review until an offline link check exists.
pushed on an unmerged branch lets that branch's commands run without a prompt before anyone has pushed on an unmerged branch lets that branch's commands run without a prompt before anyone has
reviewed it, while a `deny` or `ask` rule can only add prompts. reviewed it, while a `deny` or `ask` rule can only add prompts.
*Held by:* review (`.claude/` is under `CODEOWNERS`). *Held by:* review (`.claude/` is under `CODEOWNERS`).
- **Install [uv](https://docs.astral.sh/uv/getting-started/installation/), run `uv sync --frozen` once per
clone and again after a change to `uv.lock`, and run apm only as `uv run --frozen apm ...`** (for example
`uv run --frozen apm install`). uv keeps apm in `.venv`, apart from the tools in `.venv-dev`.
*Reason:* a bare `apm` is whatever version your machine has, and versions differ in which
`apm.lock.yaml` they accept and in what they deploy.
*Held by:* aspirational.
- **Every hook in the tracked `.claude/settings.json` arrives through apm; personal hooks go in - **Every hook in the tracked `.claude/settings.json` arrives through apm; personal hooks go in
`.claude/settings.local.json`.** `.claude/settings.local.json`.**
*Reason:* a hook nobody owns is checked by nothing. *Reason:* a hook nobody owns is checked by nothing.
+3
View File
@@ -46,6 +46,7 @@ build_ignore:
- .python-version - .python-version
- .ruff_cache - .ruff_cache
- .venv - .venv
- .venv-dev
- .yamllint - .yamllint
- docs - docs
- .ansible-lint - .ansible-lint
@@ -59,6 +60,7 @@ build_ignore:
- images - images
- scripts - scripts
- tests/scripts - tests/scripts
- pyproject.toml
- renovate.json - renovate.json
- ruff.toml - ruff.toml
- requirements-dev.txt - requirements-dev.txt
@@ -66,6 +68,7 @@ build_ignore:
- requirements-molecule.txt - requirements-molecule.txt
- requirements-molecule.lock - requirements-molecule.lock
- requirements.yml - requirements.yml
- uv.lock
- gitleaks-report.json - gitleaks-report.json
- importer_result.json - importer_result.json
- 'roles/*/molecule' - 'roles/*/molecule'
+2 -2
View File
@@ -14,7 +14,7 @@
# distribution's python3 and ca-certificates. # distribution's python3 and ca-certificates.
# - /opt/venv: requirements-dev.lock, the hashed lock of requirements-dev.txt (ansible-core, ansible-lint, pre-commit, # - /opt/venv: requirements-dev.lock, the hashed lock of requirements-dev.txt (ansible-core, ansible-lint, pre-commit,
# antsibull-changelog, galaxy-importer, reuse, molecule, proxmoxer), on the Python of # antsibull-changelog, galaxy-importer, reuse, molecule, proxmoxer), on the Python of
# .python-version (PYTHON_VERSION below), the one the lock was resolved on and a clone's .venv uses. # .python-version (PYTHON_VERSION below), the one the lock was resolved on and a clone's .venv-dev uses.
# molecule is there for Lint's "Test the repository scripts" step, whose molecule tests import it; its # molecule is there for Lint's "Test the repository scripts" step, whose molecule tests import it; its
# Docker driver and community.docker are not: Molecule runs in the molecule-controller image. # Docker driver and community.docker are not: Molecule runs in the molecule-controller image.
# - /opt/collections: the collections of requirements.yml (the versions the roles are # - /opt/collections: the collections of requirements.yml (the versions the roles are
@@ -71,7 +71,7 @@ COPY requirements-dev.txt requirements-dev.lock requirements.yml .pre-commit-con
# The interpreters come first: /opt/venv is built from the pinned one (PYTHON_VERSION, kept equal to # The interpreters come first: /opt/venv is built from the pinned one (PYTHON_VERSION, kept equal to
# .python-version and to the lock header by `check_image_versions.py pins`), not from the distribution's # .python-version and to the lock header by `check_image_versions.py pins`), not from the distribution's
# python3, so the tools run on the Python the lock was resolved on and a clone's .venv uses. # python3, so the tools run on the Python the lock was resolved on and a clone's .venv-dev uses.
# uv only lives in the build stage (its own venv): the final image keeps the interpreters it # uv only lives in the build stage (its own venv): the final image keeps the interpreters it
# downloaded, not the installer. The distribution's python3 only bootstraps uv. # downloaded, not the installer. The distribution's python3 only bootstraps uv.
RUN python3 -m venv /opt/uv-venv \ RUN python3 -m venv /opt/uv-venv \
+12
View File
@@ -0,0 +1,12 @@
# Pins apm for contributors (docs/contributing/setup.md). The Lint and Build tools are pinned in requirements-dev.txt.
[project]
name = "kamino"
version = "0"
# ruff reads this floor too: a higher one makes it reformat existing files.
requires-python = ">=3.11"
[dependency-groups]
dev = ["apm-cli==0.39.3"]
[tool.uv]
package = false
-1
View File
@@ -196,7 +196,6 @@
"pypi" "pypi"
], ],
"matchPackageNames": [ "matchPackageNames": [
"apm-cli",
"antsibull-changelog", "antsibull-changelog",
"galaxy-importer", "galaxy-importer",
"reuse", "reuse",
+6 -1180
View File
File diff suppressed because it is too large. Load diff
+1 -4
View File
@@ -1,5 +1,5 @@
# Pinned tooling for Lint and Build, used by CI (.gitea/workflows) and locally: # Pinned tooling for Lint and Build, used by CI (.gitea/workflows) and locally:
# python3 -m venv .venv && . .venv/bin/activate && pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt # python3 -m venv .venv-dev && . .venv-dev/bin/activate && pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt
# This file holds the direct pins; requirements-dev.lock is their hashed lock (every transitive # This file holds the direct pins; requirements-dev.lock is their hashed lock (every transitive
# package too, with the sha256 of each release file) and is what gets installed; pip refuses an # package too, with the sha256 of each release file) and is what gets installed; pip refuses an
# install in which the two files disagree. Renovate bumps a pin here and regenerates the lock # install in which the two files disagree. Renovate bumps a pin here and regenerates the lock
@@ -18,6 +18,3 @@ molecule==26.11.1
# proxmoxer: the controller-side library community.proxmox's modules import (they refuse anything below 2.3), # proxmoxer: the controller-side library community.proxmox's modules import (they refuse anything below 2.3),
# so lint runs where a consumer's controller would. # so lint runs where a consumer's controller would.
proxmoxer==2.3.0 proxmoxer==2.3.0
# apm-cli: for changing apm.yml (run apm install, commit the lock). Keep it at 0.36.1 or later (#252):
# before 0.29.0, `apm audit --ci` compares the whole .claude/settings.json and fails on any hand-written key.
apm-cli==0.39.1
+1 -1
View File
@@ -19,7 +19,7 @@ cd "$root"
for tool in ansible ansible-test; do for tool in ansible ansible-test; do
if ! command -v "$tool" >/dev/null 2>&1; then if ! command -v "$tool" >/dev/null 2>&1; then
echo "error: $tool is not on PATH; run scripts/dev-setup.sh and use its virtualenv (.venv/bin)" >&2 echo "error: $tool is not on PATH; run scripts/dev-setup.sh and use its virtualenv (.venv-dev/bin)" >&2
exit 1 exit 1
fi fi
done done
+1 -1
View File
@@ -27,7 +27,7 @@ allow list. It fails the build for:
ansible-galaxy dereferences FILE symlinks while building, so a symlink to a file reaches ansible-galaxy dereferences FILE symlinks while building, so a symlink to a file reaches
the archive as a regular file with the target's content and this check cannot see it. The the archive as a regular file with the target's content and this check cannot see it. The
`Refuse symlinks in the source tree` step of .gitea/workflows/build.yml is the only guard `Refuse symlinks in the source tree` step of .gitea/workflows/build.yml is the only guard
against that. Its `find` prunes ./.venv and ./.git only because both are in galaxy.yml against that. Its `find` prunes ./.git, ./.venv and ./.venv-dev only because they are in galaxy.yml
`build_ignore` (or excluded by ansible-galaxy itself, as .git is): the two lists must stay `build_ignore` (or excluded by ansible-galaxy itself, as .git is): the two lists must stay
in step, and tests/scripts/test_check_tarball.py fails when a pruned directory is not in step, and tests/scripts/test_check_tarball.py fails when a pruned directory is not
ignored by the build. ignored by the build.
+9 -9
View File
@@ -26,7 +26,7 @@ set -euo pipefail
# The repository is derived from this script's own location (symlinks resolved), never # The repository is derived from this script's own location (symlinks resolved), never
# from the caller's working directory: running it from another repository must not # from the caller's working directory: running it from another repository must not
# create or remove that repository's .venv. # create or remove that repository's .venv-dev.
script="$(readlink -f "${BASH_SOURCE[0]}")" script="$(readlink -f "${BASH_SOURCE[0]}")"
root="$(git -C "$(dirname "$script")/.." rev-parse --show-toplevel)" root="$(git -C "$(dirname "$script")/.." rev-parse --show-toplevel)"
cd "$root" cd "$root"
@@ -122,19 +122,19 @@ if still="$(git -C "$root" config --get core.hooksPath)" && [ -n "$still" ]; the
fi fi
# A virtualenv made by an older Python is rebuilt rather than reused. # A virtualenv made by an older Python is rebuilt rather than reused.
if [ -x .venv/bin/python ] && ! .venv/bin/python -c "$py_ok" 2>/dev/null; then if [ -x .venv-dev/bin/python ] && ! .venv-dev/bin/python -c "$py_ok" 2>/dev/null; then
rm -rf "$root/.venv" rm -rf "$root/.venv-dev"
fi fi
[ -x .venv/bin/python ] || "$python" -m venv .venv [ -x .venv-dev/bin/python ] || "$python" -m venv .venv-dev
.venv/bin/pip install --quiet --disable-pip-version-check --require-hashes -r requirements-dev.lock -r requirements-dev.txt .venv-dev/bin/pip install --quiet --disable-pip-version-check --require-hashes -r requirements-dev.lock -r requirements-dev.txt
.venv/bin/pre-commit install --install-hooks .venv-dev/bin/pre-commit install --install-hooks
# The collections of requirements.yml, exactly as pinned, into this clone (.ansible/ is ignored by # The collections of requirements.yml, exactly as pinned, into this clone (.ansible/ is ignored by
# git and by the Collection build). ANSIBLE_COLLECTIONS_PATH is set to the target for the install: # git and by the Collection build). ANSIBLE_COLLECTIONS_PATH is set to the target for the install:
# a copy found elsewhere (~/.ansible/collections) would be skipped as already installed. # a copy found elsewhere (~/.ansible/collections) would be skipped as already installed.
collections="$root/.ansible/collections" collections="$root/.ansible/collections"
mkdir -p "$collections" mkdir -p "$collections"
ANSIBLE_COLLECTIONS_PATH="$collections" .venv/bin/ansible-galaxy collection install \ ANSIBLE_COLLECTIONS_PATH="$collections" .venv-dev/bin/ansible-galaxy collection install \
-r requirements.yml -p "$collections" -r requirements.yml -p "$collections"
marker="# kamino-dev-setup: virtualenv first on PATH" marker="# kamino-dev-setup: virtualenv first on PATH"
@@ -150,7 +150,7 @@ for hook in pre-commit commit-msg pre-push; do
{ {
head -n 1 "$file" head -n 1 "$file"
# %q shell-quotes the path: a repository path with spaces, quotes or $(...) is data. # %q shell-quotes the path: a repository path with spaces, quotes or $(...) is data.
printf '%s\n' "$marker" "export PATH=$(printf '%q' "$root/.venv/bin"):\"\$PATH\"" printf '%s\n' "$marker" "export PATH=$(printf '%q' "$root/.venv-dev/bin"):\"\$PATH\""
tail -n +2 "$file" tail -n +2 "$file"
} > "$tmp" } > "$tmp"
cat "$tmp" > "$file" # keeps the file mode of the hook cat "$tmp" > "$file" # keeps the file mode of the hook
@@ -179,4 +179,4 @@ else
fi fi
fi fi
echo "Done: git commit now runs the hooks with the tools in $root/.venv/bin and the collections in $collections." echo "Done: git commit now runs the hooks with the tools in $root/.venv-dev/bin and the collections in $collections."
+1 -1
View File
@@ -11,7 +11,7 @@
# Needs the network (PyPI) and the Python of .python-version (python<MINOR>; KAMINO_PYTHON overrides it): the # Needs the network (PyPI) and the Python of .python-version (python<MINOR>; KAMINO_PYTHON overrides it): the
# header of the lock records it, and check_image_versions.py pins fails when it differs. # header of the lock records it, and check_image_versions.py pins fails when it differs.
# pip and pip-tools are installed, at the pinned versions below, into a throwaway virtualenv, never # pip and pip-tools are installed, at the pinned versions below, into a throwaway virtualenv, never
# into the project's .venv. pip is pinned too: pip-tools breaks on newer pip releases (7.5.2 on pip 26). Commit # into the project's .venv-dev. pip is pinned too: pip-tools breaks on newer pip releases (7.5.2 on pip 26). Commit
# the lock with its requirements file; pip refuses an install of the two when they disagree # the lock with its requirements file; pip refuses an install of the two when they disagree
# (`pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt`). # (`pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt`).
# The pins are not hash-checked themselves: they come from PyPI over TLS, like the pip that # The pins are not hash-checked themselves: they come from PyPI over TLS, like the pip that
+2
View File
@@ -92,6 +92,8 @@ IGNORED = (
"ruff.toml", "ruff.toml",
"apm.yml", "apm.yml",
"apm.lock.yaml", "apm.lock.yaml",
"pyproject.toml",
"uv.lock",
".claude/*", ".claude/*",
"tests/sanity/*", "tests/sanity/*",
"tests/scripts/*", "tests/scripts/*",
+1 -1
View File
@@ -267,7 +267,7 @@ class CraftedTarballTest(unittest.TestCase):
REPO, REPO,
src, src,
ignore=shutil.ignore_patterns( ignore=shutil.ignore_patterns(
".git", ".venv", "__pycache__", "output", "*.tar.gz" ".git", ".venv", ".venv-dev", "__pycache__", "output", "*.tar.gz"
), ),
) )
out = pathlib.Path(self.tmp.name) / "dist" out = pathlib.Path(self.tmp.name) / "dist"
+30 -6
View File
@@ -192,7 +192,7 @@ class DevSetupTest(unittest.TestCase):
proc = self.run_setup(repo, KAMINO_PYTHON=str(wrong)) proc = self.run_setup(repo, KAMINO_PYTHON=str(wrong))
self.assertNotEqual(proc.returncode, 0) self.assertNotEqual(proc.returncode, 0)
self.assertIn("is not Python 3.13 (.python-version)", proc.stderr) self.assertIn("is not Python 3.13 (.python-version)", proc.stderr)
self.assertFalse((repo / ".venv").exists()) self.assertFalse((repo / ".venv-dev").exists())
def test_an_interpreter_of_another_minor_is_refused_and_the_pinned_one_accepted( def test_an_interpreter_of_another_minor_is_refused_and_the_pinned_one_accepted(
self, self,
@@ -201,10 +201,10 @@ class DevSetupTest(unittest.TestCase):
proc = self.run_setup(repo, STUB_PY_MINOR="3.12") proc = self.run_setup(repo, STUB_PY_MINOR="3.12")
self.assertNotEqual(proc.returncode, 0) self.assertNotEqual(proc.returncode, 0)
self.assertIn("is not Python 3.13 (.python-version)", proc.stderr) self.assertIn("is not Python 3.13 (.python-version)", proc.stderr)
self.assertFalse((repo / ".venv").exists()) self.assertFalse((repo / ".venv-dev").exists())
proc = self.run_setup(repo, STUB_PY_MINOR="3.13") proc = self.run_setup(repo, STUB_PY_MINOR="3.13")
self.assertEqual(proc.returncode, 0, proc.stderr) self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertTrue((repo / ".venv").is_dir()) self.assertTrue((repo / ".venv-dev").is_dir())
def test_a_missing_pin_file_is_refused_with_a_message(self) -> None: def test_a_missing_pin_file_is_refused_with_a_message(self) -> None:
repo = self.make_repo() repo = self.make_repo()
@@ -228,6 +228,30 @@ class DevSetupTest(unittest.TestCase):
text = self.hook(repo, name).read_text() text = self.hook(repo, name).read_text()
self.assertIn("# kamino-dev-setup: virtualenv first on PATH", text) self.assertIn("# kamino-dev-setup: virtualenv first on PATH", text)
self.assertEqual(self.hooks_z(repo), b"") self.assertEqual(self.hooks_z(repo), b"")
self.assertFalse((repo / ".venv").exists())
def test_a_rerun_moves_the_hooks_of_an_older_setup_to_venv_dev(self) -> None:
repo = self.make_repo()
kept = repo / ".venv" / "kept"
kept.parent.mkdir()
kept.write_text("")
names = ("pre-commit", "commit-msg", "pre-push")
for name in names:
hook = self.hook(repo, name)
hook.parent.mkdir(exist_ok=True)
hook.write_text(
"#!/usr/bin/env bash\n"
"# kamino-dev-setup: virtualenv first on PATH\n"
f'export PATH={repo}/.venv/bin:"$PATH"\n'
)
hook.chmod(0o755)
result = self.run_setup(repo)
self.assertEqual(result.returncode, 0, result.stderr)
for name in names:
text = self.hook(repo, name).read_text()
self.assertIn(f'export PATH={repo}/.venv-dev/bin:"$PATH"\n', text)
self.assertNotIn("/.venv/bin", text)
self.assertTrue(kept.exists())
def test_a_missing_tea_warns_and_setup_succeeds(self) -> None: def test_a_missing_tea_warns_and_setup_succeeds(self) -> None:
repo = self.make_repo() repo = self.make_repo()
@@ -403,12 +427,12 @@ class DevSetupTest(unittest.TestCase):
self.git(other, "init", "--quiet") self.git(other, "init", "--quiet")
result = self.run_setup(repo, cwd=other) result = self.run_setup(repo, cwd=other)
self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(result.returncode, 0, result.stderr)
self.assertFalse((other / ".venv").exists()) self.assertFalse((other / ".venv-dev").exists())
self.assertEqual( self.assertEqual(
os.listdir(other / ".git" / "hooks"), os.listdir(other / ".git" / "hooks"),
[n for n in os.listdir(other / ".git" / "hooks") if n.endswith(".sample")], [n for n in os.listdir(other / ".git" / "hooks") if n.endswith(".sample")],
) )
self.assertTrue((repo / ".venv").is_dir()) self.assertTrue((repo / ".venv-dev").is_dir())
self.assertTrue(self.hook(repo).exists()) self.assertTrue(self.hook(repo).exists())
def test_crafted_repository_path_is_not_executed(self) -> None: def test_crafted_repository_path_is_not_executed(self) -> None:
@@ -428,7 +452,7 @@ class DevSetupTest(unittest.TestCase):
self.assertEqual(hook.returncode, 0, hook.stderr) self.assertEqual(hook.returncode, 0, hook.stderr)
lines = hook.stdout.splitlines() lines = hook.stdout.splitlines()
self.assertEqual(lines[0], "hook-ran") self.assertEqual(lines[0], "hook-ran")
self.assertTrue(lines[1].startswith(f"{repo}/.venv/bin:"), lines[1]) self.assertTrue(lines[1].startswith(f"{repo}/.venv-dev/bin:"), lines[1])
for place in (workdir, repo, self.tmp, Path.cwd()): for place in (workdir, repo, self.tmp, Path.cwd()):
self.assertFalse((place / "PWNED").exists(), place) self.assertFalse((place / "PWNED").exists(), place)
self.assertFalse((place / "PWNED2").exists(), place) self.assertFalse((place / "PWNED2").exists(), place)
@@ -217,6 +217,10 @@ class SelectTest(unittest.TestCase):
chosen, _reason = self.select(["requirements-dev.txt", "requirements-dev.lock"]) chosen, _reason = self.select(["requirements-dev.txt", "requirements-dev.lock"])
self.assertEqual(chosen, []) self.assertEqual(chosen, [])
def test_the_apm_pin_selects_nothing(self):
chosen, _reason = self.select(["pyproject.toml", "uv.lock"])
self.assertEqual(chosen, [])
def test_molecule_requirements_select_everything(self): def test_molecule_requirements_select_everything(self):
# An ansible-core or molecule bump there changes the tools every scenario runs with. # An ansible-core or molecule bump there changes the tools every scenario runs with.
for path in ("requirements-molecule.txt", "requirements-molecule.lock"): for path in ("requirements-molecule.txt", "requirements-molecule.lock"):
Generated
+1951
View File
File diff suppressed because it is too large. Load diff