pyodide / pyodide/pytest-pyodide

Support separated directory for Pyodide core and packages

Open
#153 0 comments 0 reactions 0 assignees View on GitHub

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.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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.