Skip to content

Compare Pyodide shipped versions to declared specifiers - #678

Merged
suraj-ranganath merged 3 commits into
developfrom
cursor/fix-pyodide-resolution-gate-e38a
Nov 24, 2026
Merged

suraj-ranganath merged 3 commits into
developfrom
cursor/fix-pyodide-resolution-gate-e38a

Conversation

@suraj-ranganath

@suraj-ranganath suraj-ranganath commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

The Pyodide resolution gate treated a package name in the lock as installable. It now asks whether the version Pyodide 0.29.5 ships satisfies each declared specifier, direct from pyproject.toml and transitive from the Requires-Dist of the release micropip installs. A parent that Pyodide ships, when that build satisfies its specifier, does not contribute the newer uv.lock pin's Requires-Dist. That pin is used only when micropip installs the parent from a PyPI wheel. A universal wheel that meets the specifier is a note. A compiled package that does not is a failure. The resolved version in uv.lock is not the comparison.

On develop, uv run python tools/check_pyodide_base_resolution.py exits 0:

[ok] colorama==0.4.6: pypi wheel: colorama-0.4.6-py2.py3-none-any.whl
[ok] contourpy==1.3.2: pyodide-lock 1.3.1
[ok] cycler==0.12.1: pyodide-lock 0.12.1
[ok] eeglabio==0.1.3: pypi wheel: eeglabio-0.1.3-py3-none-any.whl
[ok] fonttools==4.62.1: pyodide-lock 4.56.0
[ok] h5py==3.14.0: pyodide-lock 3.13.0
[ok] kiwisolver==1.5.0: pyodide-lock 1.4.8
[ok] matplotlib==3.10.9: pyodide-lock 3.8.4
[ok] numpy==2.2.6: pyodide-lock 2.2.5
[ok] packaging==26.2: pyodide-lock 26.2
[ok] pillow==12.2.0: pyodide-lock 11.3.0
[ok] pyparsing==3.3.2: pyodide-lock 3.2.1
[ok] python-dateutil==2.9.0.post0: pyodide-lock 2.9.0.post0
[ok] pyyaml==6.0.3: pyodide-lock 6.0.2
[ok] scipy==1.15.3: pyodide-lock 1.14.1
[ok] six==1.17.0: pyodide-lock 1.17.0
[ok] threadpoolctl==3.6.0: pyodide-lock 3.5.0

Checked 17 base packages against Pyodide 0.29.5: 0 failing, 0 known gaps (not blocking), 0 notes.

With the non-darwin scipy floor in pyproject.toml raised from >=1.14.1 to >=1.15, the same command exits 1 and names pyproject.toml:

[FAIL] scipy==1.15.3: tools/check_pyodide_base_resolution.py: scipy: Pyodide 0.29.5 ships 1.14.1, which does not satisfy scipy>=1.15 declared by pyproject.toml. Lower the floor in pyproject.toml to <= 1.14.1, or move to a Pyodide release that ships it.

Checked 17 base packages against Pyodide 0.29.5: 1 failing, 0 known gaps (not blocking), 0 notes.

Issue 375's acceptance criteria are all met on develop. This does not close issue 375.

Fixes #400

Open in Web Open in Cursor 

cursoragent and others added 2 commits November 23, 2026 23:10
The base-resolution gate treated a package name in the Pyodide lock as
installable. Check each direct and transitive specifier against the
version Pyodide ships, and record a universal-wheel override as a note.

Co-authored-by: Suraj Ranganath <[email protected]>
Name the locked release that declared a failing transitive specifier,
ignore yanked universal wheels, and drop the name-only lock shortcut.

Co-authored-by: Suraj Ranganath <[email protected]>
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 24, 2026 00:22

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 1m 2s —— View job


Code review

  • Overall assessment: Needs changes. The direct-specifier check works: a floor above the shipped compiled build fails and names pyproject.toml. The transitive check can report false failures.
  • Highest-risk area: how check_base_packages gathers transitive constraints (tools/check_pyodide_base_resolution.py:317-327)
  • Merge recommendation: Needs changes

Blocking

None.

