Repository navigation
Repo checker: check requirements files, pyproject.toml and Pipfile.lock by looking packages up on PyPI from the browser - #195
Conversation
…ck by looking packages up on PyPI from the browser Fixes wheelgap#186.
e37faf3 to
090bee5
Compare
|
Rebased onto current |
|
Thanks @bfs2021, this is a big step for the repo checker: requirements files, It looks good overall. Because #186 is a (Review assisted by Claude.) |
… Pythons, a pixi.lock and a pyproject.toml Found reviewing wheelgap#195, each against wheelgap 0.13.0 on the same input: - The page's Pythons went to the per-Python resolution as written (3.14t). Requires-Python is compared with a version and 3.14t isn't one, so with only free-threaded Pythons picked every pinned package with a Requires-Python read as can't install (a false gap), and with 3.13 + 3.14t as unknown. They're now the targets' major.minor, as the CLI passes them. - A pixi.lock never says its input is PyPI-only, so every one of its packages was skipped as a private index and the page showed no gaps. It's placed package by package, as the CLI does; a requirements file, pyproject.toml or Pipfile.lock that names another index is still left off pypi.org as a whole. - A pyproject.toml's requires-python made targets outside it uncounted, with the uv.lock message about re-locking. PyPI has every Python's files and the CLI checks those targets anyway. - A requirement no target installs (its marker) was counted as a package; rows now go through the same r.needed filter as api._check_lockfile. - Rows are marked for a fix lookup by origin.known_pypi in both paths, so a pixi.lock's gaps are not looked up, as with --suggest. - needs() asks for nothing for a lockfile that is read offline, lists each lookup once, and gives an include outside the repo no path to fetch. - The result says which skipped packages were left off pypi.org (private) and whether the files came from PyPI (looked_up), for the page's messages. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Thanks for the review digest. Acknowledged on the private helpers: the two calls at |
…result with nothing checked Found reviewing wheelgap#195: - The worker kept a pinned release's JSON in the cache fixes() reads. That JSON has no release list, and its name being cached stopped fixes() from fetching one, so every gap of a pinned requirements file, Pipfile.lock or pixi.lock stayed "not looked up". Only a project's JSON (a range's lookup) is kept now, as its release list. - pickLockfile still preferred a lockfile that lists its files, so a uv.lock in a subfolder outranked the root's requirements.txt, and the folder a URL named lost to a lockfile elsewhere. Every listed file can be checked now, so it's plan()'s order: the file wheelgap would pick. - A pyproject.toml is listed without knowing whether it has [project] dependencies. One the page picked itself that wheelgap can't read (tool settings only) gives way to the repo's next file, with the reason under What was read, instead of ending on an error with no picker. An unreadable file comes back from the driver's check as a result rather than as a worker failure, so this works for looked-up files too. - With every package skipped (a requirements file with --extra-index-url, say) the verdict read "All 0 packages have a wheel" in green over all-wheels bars. It now says no packages were checked, shows no bars or table, and an alert names the packages left off pypi.org and why. - The stale-check guard sat before the lookups, so a check superseded while it looked packages up still reached the driver's check, whose targets fixes() reads. It's now checked before every read, the remaining requests of a superseded check aren't made, and the driver is always handed JSON text, never a JS null. - A pyproject.toml fetched to be checked is removed before another file is read: wheelgap reads the one beside a uv.lock for [tool.uv] settings, so a uv.lock checked after it could answer differently from the same uv.lock checked first. - The page's caveat and lede no longer say every check reads a lockfile's own files. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Adding to the review above: we read the change in full against
On the private helpers: the driver tests run against the pinned wheelgap in CI, so a pin bump that breaks them fails there before it reaches the site. No follow-up needed for that. It'll merge once a final review passes. (Review assisted by Claude.) |
…gap or a pass Found in the second review of wheelgap#195: - A 200 answer with no `urls` list (not PyPI's JSON) read as a release with no files, so a pinned or bare requirement showed as "can't install". It's unknown now, like any other lookup with no answer. - A platform's tile showed a ✓ over "N unknown" when no package was known to lack a wheel, so with pypi.org unreachable every tile read as a pass. It shows a ? there; a ✓ only when every package was checked. - The page said packages couldn't be checked, but not why. The worker now counts the lookups over the 300 cap, the ones PyPI doesn't have and the ones that failed, and the page says so. - A lookup that stalls is given up on after 30 seconds and counts as failed, so one request can't hold the check. - Removing a pyproject.toml that's already gone from the worker's files is no longer an error on every later check. - A pyproject.toml the page picked itself that lists no dependencies gives way to the repo's next file, as an unreadable one does. The driver's result counts the packages the file lists, so one whose packages are only skipped, or not installed on the targets picked, still stands. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Merged, thanks @bfs2021! The repo checker now answers for requirements files, The final review added one more commit before merging:
If you would like another, #189 is open and unclaimed, and it follows on from this: a test that the checker's answer matches (Reply assisted by Claude.) |
Problem
The repo checker only checked lockfiles that list every package's files (
OFFLINEinsite/check/driver.py). A repo with only arequirements.txt,requirements.lock,Pipfile.lockorpixi.lockgot "needs PyPI lookups … Run uvx wheelgap in a checkout instead", and a repo with only apyproject.tomlgot "No lockfile found" — turned away before seeing a single gap (issue #186).Root cause
driver.plan()only listed wheelgap'sLOCKFILES,driver.check()refused anything not inOFFLINE, and the page'srunCheck()short-circuited every non-offline lockfile toneedsIndex(). The worker already fetcheshttps://pypi.org/pypi/<name>/jsonfor--suggest's fixes, andpypi.orgis already in the page'sconnect-src— what was missing was a driver step that names the lookups and one that fills packages from the fetched JSON.Fix
driver.plan()also listspyproject.tomlfiles, after the lockfiles in the same folder (auv.locknext to one is still picked first), still capped atMAX_LOCKFILES.driver.needs(root, path): loads the file withsources.load_file()and returns the lookupspypi.fill()would make — each package that isn't skipped and has no files (or haspartial_files), with its canonical name and pinned version ornull, only namespypi.may_look_up(p.registry, None)allows. A package from another index (a requirements file's--index-url, aPipfile.locksource) is markedskip = "private index"and never reaches pypi.org, as the CLI does.-r,-c): a missing include comes back fromneeds()as an error naming it (kind: "include"), andworker.mjsfetches it from the same repo and ref (at most 10 round trips) and retries.worker.mjsfetcheshttps://pypi.org/pypi/<name>/<version>/jsonfor a pinned package and.../<name>/jsonfor a range, 6 at a time, capped at 300; the project JSON lands in thereleasescache, whichfixes()now reads.releasesout of.driver.check(root, lockfile, options, lookups)for these inputs fills each package the waypypi.fill()does (pypi._resolve_pythons(pkg, pythons, lambda p, py: pypi._fill_json_data(p, data, py, base), python), so a range resolves per Python) and builds its rows fromapi.check([source], targets)—api._check_lockfilerefuses apyproject.tomlwithoutdeps=True, so this path can't go through it. A package with no answer is an error, so it shows asunknown, never as a gap. The result keeps the same JSON shape as before, so the table, the fixes and the prompt need no new code.noLockfile()andneedsIndex()now describe what's left (no checkable file at all; an offline lock that doesn't list every package's files), the lockfile picker labels lookups files "(looks packages up on PyPI)", and a requirements file orpyproject.tomlresult carries an alert that it was checked for its direct requirements, asuvx wheelgap requirements.txtdoes, with--depsfor the whole tree. A lockfile that lists its files makes the same requests as today: none to PyPI before the fixes (aneeds()on auv.lockcomes back empty).Not in this issue:
--deps(the whole tree) and PEP 723 scripts.Testing
uvx --python 3.14 --with "wheelgap==0.13.0"is the CI pin; locally CPython withwheelgap==0.13.0installed:python -m pytest tests/test_check_driver.py: 20 passed. New tests (per the issue's list) feedneeds()andcheck()canned PyPI JSON for: a pinned package, a range that resolves to different releases on two Pythons, a 404 (unknown, never a gap), a private-index package (needs()doesn't list it;check()reports it skipped), a-rinclude (named askind: "include"when missing, then works once fetched), apyproject.toml(its own project skipped), and aPipfile.lock; plusplan()ordering, auv.lockneeding no lookups, andfixes()reading the same releases mapping.python -m pytest -q(whole suite): 531 passed, 229 subtests passed, 4 failed — all 4 intests/test_bundled.py, which fail identically onmain(399a2e7) before this change, so they're pre-existing.Fixes #186