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.
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
before `COPY . .`, so check builds keep them.** The steps are:
- `COPY script/ script/`
@@ -482,9 +484,9 @@ style conventions are in separate documents:
`pipenv install --deploy` stops when the distribution's Python differs
from it.
- PyPI is not trusted, so `script/bootstrap` installs pipenv and its
dependencies by hash. It does so with `pip install --require-hashes -r`
and a requirements file in `script/` that lists each of them with `==` and
its `--hash`. pip refuses to install a dependency the file does not list.
dependencies by hash. It runs `pip install --require-hashes -r` on a
requirements file in `script/` that lists each of them with `==` and its
`--hash`. pip refuses to install a dependency the file does not list.
- `script/bootstrap` then runs `pipenv install --deploy`, with `--dev` when
the tests need the development packages. `--deploy` does all of these:
- 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
image then stops the install. Without the setting, pip builds that package
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
the lockfile's packages. pipenv creates its virtual environment with the
`virtualenv` package. The packages that `virtualenv` adds come from wheels
inside that package, so the hash pip checked for it covers them. System
packages, Python among them, are not fixed by a hash. They keep the
versions the package manager gave when the layer was built; a new install
may get newer ones.
inside it, so the hash pip checked for it covers them. System packages,
Python among them, are not fixed by a hash. They keep the versions the
package manager gave when the layer was built; a new install may get newer
ones.
- 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
files again.
@@ -530,26 +532,16 @@ style conventions are in separate documents:
pipenv.
In `examples/python-test-phase.Dockerfile`, `script/bootstrap` finds `make`,
`git`, python and venv already installed. The example copies no `yarn.lock`,
so `script/bootstrap` installs no node and no yarn. The Python `test` phase
example is at
`git`, python and venv already installed. The Python `test` phase example is
at
`https://git.eeqj.de/sneak/prompts/raw/branch/main/examples/python-test-phase.Dockerfile`.
Python example:
```makefile
test:
@timeout 90 sh -c 'pipenv run pytest || { \
echo "--- Rerunning with -v for details ---"; \
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 `make test` target on a host that runs the command in
`examples/python-test-phase.Dockerfile`:
- does not stop on Ctrl-C. It goes on until the tests end or the 90 seconds
run out.
- fails on a Mac without `timeout`, until it is installed.
- needs `$HOME/.pipenv/bin` on `PATH`.
- **A plain `docker build .` of a clone stamps the version that
`git describe --tags --always` gives.** The version is derived from the `.git`