build: hash the dependency lock and install it with --require-hashes

Aperta
#61 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, github-actions, python

Direzione di ricerca

Start with the header command in dokimi/requirements.lock.txt, then find the three install sites: the CI workflow steps, the dev target in the Makefile, and .agent-eval/Dockerfile. Before editing, decide how the unhashed tool pins (ruff, mypy) get hashes or their own hashed file, since --require-hashes rejects them. Done means the lock is regenerated with hashes, every install of it passes --require-hashes, and CI and make dev still install cleanly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

dokimi/requirements.lock.txt pins versions but not hashes, so pip install -r takes whatever the index serves for those versions. The lock is installed by:

  • CI: tests, mypy, benchmark, external catalog smoke
  • make dev
  • the repository-eval image in .agent-eval/Dockerfile (#57)

A swapped artifact on the index would go unnoticed in all three.

Proposal:

 # header command of requirements.lock.txt
-uv pip compile requirements.txt requirements-test.txt --universal --python-version=3.11 --exclude-newer=P7D --output-file=requirements.lock.txt
+uv pip compile requirements.txt requirements-test.txt --universal --python-version=3.11 --exclude-newer=P7D --generate-hashes --output-file=requirements.lock.txt

Every pip install -r requirements.lock.txt then adds --require-hashes, and so does uv pip install in make dev.

Things to check before merging:

  • Renovate's pip-compile manager re-runs the header command, so it keeps the hashes on refresh.
  • The tool pins installed next to the lock (pip install ruff mypy … in the workflows and the eval image) are not in it. With --require-hashes pip refuses unhashed requirements in the same command, so they need their own step or their own hashed file.

From review on #57 (jharlow-intel).

Lingua principale
Python
Stelle
9
Fork
9
Merge medio
1g 8h
PR unite (30g)
269

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di intel/dokimi

Tutte le issue di intel/dokimi

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.