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

Hardcode support for platform pyodide_wasm32 #159

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Changes from 1 commit
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
Next Next commit
Hardcode support for platform pyodide_wasm32
I don't like it; this feels like a hack, but it works, and I would be
happy to get more guidance.

Also one weird thing, is if I installl pywavelets nightly, it installs
numpy stable; while the index does have a numpy nightly;

And with the same config, if I ask it to install numpy; it does install
numpy nightly.

So there is something wonkey in recursive dependency handling of
indexes.
Carreau committed Nov 25, 2024
commit 0672acdf2f3f24855d10ddd2a6796d4636dc4b15
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- Fix a bug that prevented some wasm32 wheel to be recognized as compatible with pyodide
[#159](https://github.com/pyodide/micropip/pull/159)

## [0.7.1] - 2024/11/11

### Fixed
13 changes: 10 additions & 3 deletions micropip/_utils.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
import json
from importlib.metadata import Distribution
from pathlib import Path
from sysconfig import get_platform
from sysconfig import get_config_var, get_platform

from packaging.requirements import Requirement
from packaging.tags import Tag
@@ -62,8 +62,15 @@ def get_files_in_distribution(dist: Distribution) -> set[Path]:


@functools.cache
def sys_tags() -> list[Tag]:
return list(sys_tags_orig())
def sys_tags() -> tuple[Tag, ...]:
new_tags = []
abi_version = get_config_var("PYODIDE_ABI_VERSION")
pyodide_platform_tag = f"pyodide_{abi_version}_wasm32"
for tag in sys_tags_orig():
if "emscripten" in tag.platform:
new_tags.append(Tag(tag.interpreter, tag.abi, pyodide_platform_tag))
new_tags.append(tag)
return tuple(new_tags)


@functools.cache
3 changes: 3 additions & 0 deletions micropip/package_index.py
Original file line number Diff line number Diff line change
@@ -214,6 +214,9 @@ def _fast_check_incompatibility(filename: str) -> bool:
if not filename.endswith(".whl"):
return False

if filename.endswith("wasm32.whl") and sys.platform == "emscripten":
return True
Comment on lines +217 to +218
Copy link
Member

Choose a reason for hiding this comment

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

Maybe sys.platform check is redundant, as we never expect micropip to be used in the non-Emscripten environment.

Copy link
Member

Choose a reason for hiding this comment

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

At least not for installation. For making lock files, it would make sense.

Copy link
Member

Choose a reason for hiding this comment

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

For making lock files

Do you mean using it under pyodide venv environment? I think it would still have sys.platform == emscripten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well; at least some test locally runs under sys.platform != emscripten, and are useful for fast iteration.


if sys.platform not in filename and not filename.endswith("-none-any.whl"):
return False