-
Notifications
You must be signed in to change notification settings - Fork 290
Pyodide improvements: version setting, standalone environments #2002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
henryiii
merged 124 commits into
pypa:main
from
agriyakhetarpal:feat/distinct-pyodide-build
May 20, 2025
Merged
Changes from all commits
Commits
Show all changes
124 commits
Select commit
Hold shift + click to select a range
2ae389d
Fix a typo: pyoodide ➡️ pyodide
agriyakhetarpal 0e3b3f1
Add `pyodide_build_version` attribute
agriyakhetarpal 394459f
Add version to xbuildenv log step
agriyakhetarpal dff7bf2
Add version to Emscripten log step
agriyakhetarpal 16057bc
Use `pyodide-build`'s version for updating constraints
agriyakhetarpal f167c50
Bump Pyodide constraints by updating `pyodide-build`
agriyakhetarpal 31a6be9
Add a schema for `pyodide-version`
agriyakhetarpal cbca40b
Merge branch 'main' into feat/distinct-pyodide-build
agriyakhetarpal 9003067
Update Pyodide constraints
agriyakhetarpal d8a8d5e
Bump `pyodide-build` to new 0.29.0
agriyakhetarpal cf5dd3e
Test out another Pyodide identifier
agriyakhetarpal 55459cb
Merge branch 'main' into feat/distinct-pyodide-build
agriyakhetarpal 4fe86e0
Update outdated Pyodide constraints
agriyakhetarpal b6830ee
Add Pyodide version to temp directory name
agriyakhetarpal aaf32e5
Remove Pyodide 0.26.1 from build configurations
agriyakhetarpal bb6e0d6
Retrieve + validate + install specific xbuildenvs
agriyakhetarpal 735d5bb
Test wheel builds with Pyodide 0.26.2
agriyakhetarpal b8ac6c0
Add correct Pyodide version to identifier temp dir
agriyakhetarpal 7796311
Don't pre-call Pyodide xbuildenv search
agriyakhetarpal 97e22c8
Fetch just the stable Pyodide versions
agriyakhetarpal d30eb6a
Refactor search + validation + install into one step
agriyakhetarpal ce2a3f0
Move all of it under a lock
agriyakhetarpal 13fbf66
Reorder xbuildenv installation
agriyakhetarpal 14ec071
Add env and cwd to xbuildenv search call
agriyakhetarpal aae64bb
Temporarily lower to 0.26.2 target
agriyakhetarpal 6956121
Separate out search, validate, install; again
agriyakhetarpal e5d8443
Run xbuildenv search in `CIBW_CACHE_PATH`
agriyakhetarpal 95c3681
Remove prior `PYODIDE_ROOT` env vars, copy envs
agriyakhetarpal 09af46f
Validate doesn't need to depend on searching
agriyakhetarpal 66999cb
Add file lock when searching xbuildenvs
agriyakhetarpal 1af1e5d
Test the original version: 0.26.1
agriyakhetarpal ad3a203
Merge branch 'main' into feat/distinct-pyodide-build
agriyakhetarpal d344548
Update Pyodide constraints
agriyakhetarpal b3143b4
Merge remote-tracking branch 'upstream/main' into feat/distinct-pyodi…
agriyakhetarpal 738ed1f
Update constraints for `pyodide-build` 0.29.0 again
agriyakhetarpal 41e466a
Bump Pyodide from version 0.26.1 ➡️ version 0.26.4
agriyakhetarpal 2a66ddd
Add note on compatibility for macOS + other archs
agriyakhetarpal dff72ca
Note Pyodide version for Pyodide identifier
agriyakhetarpal 9a78845
Docs about `CIBW_PYODIDE_VERSION`
agriyakhetarpal e551021
Don't fetch just the stable versions
agriyakhetarpal 1fe8a04
Discard a variable that's not used later
agriyakhetarpal 8a8177c
Rename `search_xbuildenv` ➡️ `get_xbuildenv_versions`
agriyakhetarpal fffb705
`validate_xbuildenv` ➡️ `validate_xbuildenv_version`
agriyakhetarpal 0df3c45
Replace ordered comment, add newline
agriyakhetarpal 057e542
Replace sentence on macOS support
agriyakhetarpal 29b5eff
Capitalise: "pyodide" ➡️ "Pyodide"
agriyakhetarpal 321e0de
"work" ➡️ "may succeed"
agriyakhetarpal 92babdb
Add another job to test a custom Pyodide version
agriyakhetarpal d73f71f
Handle "v"-prefixed + non-prefixed versions
agriyakhetarpal 0f52a4b
Merge remote-tracking branch 'upstream/main' into feat/distinct-pyodi…
agriyakhetarpal 0b09321
Merge branch 'main' into feat/distinct-pyodide-build
joerick 1b4f911
Convert to a proper toml-able option, and remove some hardcoded versions
joerick 9d0f6bc
Add a schema entry
joerick b9f55e1
Add docs for CIBW_PYODIDE_VERSION
joerick 611b032
Rephrase
joerick 16f4c5d
Add tests for pyodide-version
joerick 4f443c7
Merge remote-tracking branch 'origin/main' into feat/distinct-pyodide…
joerick aef35c9
Apply suggestions from code review
joerick 1061775
Add python_build_standalone util
joerick d47b080
Merge remote-tracking branch 'origin/main' into feat/distinct-pyodide…
joerick 5e3a8ed
Hook up to python-build-standalone, removing dependency on host python
joerick 985fc46
Remove python hard-code in action.yml
joerick 62b57e6
Add log step
joerick b3ee8d1
Add workaround for https://github.com/pyodide/pyodide-build/issues/143
joerick 8b8cd62
Add emscripten pytest test
joerick 5077397
Remove unneeded checks
joerick 3efb38f
Fix a pytest invoke for emscripten
joerick 468dd92
Generate pyodide-build constraints from the pinned pyodide version
joerick da3ffad
Remove pyodide python-build-standalone workaround
joerick 15b894a
Fixup paths from newer version of pyodide-build
joerick 5b860af
Fix/skip some failing tests
joerick 471345b
Merge remote-tracking branch 'origin/main' into feat/distinct-pyodide…
joerick ecc37a1
Use `python -m pytest` on pyodide, even on Linux
joerick fd805ae
Docs fixes
joerick c8fbd0b
Don't call the github API at runtime, cache the release assets instead
joerick 89bdaa5
Ignore pylint false positive
joerick 6f387f6
Add version auto-updating for pyodide
joerick 95dea1d
Add support for pyodide 3.13.
joerick c9ee5a0
Fix tests for multiple pyodide wheels
joerick e440e11
Remove workaround for unreleased pyodide-build
joerick 4f78dd8
Rename to "test_pyodide"
joerick 6f3e6ca
Fix pathname confusion
joerick 3dbe64c
Remove extra github actions job
joerick ea6e81f
Fix expectation for test_abi_none
joerick 1cd3e22
Fix the custom_repair_wheel test to actually have clashing names
joerick 9680dd9
Fix pinned version test
joerick 78a37ef
Merge remote-tracking branch 'origin/main' into feat/distinct-pyodide…
joerick 60ee8a4
Document test-command limitation
joerick 880f66a
Remove pyodide 0.28.0a1 for now
joerick 243c029
Merge remote-tracking branch 'origin/main' into feat/distinct-pyodide…
joerick e58bad6
Update constraints files
joerick 2e7d716
Docs/test fixes post removing pyodide cp313
joerick ef51f83
Fix ABI test expectation
joerick 062003f
Docs improvements
joerick 4533cb1
Improve some comments
joerick 57cdc60
Remove logic duplication
joerick 32d06e6
remove pyodide special casing
joerick eb3789c
Refactor constraints code to use a utility script, circumventing impo…
joerick 1823dce
Merge branch 'main' into feat/distinct-pyodide-build
henryiii b8fe94a
chore: nicer nox env
henryiii f844431
fix: typo in variable name found by copilot
henryiii 5751bb0
Apply suggestions from code review
agriyakhetarpal 9fd41d0
Some more Pyodide version updates in the docs section
agriyakhetarpal 7994b0c
We haven't released Pyodide v0.27.6 yet
agriyakhetarpal 76e8d58
Back to the Github URL for cross-build-environments
joerick 006bb2f
`pyodide-build`, not `emsdk` for Windows skips
agriyakhetarpal ac64fc4
Move to a separate `_json_request` function
agriyakhetarpal 5a40c1f
Rename "retries" ➡️ "retry_count"
agriyakhetarpal b94fc00
Add some type hints
agriyakhetarpal 00137fb
Copy env vars before `UV_CUSTOM_COMPILE_COMMAND`
agriyakhetarpal 5c8d57b
Use `HTTPError.headers.get` instead
agriyakhetarpal 84314e4
Remove extra end quote
agriyakhetarpal b5b53cd
Merge remote-tracking branch 'origin/main' into feat/distinct-pyodide…
joerick f4c30a4
Change download tests URL to `https://badssl.com/`
agriyakhetarpal f7e5c00
Download size changes, too
agriyakhetarpal f97d5a8
Use jsdelivr for Github asset mirroring
joerick f8f6729
Bump to Pyodide v0.27.6
agriyakhetarpal 1e03d09
Fix unit tests
joerick c795a41
Move to pyodide v0.27.6 again
agriyakhetarpal 482d38c
Merge main
agriyakhetarpal a9d6434
Bump to pyodide-build 0.30.4
agriyakhetarpal 1f9e496
Merge branch 'main' into feat/distinct-pyodide-build
agriyakhetarpal 2396224
Use new URL for cross-build environments metadata
agriyakhetarpal f9453ed
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
import textwrap | ||
from pathlib import Path | ||
|
||
import click | ||
|
||
from cibuildwheel.extra import get_pyodide_xbuildenv_info | ||
|
||
|
||
@click.command() | ||
@click.argument( | ||
"pyodide-version", | ||
type=str, | ||
) | ||
@click.option( | ||
"--output-file", | ||
type=click.Path(), | ||
default=None, | ||
help="Output file to write the constraints to. If not provided, the constraints will be printed to stdout.", | ||
) | ||
def generate_pyodide_constraints(pyodide_version: str, output_file: str | None = None) -> None: | ||
""" | ||
Generate constraints for a specific Pyodide version. The constraints are | ||
generated based on the Pyodide version's xbuildenv info, which is retrieved | ||
from the Pyodide repository. | ||
|
||
These constraints should then be 'pinned' using `uv pip compile`. | ||
|
||
Example usage: | ||
|
||
bin/generate_pyodide_constraints.py 0.27.0 | ||
""" | ||
xbuildenv_info = get_pyodide_xbuildenv_info() | ||
try: | ||
pyodide_version_xbuildenv_info = xbuildenv_info["releases"][pyodide_version] | ||
except KeyError as e: | ||
msg = f"Pyodide version {pyodide_version} not found in xbuildenv info. Versions available: {', '.join(xbuildenv_info['releases'].keys())}" | ||
raise click.BadParameter(msg) from e | ||
|
||
pyodide_build_min_version = pyodide_version_xbuildenv_info.get("min_pyodide_build_version") | ||
pyodide_build_max_version = pyodide_version_xbuildenv_info.get("max_pyodide_build_version") | ||
|
||
pyodide_build_specifier_parts: list[str] = [] | ||
|
||
if pyodide_build_min_version: | ||
pyodide_build_specifier_parts.append(f">={pyodide_build_min_version}") | ||
if pyodide_build_max_version: | ||
pyodide_build_specifier_parts.append(f"<={pyodide_build_max_version}") | ||
|
||
pyodide_build_specifier = ",".join(pyodide_build_specifier_parts) | ||
|
||
constraints_txt = textwrap.dedent(f""" | ||
pip | ||
build[virtualenv] | ||
pyodide-build{pyodide_build_specifier} | ||
click<8.2 | ||
""") | ||
|
||
if output_file is None: | ||
print(constraints_txt) | ||
else: | ||
Path(output_file).write_text(constraints_txt) | ||
print(f"Constraints written to {output_file}", file=sys.stderr) | ||
|
||
|
||
if __name__ == "__main__": | ||
generate_pyodide_constraints() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import json | ||
|
||
from cibuildwheel.extra import github_api_request | ||
from cibuildwheel.util.python_build_standalone import ( | ||
PythonBuildStandaloneAsset, | ||
PythonBuildStandaloneReleaseData, | ||
) | ||
from cibuildwheel.util.resources import PYTHON_BUILD_STANDALONE_RELEASES | ||
|
||
|
||
def main() -> None: | ||
""" | ||
This script updates the vendored list of release assets to the latest | ||
version of astral-sh/python-build-standalone. | ||
""" | ||
|
||
# Get the latest release tag from the GitHub API | ||
latest_release = github_api_request("repos/astral-sh/python-build-standalone/releases/latest") | ||
latest_tag = latest_release["tag_name"] | ||
|
||
# Get the list of assets for the latest release | ||
github_assets = github_api_request( | ||
f"repos/astral-sh/python-build-standalone/releases/tags/{latest_tag}" | ||
)["assets"] | ||
|
||
assets: list[PythonBuildStandaloneAsset] = [] | ||
|
||
for github_asset in github_assets: | ||
name = github_asset["name"] | ||
if not name.endswith("install_only.tar.gz"): | ||
continue | ||
url = github_asset["browser_download_url"] | ||
assets.append({"name": name, "url": url}) | ||
|
||
# Write the assets to the JSON file. One day, we might need to support | ||
# multiple releases, but for now, we only support the latest one | ||
json_file_contents: PythonBuildStandaloneReleaseData = { | ||
"releases": [ | ||
{ | ||
"tag": latest_tag, | ||
"assets": assets, | ||
} | ||
] | ||
} | ||
|
||
with PYTHON_BUILD_STANDALONE_RELEASES.open("w", encoding="utf-8") as f: | ||
json.dump(json_file_contents, f, indent=2) | ||
# Add a trailing newline, our pre-commit hook requires it | ||
f.write("\n") | ||
|
||
print( | ||
f"Updated {PYTHON_BUILD_STANDALONE_RELEASES.name} with {len(assets)} assets for tag {latest_tag}" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.