Skip to content
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

fix: make sure pyodide works without setup #1868

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ branding:
runs:
using: composite
steps:
# Set up a non-EOL, cibuildwheel & pipx supported Python version
# Set up the version of Python that supports pyodide
- uses: actions/setup-python@v5
id: python
with:
python-version: "3.8 - 3.12"
python-version: "3.12"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the PR but I was thinking that maybe, cibuildwheel could follow NEP 29 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's now superseded by SPEC 0. Is there a reason to? I personally prefer official EoL, though for cibuildwheel, it really doesn't matter as much, since CI or developers should have a recent Python; it's not user-facing. Any particular reason for being interested in following NEP 29/SPEC 0, 3.10+?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link, I somehow missed the prominent note in NEP 29...

Is there a reason to?

Nothing else than it allows to get newer CPython features faster and, given the specific nature of cibuildwheel which you mentioned, I thought it might be interesting to follow the schedule of SPEC 0.

python 3.10 might not change much (mostly some typing, functools.cache). With Python 3.11+ at the end of the year we could drop all things in _compat and remove those conditionnal dependencies.

I might open a discussion about this at some point.

update-environment: false

- id: cibw
Expand Down
7 changes: 6 additions & 1 deletion cibuildwheel/pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import shutil
import sys
from collections.abc import Sequence, Set
from dataclasses import dataclass
from pathlib import Path
Expand Down Expand Up @@ -92,7 +93,11 @@ def install_xbuildenv(env: dict[str, str], pyodide_version: str) -> str:
def get_base_python(identifier: str) -> Path:
implementation_id = identifier.split("-")[0]
majorminor = implementation_id[len("cp") :]
major_minor = f"{majorminor[0]}.{majorminor[1:]}"
version_info = (int(majorminor[0]), int(majorminor[1:]))
if version_info == sys.version_info[:2]:
return Path(sys.executable)

major_minor = ".".join(str(v) for v in version_info)
python_name = f"python{major_minor}"
which_python = shutil.which(python_name)
if which_python is None:
Expand Down
Loading