pyodide / pyodide/pytest-pyodide
Support separated directory for Pyodide core and packages
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 38
- Forks
- 20
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 1
Description
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.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-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-diroption, which defaults to equivalent to--dist-dir.- When given, it should be passed to
lockflieURLparameter when calling loadPyodide. - Also, other codes that use
dist_dirmight needs to be changed to uselockfile_dirinstead (e.g. inpackage_is_built)
- When given, it should be passed to
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pytest-pyodide handling of --dist-dir and the package_is_built code, then inspect the pyodide-build config command and loadPyodide call described in the issue. Add the separate lockfile directory behavior and the pyodide config dist_path output, preserving the existing default; verify that packages can be tested without copying core files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, testing, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100