Currently, pytest-pyodide takes --dist-dir option, and all the Pyodide distribution should be in that directory, including
- pyodide core:
pyodide.js, pyodide.asm.js, pyodide.asm.wasm, ...
- pyodide packages:
pyodide-lock.json and wheel files.
However, as we move more and more toward out-of-tree builds, there is sometimes a distinction between where the pyodide core resides and where packages reside.
For instance, consider building recipes out-of-tree in pyodide-recipes repository. The xbuildenv used to build packages contains pyodide-core files, and it will be stored in the user cache directory, while the built packages will be stored in dist.
To test against the built packages, for now, we need to copy-paste the pyodide core files into the dist directory, which isn't very convenient.
So I think it would be nice to add a flag for both pyodide core directory and lockfile directory. Note that we already have lockfileURL parameter in loadPyodide, so no changes in the runtime would be required.
Suggested Changes
- (pyodide-build) Add
pyodide config dist_path, which returns the path to the pyodide dist directory inside the xbuildenv
- (pytest-pyodide) Add
--lockfile-dir option, which defaults to equivalent to --dist-dir.
- When given, it should be passed to
lockflieURL parameter when calling loadPyodide.
- Also, other codes that use
dist_dir might needs to be changed to use lockfile_dir instead (e.g. in package_is_built)
Currently,
pytest-pyodidetakes--dist-diroption, and all the Pyodide distribution should be in that directory, includingpyodide.js,pyodide.asm.js,pyodide.asm.wasm, ...pyodide-lock.jsonand wheel files.However, as we move more and more toward out-of-tree builds, there is sometimes a distinction between where the pyodide core resides and where packages reside.
For instance, consider building recipes out-of-tree in
pyodide-recipesrepository. The xbuildenv used to build packages contains pyodide-core files, and it will be stored in the user cache directory, while the built packages will be stored indist.To test against the built packages, for now, we need to copy-paste the pyodide core files into the
distdirectory, which isn't very convenient.So I think it would be nice to add a flag for both pyodide core directory and lockfile directory. Note that we already have
lockfileURLparameter inloadPyodide, so no changes in the runtime would be required.Suggested Changes
pyodide config dist_path, which returns the path to the pyodide dist directory inside the xbuildenv--lockfile-diroption, which defaults to equivalent to--dist-dir.lockflieURLparameter when calling loadPyodide.dist_dirmight needs to be changed to uselockfile_dirinstead (e.g. inpackage_is_built)