world: install legion at a pinned commit instead of vendoring it
What
The world image installs legion from GitHub at the pinned commit 803873b ("Rename flock to legion (#135)") instead of carrying a copy of 16 of its files. world/src/, world/vendor.sh and world/source-lock.json are deleted.
Why
legion is public now. Installing the exact commit replaces the copy, its sha256 lock and the re-vendoring script, and a bump becomes one changed line plus a regenerated requirements.txt.
How
world/Dockerfileinstallslegion @ git+https://github.com/huggingface/legion@803873b…with--no-deps, in its ownpip installafter the hashedrequirements.txt. pip refuses VCS requirements in--require-hashesmode, so the full commit SHA is what pins legion's source. pip builds the wheel with an unpinned hatchling in build isolation, and none of it stays in the image. That line is the only place the pin lives.requirements.txtis unchanged: re-exporting legion'suv.lockat803873bwith vendor.sh'suv exportcommand gives the same bytes.entrypoint.shunsetsPYTHONPATHinstead of setting it tosrc/, so a hostPYTHONPATH(pyxis) still can't shadow the image's legion. The image dropsENV PYTHONPATH, and the sidecar'spython sandbox.py servefinds legion in site-packages.tests/conftest.pyand bothscripts/put onlyworld/onsys.path, and their sidecar subprocesses no longer get aPYTHONPATH.- README: updated file table, a new "The legion pin" section (where the commit lives, how to bump it), and Checks installs legion from the Dockerfile's line.
- No changes to
pybot.py,repository.py,sandbox.py,snapshot.py, the seed or the task. Bots still run underpython -I -Swithpython_only=Trueisolation, so legion's new location doesn't change the sandbox's mounts.
Testing
Before editing, I checked that main's 16 vendored files (c786dae) match legion at 803873b and the sha256s in source-lock.json. The installed package matches too.
Both runs use Python 3.12.16 with pip install --no-deps --require-hashes -r requirements.txt. The "after" run also installs legion the way the Dockerfile does.
before (vendored, c786dae) |
after | |
|---|---|---|
python -m pytest -n 8 |
142 passed | 142 passed |
scripts/smoke-local.py --sidecar |
ok | ok |
scripts/smoke-local.py |
ok; run_bot note (no unshare here) |
same |
scripts/check-sidecar.py |
PASS | PASS |
- Entrypoint with a host
PYTHONPATHset to the oldsrc/:pybot.pystarts withPYTHONPATHunset and imports the installed legion (checked with a stubpython). - Without legion installed, the tests stop at collection with
No module named 'legion'. - Not tried: building the image (no docker or podman available), or a real run on HF Jobs or Slurm.
Known gaps
- Follow-up in legion:
experiments/pybot/spec.yamltakes the pybotrevisionfromPYBOT_TASK_REVISION, which legion PR #136 documents asc786dae. Bump it to this PR's merge commit once this is merged.
🤖 Generated with Claude Code