Skip to content

Pyodide resolution gate checks package names, not versions #400

Done

Description

@neuromechanist

What

tools/check_pyodide_base_resolution.py on epic/324-pyodide-browser decides whether a base
dependency is available under Pyodide by testing the package name against the Pyodide lock:

pyodide_names = {canonicalize_name(name) for name in pyodide_lock["packages"]}
...
in_lock = canonicalize_name(name) in pyodide_names

The required version is never compared against the shipped version.
So the gate answers "does Pyodide have a package by this name", not "can Pyodide satisfy this
constraint", and a floor above what Pyodide ships passes it.

Evidence

epic/324-pyodide-browser declares threadpoolctl>=3.6.0.
Pyodide 0.29.5 ships threadpoolctl 3.5.0 (from pyodide-lock.json for that release).
Running the gate against a tree whose lock resolves threadpoolctl to 3.6.0 prints:

[ok] threadpoolctl==3.6.0: pyodide-lock

which is the gate approving a constraint the distribution cannot meet.
This is how the floor reached the epic branch with the gate already in place.

Shipped versions in Pyodide 0.29.5, for reference:

package Pyodide 0.29.5
Python 3.13.2
threadpoolctl 3.5.0
scipy 1.14.1
numpy 2.2.5
matplotlib 3.8.4
h5py 3.13.0

Suggested fix

Compare the resolved version against pyodide_lock["packages"][name]["version"].
When they differ, the package is only acceptable if micropip can pull a universal wheel for the
required version, which is the check _find_universal_wheel already implements for the
not-in-Pyodide case. So the fix is to stop treating "in the lock" as automatically ok and route a
version mismatch through the same wheel lookup.

Worth deciding explicitly: a pure-Python package can be overridden from PyPI, but a package with a
compiled extension cannot, and for those a mismatch is a hard failure rather than an extra download.

Related

Activity

  1. neuromechanist commented on Sep 21, 2026

    @neuromechanist
    MemberAuthor

    Correcting this issue: the threadpoolctl example I opened it with is wrong, and the fix I
    first proposed makes the gate worse. The blind spot is real, but it is narrower and differently
    shaped than described above.

    What is wrong with the original report

    threadpoolctl>=3.6.0 against a Pyodide shipping 3.5.0 is not a broken browser install.
    threadpoolctl publishes threadpoolctl-3.6.0-py3-none-any.whl, a universal wheel, so micropip
    pulls 3.6.0 straight from PyPI and the Pyodide build is simply not used. It costs a download, not
    an install failure. I called it a live bug; it is not one.

    What is actually true

    Pyodide's bundled build is the only option for a package that publishes no pure-Python wheel.
    Checked against PyPI:

    package universal wheel on PyPI floor is a ceiling
    numpy none yes
    scipy none yes
    h5py none yes
    matplotlib none yes
    threadpoolctl py3-none-any no

    So the constraint binds on compiled packages only, and _find_universal_wheel in this tool is
    already the right question to ask for everything else.

    Why the naive fix is wrong too

    Comparing the lockfile's resolved version against Pyodide's shipped version looks like the fix and
    is not. uv.lock resolves for the development environment and runs ahead of Pyodide by design, so
    the comparison fires on packages that are perfectly fine: scipy locks to 1.15.3 while the declared
    constraint is >=1.14.1, which Pyodide's 1.14.1 satisfies. I tried it on the epic branch and it
    reported 11 failures, nearly all false.

    The question the gate should ask is "does Pyodide's shipped version satisfy the declared
    specifier"
    , evaluated against [project].dependencies, not against whatever the lock happened
    to resolve. For a package with no universal wheel a failure there is fatal; for one with a
    universal wheel it is at most a note about download size.

    Where this is covered meanwhile

    tests/test_browser_dependency_floors.py (#399) asks the correct question offline, and now scopes
    the hard assertion to the four compiled packages with PYODIDE_PURE_PYTHON recorded separately and
    deliberately not enforced. It is verified non-vacuous by raising the scipy floor above 1.14.1.

    This issue stays open for the gate itself, with the corrected diagnosis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions