REPO_POLICIES: Python test phase
check / check (push) Canceled after 0s

Cuts the Python make test recipe, which repeats the command in
examples/python-test-phase.Dockerfile, and lists how such a target
behaves on a host; drops the no-node sentence, stated under node and
yarn, and the shared-timeout sentence, which the example's comment
states; trims two sentences; every rule stays.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-16 23:45:32 +00:00
1 parent e3f3160fad
commit 57d993ca21
1 file changed
+18 -26
+18 -26
View File
@@ -450,6 +450,8 @@ style conventions are in separate documents:
cache alone, so it costs the runtime of the suite and no recompilation. cache alone, so it costs the runtime of the suite and no recompilation.
The cache is Go's own, separate from Docker's layer cache. The cache is Go's own, separate from Docker's layer cache.
## Python `test` phase
- **A Python `test` phase that installs its packages from `Pipfile.lock` does it - **A Python `test` phase that installs its packages from `Pipfile.lock` does it
before `COPY . .`, so check builds keep them.** The steps are: before `COPY . .`, so check builds keep them.** The steps are:
- `COPY script/ script/` - `COPY script/ script/`
@@ -482,9 +484,9 @@ style conventions are in separate documents:
`pipenv install --deploy` stops when the distribution's Python differs `pipenv install --deploy` stops when the distribution's Python differs
from it. from it.
- PyPI is not trusted, so `script/bootstrap` installs pipenv and its - PyPI is not trusted, so `script/bootstrap` installs pipenv and its
dependencies by hash. It does so with `pip install --require-hashes -r` dependencies by hash. It runs `pip install --require-hashes -r` on a
and a requirements file in `script/` that lists each of them with `==` and requirements file in `script/` that lists each of them with `==` and its
its `--hash`. pip refuses to install a dependency the file does not list. `--hash`. pip refuses to install a dependency the file does not list.
- `script/bootstrap` then runs `pipenv install --deploy`, with `--dev` when - `script/bootstrap` then runs `pipenv install --deploy`, with `--dev` when
the tests need the development packages. `--deploy` does all of these: the tests need the development packages. `--deploy` does all of these:
- installs only what `Pipfile.lock` names - installs only what `Pipfile.lock` names
@@ -494,14 +496,14 @@ style conventions are in separate documents:
pipenv passes it on to pip. A package with no ready-built wheel for the pipenv passes it on to pip. A package with no ready-built wheel for the
image then stops the install. Without the setting, pip builds that package image then stops the install. Without the setting, pip builds that package
from source and downloads the build tools without a hash check. from source and downloads the build tools without a hash check.
- A kept layer holds nothing a new install would refuse: pip checked the - A kept layer holds nothing a new install would refuse. pip checked the
hashes of pipenv and its dependencies, and pipenv checked the hashes of hashes of pipenv and its dependencies, and pipenv checked the hashes of
the lockfile's packages. pipenv creates its virtual environment with the the lockfile's packages. pipenv creates its virtual environment with the
`virtualenv` package. The packages that `virtualenv` adds come from wheels `virtualenv` package. The packages that `virtualenv` adds come from wheels
inside that package, so the hash pip checked for it covers them. System inside it, so the hash pip checked for it covers them. System packages,
packages, Python among them, are not fixed by a hash. They keep the Python among them, are not fixed by a hash. They keep the versions the
versions the package manager gave when the layer was built; a new install package manager gave when the layer was built; a new install may get newer
may get newer ones. ones.
- As with Go's modules, the packages are kept in a layer, not a cache mount. - As with Go's modules, the packages are kept in a layer, not a cache mount.
A cache mount is shared by every build on the host, and nothing checks its A cache mount is shared by every build on the host, and nothing checks its
files again. files again.
@@ -530,26 +532,16 @@ style conventions are in separate documents:
pipenv. pipenv.
In `examples/python-test-phase.Dockerfile`, `script/bootstrap` finds `make`, In `examples/python-test-phase.Dockerfile`, `script/bootstrap` finds `make`,
`git`, python and venv already installed. The example copies no `yarn.lock`, `git`, python and venv already installed. The Python `test` phase example is
so `script/bootstrap` installs no node and no yarn. The Python `test` phase at
example is at
`https://git.eeqj.de/sneak/prompts/raw/branch/main/examples/python-test-phase.Dockerfile`. `https://git.eeqj.de/sneak/prompts/raw/branch/main/examples/python-test-phase.Dockerfile`.
Python example: A `make test` target on a host that runs the command in
`examples/python-test-phase.Dockerfile`:
```makefile - does not stop on Ctrl-C. It goes on until the tests end or the 90 seconds
test: run out.
@timeout 90 sh -c 'pipenv run pytest || { \ - fails on a Mac without `timeout`, until it is installed.
echo "--- Rerunning with -v for details ---"; \ - needs `$HOME/.pipenv/bin` on `PATH`.
pipenv run pytest -v; exit 1; }'
```
Both pytest runs share that one 90-second timeout, as in the `prompts`
repo's `examples/python-test-phase.Dockerfile`, so a hang uses it once and
gets no rerun. Ctrl-C does not stop a running `make test`, which goes on
until the tests end or the 90 seconds run out. On a Mac without `timeout`,
the target fails until it is installed. On a host, the target needs
`$HOME/.pipenv/bin` on `PATH`.
- **A plain `docker build .` of a clone stamps the version that - **A plain `docker build .` of a clone stamps the version that
`git describe --tags --always` gives.** The version is derived from the `.git` `git describe --tags --always` gives.** The version is derived from the `.git`