Skip to content

fix: version range resolution to account for Python compatibility - #156

Merged
patrickballard merged 3 commits into
wheelgap:mainfrom
Swarneil1905:fix/84-requires-python-ranges
Nov 10, 2026
Merged

patrickballard merged 3 commits into
wheelgap:mainfrom
Swarneil1905:fix/84-requires-python-ranges

Conversation

@Swarneil1905

@Swarneil1905 Swarneil1905 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Part of #84

What this changes

Version ranges could select a release that requires a newer Python than the target, causing wheelgap to report gaps for a release an installer would reject.

This implements the single-Python first step described in the issue. When all targets share the same Python major/minor version, range resolution chooses the newest matching release with a non-yanked file whose Requires-Python permits that interpreter. For example, a Python 3.9 run skips a newer release requiring Python 3.10 and selects the older compatible release.

An optional Python version is passed through fill() and fill_all() from the CLI and Python API. Incompatible files are excluded from the selected release. Missing or invalid Requires-Python metadata is treated as unrestricted.

Regular and free-threaded targets sharing the same major/minor use the same compatibility filter. Runs checking different Python versions retain their existing selection behavior; per-target version resolution remains separate work for #84. Exact pins and bare package names are unchanged.

Adds 24 offline tests covering release selection, CLI/API integration, metadata edge cases, yanked files, mirror fallback, and existing behavior. README documentation explains the scope and limitations.

Validated on Windows with Python 3.13.14: 700 tests passed, 1 skipped. Ruff formatting, lint, mypy, and git diff --check passed.

AI tools used: OpenAI Codex assisted with implementation, tests, documentation, and review. I reviewed the changes and ran the validation commands locally.

Checklist

  • Tests added or updated without network access, using fake_pypi or mocked index responses
  • uv run --group dev ruff format . and uv run --group dev ruff check . pass
  • uv run --group dev mypy and uv run --group dev pytest pass
  • [x] CHANGELOG.md updated under ## Unreleased with PR fix: version range resolution to account for Python compatibility #156
  • README updated

…elgap#156)

pip compares the interpreter's full version, so a target "3.8" stands for a
current 3.8.x: `>=3.8.1` (flake8 6, langchain 0.1) must admit it, and
`!=3.9.0` must admit 3.9. Adds tests for patch-level specifiers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patrickballard
patrickballard merged commit d812195 into wheelgap:main Nov 10, 2026
9 checks passed
@patrickballard

Copy link
Copy Markdown
Collaborator

Merged, thanks @Swarneil1905! Scoping this to the one-Python first step was the right call, and filtering file by file matches how pip reads requires_python. The tests cover yanked files, mirrors and the API paths too.

We changed one thing before merging. Requires-Python was compared against x.y.0, so flake8>=6 -p 3.8 (flake8 6 requires >=3.8.1) found no release, although pip installs it on any real 3.8. A target Python now counts as a current patch release, with tests for >=3.8.1, !=3.9.0 and <3.9.5.

#84 stays open for per-Python resolution. If you'd like something new, #20 (--suggest: the nearest version that has a wheel) is a roadmap issue with no PR yet, and it builds directly on the release selection you just wrote.

(Review assisted by Claude.)

patrickballard added a commit to RohanVolety/wheelgap that referenced this pull request Nov 10, 2026
- recheck_lock takes simple_index (the merge with main called it with one).
- Version ranges on the simple index apply Requires-Python like fill() (wheelgap#156),
  reading PEP 691's requires-python key; parity tests run with a Python.
- --index-url must be https, except for localhost.
- [tool.wheelgap] index-url refuses credentials: pyproject.toml is committed.
- Accept text/html at q=0.01 so an HTML-only index gets the clear error, not a 406.
- CHANGELOG credit, ruff format.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants