Additional changes - Pin the cgroup CPU limit in the worker count test. - Delete the generated _autosummary folders before the Sphinx build; the pattern missed them. - Describe how to run pytest in the python-environment skill. - Set the clock of the full-charge deadline tests in Europe/Berlin; they failed on hosts with another DST change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: Claude Code (claude-opus-5-5)
3.1 KiB
name, description
| name | description |
|---|---|
| python-environment | Use before running any Python, uv, pytest, mypy, ruff, pre-commit or make command. Keeps the agent's virtual environment out of the workspace .venv. |
Python Environment
Why
The workspace may be shared with the developer's machine (e.g. a mounted
directory or a container). The workspace .venv then belongs to the developer
and is bound to an interpreter on their machine, which does not exist for the
agent. uv treats such a .venv as broken: it deletes and recreates it for
the agent's interpreter, which breaks the developer's environment, and the
developer's next uv call breaks the agent's in turn (e.g. dev tools such as
pytest or mypy go missing).
Rules
-
Never use, create, modify or delete the workspace
.venv. -
Use a virtual environment outside the workspace, selected by
UV_PROJECT_ENVIRONMENT. In the AI development sandbox (ai/) it is already set for every shell and tool call; check withecho "$UV_PROJECT_ENVIRONMENT". -
If it is not set, set it in every shell command that runs
uvormake, e.g.export UV_PROJECT_ENVIRONMENT="$HOME/.cache/eos-venv" && <command>. Exported variables do not carry over between separate tool calls. Put the environment on a disk with enough space (it needs several hundred MB), not on a small tmpfs such as/tmp. -
It applies to all commands that run Python through
uv:uv sync,uv run ...(pytest, mypy, python scripts,pre-commit), and themaketargets that useuv run(make mypy,make gen-docs,make test, ...). -
Create or update the environment with the dev tools:
uv sync --extra devA plain
uv sync(without--extra dev) removes pytest, mypy and the other dev tools from the environment. -
Do not let a newer local
uvrewriteuv.lock: useuv sync --frozen/uv run --frozen. When the lock must change (dependencies changed), lock with theuvversion CI uses (.github/workflows/pre-commit.yml), e.g.uv tool run --from uv==<version> uv lock, and check thatrevisioninuv.lockdid not change. -
Do not run commands that remove the workspace
.venv, e.g.make clean(rm -rf build .venv) orrm -rf .venv.
Running pytest
- Keep pytest's cache plugin: never pass
-p no:cacheprovider. The server tests (pytest-xprocess) keep their processes in the cache; without it the run stops with a usage error. To skip the server tests, deselect them with-m "not eos_server". - Pytest's temporary files go to
TMPDIR. In the sandbox/tmpis a 512 MB tmpfs that a full run fills: pointTMPDIRto a directory on disk, e.g.TMPDIR="$HOME/.cache/eos-pytest-tmp".
Verify
uv run python -c "import sys; print(sys.prefix)"prints the environment outside the workspace, not<workspace>/.venv.- If
uvreportsRemoved virtual environment at: .venvorIgnoring existing virtual environment linked to non-existent Python interpreter, the variable was not set: the workspace.venvwas rebuilt. Do not try to repair it; tell the developer to runuv sync --extra devon their machine.