Important

  • Transitive specifiers use the Requires-Dist of the parent version in uv.lock, not the parent Pyodide installs (tools/check_pyodide_base_resolution.py:317-319). When Pyodide ships a parent that already satisfies eegprep's direct specifier, micropip installs that bundled build, and its own Requires-Dist applies. Take a newer matplotlib in uv.lock that requires numpy>=2.3: the gate would fail numpy, even though Pyodide's matplotlib 3.8.4 + numpy 2.2.5 installs fine. That is the same "lock runs ahead of Pyodide" mistake the docstring warns about, one level down.
    • The failure message is also impossible to follow: "Lower the floor in locked release scipy==1.15.3 Requires-Dist" asks the user to edit third-party metadata.
    • Fix: take each parent's Requires-Dist from the version that will actually be installed. That is the shipped version when the parent comes from pyodide-lock. Pyodide's lock is self-consistent, so you can also skip edges between two packages Pyodide ships. Use the locked version only for parents that come from a PyPI wheel. Details are in the inline comment.

Nits

  • notes in main() is counted by matching the string prefix "pypi wheel, overrides bundled" in source. A STATUS_NOTE constant, or a flag on PackageCheck, would keep the count from silently going to 0 if the message wording changes.

Test gaps

  • test_transitive_specifier_the_bundled_version_misses_fails (tests/test_pyodide_harness.py:562) locks in the false failure above. Pyodide ships scipy 1.14.1, which satisfies scipy>=1.14.1, so the numpy>=2.3 that scipy 1.15.3 requires never applies. Once the fix lands, this case should expect ok. Add a separate case where the parent comes from a PyPI universal wheel, and assert that its transitive floor is enforced.

EEGLAB parity notes

None. This is developer tooling with no EEGLAB counterpart.

Checked: specifier and marker evaluation (including extra markers), handling of yanked wheels, how --print-pyodide-packages matches the PYODIDE_PACKAGES list in run_pyodide.mjs, and the docs and docstring updates. I could not run the tests in this environment because permission to run commands was denied.

Comment thread tools/check_pyodide_base_resolution.py Outdated
Comment on lines +317 to +319
for name, version in closure.items():
requires = (releases[name].get("info") or {}).get("requires_dist") or []
declared_by = f"locked release {name}=={version} Requires-Dist"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important: transitive specifiers come from the parent version in uv.lock, but Pyodide installs a different parent version.

When Pyodide ships a parent whose version satisfies the direct specifier, micropip uses that bundled build, so that build's Requires-Dist applies. The Requires-Dist of the newer version in uv.lock does not. This is the same "lock runs ahead of Pyodide" problem the module docstring warns about, one level down. For example, uv.lock bumps matplotlib (Pyodide ships 3.8.4) to a release that requires numpy>=2.3. The gate then fails numpy, even though the bundled matplotlib 3.8.4 + numpy 2.2.5 pair installs fine.

The suggested fix in the message is also impossible to follow: "Lower the floor in locked release scipy==1.15.3 Requires-Dist" asks the user to edit third-party metadata.

test_transitive_specifier_the_bundled_version_misses_fails (tests/test_pyodide_harness.py:562) locks in this false failure. Pyodide ships scipy 1.14.1, which satisfies scipy>=1.14.1, so the numpy>=2.3 from scipy 1.15.3 would never apply.

Suggested fix: take each parent's Requires-Dist from the version that will actually be installed. That is the shipped version when the parent comes from pyodide-lock; Pyodide's lock is self-consistent, so you can also skip edges between two packages Pyodide ships. Use the locked version only when the parent comes from a PyPI wheel. Then flip that test so it expects ok.

A bundled parent installs Pyodide's build, so the newer lock pin's
Requires-Dist does not apply. Use that pin only for a PyPI wheel.

Co-authored-by: Suraj Ranganath <[email protected]>
@suraj-ranganath
suraj-ranganath merged commit bd1dca0 into develop Nov 24, 2026
12 checks passed

Copy link
Copy Markdown
Member Author

Claude review follow-up: the important point (bundled Pyodide parents imposing the uv.lock Requires-Dist) was fixed in 5aeed95. A bundled parent whose shipped version satisfies the specifier no longer adds the newer pin's Requires-Dist, which matches micropip keeping the preloaded build. A PyPI-installed parent still applies its floor. Both cases are covered by test_bundled_parent_does_not_impose_the_locked_requires_dist and test_pypi_wheel_requires_dist_applies_when_the_bundle_is_overridden. The third-party failure message now says to pin an older release or move to a newer Pyodide. The remaining nit, that main() counts notes by the "pypi wheel, overrides bundled" string prefix, was not addressed before the merge.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pyodide resolution gate checks package names, not versions

2 participants