Repository navigation
Add a --pre flag to pyodide skeleton pypi - #439
Merged
agriyakhetarpal merged 1 commit intoOct 16, 2026
Merged
Conversation
pyodide skeleton pypi --update compared the recipe version only with PyPI's info.version, which is the latest stable release whenever one exists. A recipe on a pre-release, such as SciPy 1.18.0rc1 while 1.17.1 was the latest stable release, could not be updated to a newer pre-release and failed with "Local version ... is newer than PyPI version ...". Add a --pre flag, as in pip, to include pre-release and development versions when looking for the latest version. The newest release in the project's releases, skipping releases that have no files or whose files are all yanked, is used when it is newer than info.version. The flag applies when creating and when updating a recipe, and has no effect when --version is given. Without --pre nothing changes, except that the error above now suggests --pre when the recipe is on a pre-release. Fixes pyodide#373
Thanatos9404
force-pushed
the
skeleton-prerelease-update
branch
from
October 16, 2026 09:58
f9f751e to
95a654a
Compare
agriyakhetarpal
approved these changes
Oct 16, 2026
agriyakhetarpal
left a comment
Member
There was a problem hiding this comment.
Relying on the pip semantics seems sensible to me. I found a few edge cases:
- if we update to a pre-release and then it gets yanked on PyPI
- if we have a local release that's at a later version than whatever release or pre-release is available on PyPI
but neither of those two are common enough cases for us to care about. The hint would be only slightly incorrect, which is fine.
Approving, thanks @Thanatos9404!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #373
Following the discussion on #373, this adds an explicit
--preflag topyodide skeleton pypi, in the spirit of pip's--pre.Without the flag nothing changes: the version comes from PyPI's
info.version, which is the latest stable release whenever there is one. That is why a recipe on SciPy 1.18.0rc1 could not be updated while 1.17.1 was the latest stable release.With
--pre, the newest release in the project'sreleases(by PEP 440 ordering) is used instead when it is newer thaninfo.version, so it can be an alpha, beta, release candidate or dev release. Releases that have no files or whose files are all yanked are skipped, as are versions thatpackagingcannot parse. When a newer release is picked, its metadata is fetched from/pypi/<name>/<version>/json, so the URL and sha256 come from that release. The flag works when creating a recipe and with--update, and has no effect when--versionis given.For the cases in the issue:
--pre, goes to 1.2.4rc0 with it.--pregoes to 1.2.4rc2.--pre.--pregoes to 1.2.4rc1.--pregoes to 1.3.0rc1, the newest release, as pip's--prewould. This differs from the second rule in the issue, which would stop at 1.2.4. Since the flag is explicit, I went with the pip behaviour (without--preit goes to 1.2.4), but I can switch to preferring a newer stable release if you'd rather have that.When the recipe is on a pre-release and
--preis not given, the "Local version ... is newer than PyPI version ..." error now ends with "Use --pre to include pre-releases." I can drop that if you would rather keep the message as it was.Checklist
--prehelp text; the skeleton commands are not in the generated CLI reference)New tests in
tests/recipe/test_skeleton.py:test_update_package_pre(8 cases: the ones above plus PEP 440 ordering such as rc10 after rc9, alpha/beta/dev releases, and a recipe already on the newest release),test_update_package_pre_keeps_newer_info_version(--prenever picks a release older thaninfo.version, and makes no second request wheninfo.versionis the newest),test_update_package_without_pre_skips_prereleases,test_update_package_prerelease_without_pre_suggests_pre,test_update_package_pre_explicit_version,test_make_package_preandtest_find_latest_version_skips_unusable_releases. Intests/test_cli.py, next totest_skeleton_pypi:test_skeleton_pypi_pre(3 cases). They use a stand-in for_get_metadata, like the existingupdate_packagetests. Onmain, 18 of the 19 fail;test_update_package_without_pre_skips_prereleasespasses there too and is there to keep the default behaviour.I also ran
pyodide skeleton pypi tornado --updateagainst PyPI (prettier stubbed out). tornado'sinfo.versionis 6.5.10, and 6.6a1, 6.6b1 and 6.6rc1 are out:--pre(now with the hint); with--preit is updated to 6.6rc1, with the 6.6rc1 sdist URL and sha256;--preand to 6.6rc1 with it;--pre --version 6.6b1updates to 6.6b1.Checks run locally:
pytest pyodide_build -m "not integration"on Python 3.13 (Ubuntu under WSL): 19 more tests pass than onmain, and the same tests fail on both. Those are the skeleton tests that runnpx prettierand three recipe build tests, which fail here because of my setup, andtest_build_constraint(assert '84.0.0' == '74.1.3'), because uv does not apply the constraint to build requirements (see Pass uv environment variables to build requirement installs #438).ruff check,ruff format(0.15.20, as pinned in pre-commit) andcodespellon the changed files, andmypy2.1.0 on the two changed modules: clean.