Repository navigation
Description
The repo checker reads only lockfiles that list every package's files (OFFLINE in site/check/driver.py). For anything else, it sends people away:
- a repo with only a
requirements.txt,requirements.lockorPipfile.lockgets "needs PyPI lookups … Run uvx wheelgap in a checkout instead" (needsIndex()insite/check/check.mjs); - a repo with only a
pyproject.tomlgets "No lockfile found", becauseplan()only looks for wheelgap'sLOCKFILES; - a
pixi.lockwill get the same "needs PyPI lookups" answer once Repo checker: a pixi.lock is offered as checkable, then fails with wheelgap's offline=True error #185 is fixed.
Plenty of apps and most libraries have exactly those files and no lockfile, so they're turned away before they've seen a single gap, and never reach the fixes. The CLI checks all of them by looking each package up on PyPI, and the browser can make those lookups too. The worker already fetches https://pypi.org/pypi/<name>/json for --suggest's fixes (fixes() in site/check/worker.mjs), and pypi.org is already in the page's connect-src. What's missing is a driver step that fills the packages from answers the worker fetched. wheelgap's own pypi.fill_all() can't do it in Pyodide: it uses urllib and a thread pool.
What to do
driver.plan(): also listpyproject.tomlfiles, after the lockfiles in the same folder, so auv.locknext to one is still picked first. Mark them as needing lookups.- Add a driver step, say
needs(root, path, options_json). It runssources.load_file()on the file and returns the lookups wheelgap'spypi.fill()would make. That's each package that isn't skipped and has no files (or haspartial_files, as in pixi), with its canonical name and its pinned version ornull. Return only names wheelgap would send to PyPI (pypi.may_look_up(p.registry, None)). Then a package from another index (a requirements file's--index-url, aPipfile.locksource) never reaches pypi.org, and is skipped asprivate index, as the CLI does. - Requirements includes (
-r,-c):load_file()reads them from disk, so the worker has to fetch them first, from the same repo and ref. The tree is already loaded, so it knows the paths. Fetch at most a handful. An include that's a URL, or outside the repo, is an error naming it. - Worker: fetch
https://pypi.org/pypi/<name>/<version>/jsonfor a pinned package andhttps://pypi.org/pypi/<name>/jsonfor a range, aspypi.fill()does. Run 6 at a time, asfixes()does, up to a cap (say 300), and say how many weren't looked up. Those count asunknown, never as a gap. Keep the project JSON in thereleasescache, sincefixes()uses the same document. driver.check()for these inputs: fill each package from the fetched JSON 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 as in the CLI. Mark a failed or missing lookup as an error so it showsunknown. Then build the rows fromcheck.check([source], targets). In 0.13.0,api._check_lockfilerefuses apyproject.tomlwithoutdeps=Trueand callsfill_allitself, so this path can't go through it. Return the same JSON shapecheck()returns now, so the table, the fixes and the prompt need no new code.- Copy: in the verdict detail, say that a requirements file or
pyproject.tomlis checked for its direct requirements, asuvx wheelgap requirements.txtdoes, and that--depson the command line checks the whole tree. UpdatenoLockfile()andneedsIndex()for what's left: a repo with none of these files, and lookups over the cap. - Not in this issue:
--deps(resolving the whole tree), and PEP 723 scripts (wheelgap script.pyships in the next wheelgap release).
Done when:
- For a public repo that has only a
requirements.txt, and one that has only apyproject.toml(name both in the PR), the page lists the gaps, and theuvx wheelgap … -p … -t …command it gives prints the same ones. - A
Pipfile.lockand apixi.lockare checked the same way, each package for its pinned version. - With a requirements file whose first line is
--index-url https://example.invalid/simple, no request goes to pypi.org (check the browser's Network tab), and its packages are listed as skipped. -
tests/test_check_driver.pyfeedsneeds()andcheck()canned PyPI JSON for: a pinned package, a range that resolves to different releases on two Pythons, a 404 (unknown), a private-index package (needs()doesn't list it), a-rinclude, and apyproject.toml. - A lockfile that lists its files makes the same requests as today: none to PyPI before the fixes.
Activity
Repo checker: check requirements files, pyproject.toml and Pipfile.lo…
Repo checker: check requirements files, pyproject.toml, Pipfile.lock …