Skip to content
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.11.1] - 2026/04/02

### Fixed

- Fixed content-type header parsing to handle PyPI mirrors that include charset parameters.
This improves compatibility with mirrors that return headers like `application/json; charset=utf-8`.
[#261](https://github.com/pyodide/micropip/pull/261)

### Changed

- micropip now accepts `pyemscripten` platform wheels in addition to `pyodide` platform wheels,
following the PEP 783 standard.
[#270](https://github.com/pyodide/micropip/pull/270)

## [0.11.0] - 2025/10/18

### Added
Expand Down
21 changes: 17 additions & 4 deletions micropip/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,25 @@ def get_files_in_distribution(dist: Distribution) -> set[Path]:

@functools.cache
def sys_tags() -> tuple[Tag, ...]:
new_tags = []
abi_version = get_config_var("PYODIDE_ABI_VERSION")
pyodide_platform_tag = f"pyodide_{abi_version}_wasm32"
new_tags: list[Tag] = []

abi_version = get_config_var("PYEMSCRIPTEN_PLATFORM_VERSION")
if not abi_version:
# Fallback to PYODIDE_ABI_VERSION for compatibility
abi_version = get_config_var("PYODIDE_ABI_VERSION")

pyodide_platform_tags = [
# PEP 783
f"pyemscripten_{abi_version}_wasm32",
# for backward compatibility
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.extend(
Tag(tag.interpreter, tag.abi, pyodide_platform_tag)
for pyodide_platform_tag in pyodide_platform_tags
)
new_tags.append(tag)
return tuple(new_tags)

Expand Down
38 changes: 38 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,41 @@ def test_constrain_requirement_direct_url(valid_constraint, wheel_catalog):
assert not msg
constrained = _utils.constrain_requirement(req, constrained_reqs)
assert constrained.url == url


@run_in_pyodide
def test_sys_tags_pep783_both_tags_present(selenium_standalone_micropip):
"""sys_tags() should produce both pyemscripten_ and pyodide_ platform tags."""
from sysconfig import get_config_var

from micropip._utils import sys_tags

version = get_config_var("PYEMSCRIPTEN_PLATFORM_VERSION")
if not version:
version = get_config_var("PYODIDE_ABI_VERSION")

tags = list(sys_tags())
pyemscripten_tags = [
t for t in tags if t.platform == f"pyemscripten_{version}_wasm32"
]
pyodide_tags = [t for t in tags if t.platform == f"pyodide_{version}_wasm32"]

assert len(pyemscripten_tags) > 0, "No pyemscripten_ tags found"
assert len(pyodide_tags) > 0, "No pyodide_ tags found"


@run_in_pyodide
def test_check_compatible_pyemscripten_wheel(selenium_standalone_micropip):
"""Wheels tagged with pyemscripten_ platform should be compatible in Pyodide."""
from sys import version_info
from sysconfig import get_config_var

from micropip._utils import check_compatible

version = get_config_var("PYEMSCRIPTEN_PLATFORM_VERSION")
if not version:
version = get_config_var("PYODIDE_ABI_VERSION")

cpver = f"cp{version_info.major}{version_info.minor}"
wheel_name = f"pkg-1.0.0-{cpver}-{cpver}-pyemscripten_{version}_wasm32.whl"
check_compatible(wheel_name) # should not raise
Loading