micropip: Micropip.freeze no work?

pip install pyodide-build
pyodide venv .venv-pyodide
.venv-pyodide/bin/pip install fastapi
.venv-pyodide/bin/python -c 'import micropip; print(micropip.freeze(), file=open("pyodide-lock.json","w"))'
.venv-pyodide/bin/pip freeze | grep fastapi # finds fastapi
cat pyodide-lock.json | grep fastapi # no fastapi??

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

There is uh no written spec. We should write one and probably add it somewhere to the Pyodide packaging docs.

The situation with file_name is that it is all based around this line here: https://github.com/pyodide/pyodide/blob/main/src/js/load-package.ts?plain=1#L310

installBaseUrl is generally https://cdn.jsdelivr.net/pyodide/0.25.1/full/ and fileName is something like numpy-1.26.4-cp312-cp312-pyodide_2024_0_wasm32.whl.

Then people were installing wheels from other sources with micropip using its slow and incorrect resolver, I was upset by this and wanted a way to lock additional wheels. Because of the way resolvePath works, if fileName is a url, then installBaseUrl is ignored and it returns fileName. At least in the browser, there may be correctness bugs in node or other runtimes. Test coverage is incomplete here.

So after this the field contains either a file name if it’s from the jsdelivr cdn or a fully qualified url. Working from an implementation detail of the installer. We should clean this up.