Skip to content

fix(seed): skip wheel filenames with unparsable versions - #3788

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
TranHoaiPhu:fix/skip-unparsable-wheel-versions
Dec 5, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
TranHoaiPhu:fix/skip-unparsable-wheel-versions

Conversation

@TranHoaiPhu

@TranHoaiPhu TranHoaiPhu commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

🐛 A .whl file whose file name version is not a valid PEP 440 version, such as pip-latest-py3-none-any.whl in an --extra-search-dir, made seeding fail: Wheel.from_path accepted the name, and sorting the discovered wheels by version raised InvalidVersion. Wheel.from_path now rejects such a name, so the file is skipped like any other non-wheel file.

$ ls wheels/
pip-latest-py3-none-any.whl
$ virtualenv --extra-search-dir wheels --no-periodic-update env
-packaging.version.InvalidVersion: Invalid version: 'latest'
-RuntimeError: seed failed due to failing to download wheels pip
+    added seed packages: pip==26.3

Checklist

  • ran the linters (ruff check, ruff format --check, simplint check, ty check for 3.9 & 3.15, docstrfmt --check, codespell)
  • wrote descriptive pull request text
  • ensured there are tests validating the fix (pytest tests/unit/seed/wheels/: 322 passed, 3 skipped; 2 new tests failed before the fix)
  • added docs/changelog/+skip-unparsable-wheel-version.bugfix.rst
  • ran tests on Python 3.9 and 3.15 (verified locally on Python 3.12; ty checked against both 3.9 and 3.15)

TranHoaiPhu and others added 2 commits December 5, 2026 04:54
A requested seed version is validated before it reaches has_version, so
only an unparsable version on the wheel side, as read from the update
log, can hit its InvalidVersion branch; test that case alone. Word the
changelog entry from the user's side.
@gaborbernat gaborbernat added the bug label Dec 4, 2026
@gaborbernat
gaborbernat merged commit 32d4749 into pypa:main Dec 5, 2026
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants