Skip to content

wheelgap DIR finds the project's input when the root has no lockfile: pyproject.toml, other requirements names, subfolders - #656

Merged
patrickballard merged 5 commits into
mainfrom
directory-mode-finds-inputs
Nov 21, 2026
Merged

patrickballard merged 5 commits into
mainfrom
directory-mode-finds-inputs

Conversation

@patrickballard

@patrickballard patrickballard commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Why

We ran wheelgap <repo dir> (what uvx wheelgap in a checkout does) on the 300 most-starred Python repos. It answered for 172 (57%). 124 got "no lockfile found" although the project had something to check: a pyproject.toml with [project] dependencies and no lockfile (41), requirements files under another name (12), inputs only in subfolders (52). In 4 more, directory mode stopped at a root file with nothing in it (a requirements.txt that only says ., a conda-only pixi.lock, an empty uv.lock) and printed "No packages to check" beside a pyproject.toml or lockfile that had the answer.

What changes

wheelgap DIR (and plain wheelgap) still reads the first of uv.lock, pylock.toml, poetry.lock, pdm.lock, Pipfile.lock, requirements.txt, requirements.lock, pixi.lock at the root, in that order. Every directory that had an answer before gets the same one from the same file (checked on all 172). New, each step only if the one before found nothing:

  1. Root pyproject.toml, if it has a [project] table with dependencies or extras: checked exactly as wheelgap DIR/pyproject.toml (same code path, same "lists direct dependencies only … add --deps" note), plus a note that says there was no lockfile.
  2. The root's one requirements file under another name: requirements*.txt/.in at the root, *.txt/.in in requirements/ (not constraints*; not a .in beside its compiled .txt). Exactly one: checked. Several: exit 2 with each as a command to run. wheelgap never picks one of several.
  3. The one input in a subfolder, up to 3 folders down: per folder, the file wheelgap FOLDER would read (first lockfile name, else a pyproject.toml with [project] dependencies). Not searched: hidden folders, node_modules, site-packages, __pycache__, virtualenvs (pyvenv.cfg); symlinks aren't followed; at most 2000 folders are opened (a cut-short search never picks). Exactly one: checked. Several: listed (first 10, then a count), exit 2.
  4. A root file with nothing to check gives way to the next root lockfile name that has a package, then to the root pyproject.toml, with a note naming the file passed over and why. If nothing better exists the run is exactly as before (exit 0, "No packages to check", no new note). With --environment the pixi.lock is read whatever it holds.
  5. Nothing found: the error keeps its no lockfile found in DIR start, says what was looked for, and gives the reason a pyproject.toml couldn't be checked instead of a command that would only repeat that error.

A note on stderr says which file was read whenever it isn't the root lockfile (printed with --quiet too, like the direct-dependencies note). --json gets a top-level directory_inputs list (directory, file, reason: lockfile / pyproject / requirements / subfolder, and empty: the files passed over, with why); sources is unchanged. The "pick one" error is a DirectoryChoiceError (a SourceError) and its --json error object also has candidates.

Where I was stricter than "exactly one: check it"

The brief for this change was "never give an answer from a file a human wouldn't call the project's dependencies". Three cases are therefore listed as a command (exit 2) instead of checked, even when there is only one candidate:

  • a requirements file or folder whose name has dev, test(s), doc(s), example(s), sample(s), demo(s), bench(mark), lint, ci, typing, fixtures or templates as a word (requirements-dev.txt, docs/requirements.txt, e2e_tests/uv.lock). Such folders only count when no other subfolder has an input;
  • the one subfolder input when the root is itself a project (setup.py, setup.cfg, or a pyproject.toml with [project], [build-system] or Poetry dependencies): the project's dependencies are at the root where wheelgap couldn't read any, so tools/requirements.txt isn't them;
  • anything from a search that hit the folder cap.

On the full trees this holds back 9 repos that have exactly one such candidate (e.g. huggingface/transformers benchmark_v2/requirements.txt, python/cpython Doc/pylock.toml, opendatalab/MinerU docs/requirements.txt, three requirements-dev.txt/-docs.txt). Open question: check those too, with the note? It would add up to 9 answered; I kept them out because a green run from docs/requirements.txt reads as "the project is fine".

No "main file" guess (requirements/base.txt, default.txt, prod*.txt): in the corpus the several-files cases are vllm (common/cpu/cuda/…), faceswap (_requirements_base plus one per GPU vendor), DeepSpeed, celery (default.txt among 10), ColossalAI, Fooocus (requirements_docker.txt, requirements_versions.txt), academic-research-skills. base/common there is what every variant includes, not what anyone installs, and the answer differs per variant (that is the point of the split), so the list is the honest output. A rule could be added later for a name the maintainers decide is safe.

A pyproject.toml whose [project] table lists no dependencies and no extras is now the answer (No packages to check., exit 0, as wheelgap DIR/pyproject.toml gives) unless the root has one requirements file that isn't dev/docs-named (then that is checked, with a note: Stability-AI/generative-models → requirements/pt2.txt) or subfolders have inputs (then they are listed). Before, such a directory was exit 2.

Other entry points

  • --dockerfile X DIR and no input at all (.): same code (load_inputs), so the same search; one test.
  • MCP check_lockfile / check_dockerfile: they run the CLI, so the same search; the note is in notes. mcp.py change: an indented error line stays on its own line instead of being joined with ; , so the candidate list is readable. check_dockerfile still adds "(pass 'path' …)" to the nothing-found error, which keeps its wording.
  • Python API check_lockfile() and wheelgap diff: unchanged on purpose. They have no notes to say which file was picked, so they keep find_lockfile (root lockfile by name, old message). Documented.
  • scan.py: doesn't take directories.

Corpus, before and after

Check A of the corpus (wheelgap <repo> -p 3.13,3.15 -t linux-x86_64,linux-aarch64,macos-arm64,win-amd64 --json, classified as run_checks.py does) on all 300 folders:

answered answered, 0 packages candidates listed nothing found
main (18bbad8) 172 (57%) 4 – 124
this PR, corpus folders as fetched 249 (83%) 5 28 18
this PR, real trees to depth 3 233 (78%) 4 48 15

The corpus folders hold the root files plus at most 3 nested files per repo, so "as fetched" overstates the single-subfolder case (langchain-ai/langgraph has 9 nested uv.lock, the corpus has 1). For the third row I rebuilt the 83 repos not answered from a root lockfile or pyproject.toml from their git trees at the corpus commits: every lockfile-named file and pyproject.toml down to depth 3, root requirements* and requirements/* (lockfile-named files as empty placeholders, except the one a run would read, fetched; nested pyproject.toml fetched, since the search reads them). What that still doesn't cover: PostHog's tree is truncated by the API (its root files are missing from the corpus, so its row is wrong either way), symlinked inputs were left out, and the folder cap never triggers on a tree rebuilt this way.

Where the 233 come from: 172 root lockfile as before, 41 root pyproject.toml, 4 after an empty root file (TradingAgents and pandas → pyproject.toml, textual → poetry.lock, claude-seo → requirements.txt), 2 a single other-named requirements file, 14 a single subfolder input. Listed (48): 27 several subfolders, 7 several requirements files, 11 dev/tests/docs only, 3 a subfolder requirements.txt with a rival beside it (frigate, Resume-Matcher requirements-lock.txt, cleanyourtv). Nothing found (15): setup.py only, Poetry without a lock, environment.yml only, haystack's exclude-newer duration.

Answers a human might not call "the project's dependencies"

All 14 single-subfolder answers, judged by hand. Fine: 666ghj/MiroFish backend/uv.lock, abi/screenshot-to-code backend/poetry.lock, deepseek-ai/DeepSeek-V3 inference/requirements.txt, mouredev/Hello-Python Backend/FastAPI/requirements.txt, agentskills/agentskills skills-ref/uv.lock, 0xAX/linux-insides scripts/uv.lock, Asabeneh/30-Days-Of-Python python_for_web/requirements.txt. The repo's only Python, in a helper folder of a non-Python repo (true, but thin): public-apis scripts/requirements.txt, awesome-machine-learning scripts/requirements.txt, HelloGitHub script/github_bot/requirements.txt, claude-howto scripts/requirements.txt, anthropics/knowledge-work-plugins bio-research/skills/instrument-data-to-allotrope/requirements.txt. Doubtful: QwenLM/Qwen3 → eval/requirements.txt, apachecn/ailearning → old/requirements.txt. I tried eval and old as "side" words and took them out again: wshobson/agents has plugins/plugin-eval/uv.lock, a plugin named eval, and dropping it left one candidate that was then picked. Every word in that list can do this, which is why the list is short.

After review (f233cbb)

  • A subfolder pick is named by its path in the directory (scripts/requirements.txt) in the header, --markdown and --json's sources; a file passed by name keeps its bare name.
  • A subfolder requirements.txt is listed, not picked, when another requirements file could as well be the project's: one under another name beside it (frigate's docker/main/requirements-wheels.txt; dev/docs-named ones and constraints don't count) or a dev-named one at the root.
  • The picked subfolder is read as wheelgap FOLDER reads it, so a requirements.txt with nothing to check gives way to that folder's pyproject.toml. (In a list of several, the command still names the folder's first file.)
  • A folder that can't be read makes the search incomplete, so nothing is picked and the message names the folder.
  • In requirements/, names starting with readme, license, notes and the like (the list is in docs/inputs.md) aren't requirements files.
  • A picked file that isn't UTF-8 gives an error that names it.

The rebuilt trees for the third row now also carry the requirements-like siblings of each picked subfolder file, so the rival rule is measured.

Verified

Run: full suite, ruff check, ruff format --check, mypy locally. Every test in tests/test_directory.py and the changed one in tests/test_cli.py fails on main (checked by stashing src/). The corpus runs above, with real PyPI lookups; the before/after comparison shows no repo answered on main changed its file or bucket. Timing by hand: a capped search of a 2000-folder tree takes 0.3 s.

Read, not run: nothing here claims to match pip, uv or Docker; the search is wheelgap's own rule and the files are read by the existing readers.

Look hardest at

  • load_directory in sources.py: the order of the steps and the three "listed, not checked" rules.
  • The exit code change for a directory with only a no-dependencies pyproject.toml (2 → 0).
  • The note being printed under --quiet.
  • Error messages are now multi-line for the candidate list (first for a wheelgap error).

🤖 Generated with Claude Code

patrickballard and others added 5 commits November 21, 2026 14:56
Run on the 300 most-starred Python repos, wheelgap DIR answered for 172 and said 'no lockfile found' for 124 that had inputs: a pyproject.toml with [project] dependencies (41), requirements files under other names (12), inputs only in subfolders (52). And it stopped at a root file with nothing to check (4).

Directory mode now goes on to the root's pyproject.toml, then its one requirements file under another name, then the one input in a subfolder, with a note and a --json directory_inputs entry saying which file was read. It never picks one of several: those are listed as commands, exit 2. A root file with nothing to check gives way to the next one that has something. Directories that already had an answer are read as before; check_lockfile() and wheelgap diff are unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The tools join the CLI's error lines with '; ', which turned the new list of candidate files into 'Check one:;   wheelgap a;   wheelgap b'. An indented line now stays a line of its own.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The bullet needs the number the PR got.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The list in inputs.md was a paraphrase of _SIDE_WORDS; a reader deciding how to name a folder needs the real one, and how a word is matched.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…en a rival requirements file exists

Review of #656. A subfolder pick was labelled as a bare requirements.txt in the header, --markdown and --json's sources, which reads as the root's once stderr is gone (a job summary). And it was picked although another requirements file could as well be the project's: one under another name beside it (frigate's docker/main/requirements-wheels.txt) or a dev-named one at the root.

Also: the picked subfolder is read as wheelgap FOLDER reads it (an empty requirements.txt gives way to its pyproject.toml), a folder that can't be read means nothing is picked, README.txt and the like in requirements/ aren't requirements files, and a picked file that isn't UTF-8 is named in the error.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard
patrickballard merged commit 4415d6d into main Nov 21, 2026
13 checks passed
patrickballard added a commit that referenced this pull request Nov 21, 2026
…t checks (#662)

* wheelgap DIR: a compiled, fully pinned requirements file comes before pyproject.toml's ranges

#656 made wheelgap DIR read the root pyproject.toml before any requirements file under another name. In HKUDS/Vibe-Trading (requirements-lock.txt, uv pip compile with hashes) and apache/superset (requirements/base.txt, uv pip compile) that checked the ranges at their newest releases instead of what gets installed, and the note said there was no lockfile or requirements.txt. Now the one compiled (header, # via or --hash) and fully pinned (every package == or ===) file under another name is read instead, with a note saying why; several are listed with pyproject.toml (exit 2). Other files leave pyproject.toml first, and the note names them. requirements*.lock at the root counts as a requirements file under another name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* CHANGELOG: wheelgap DIR prefers a compiled, pinned requirements file (#662)

The entry for the PR, now that it has a number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* wheelgap DIR: name the requirements files beside the pyproject.toml it checks

When directory mode checks the root pyproject.toml, the note now says its direct dependencies were checked and names the root's requirements files under other names as commands (the first 3, then a count), those that look like pip-compile / uv pip compile / uv export output with every package pinned first ('requirements-lock.txt looks compiled and pinned: wheelgap ... checks what it pins'). Before, Vibe-Trading's note said 'no lockfile or requirements.txt' beside a requirements-lock.txt. The look is a hint only: which file is read is main's. --json's directory_inputs gets other_requirements with a compiled flag, in the schema and docs/output.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Directory mode hint: read only the file itself, and don't claim dependencies a pyproject.toml lacks

Review found that the compiled-file hint opened every requirements file beside pyproject.toml and followed its -r/-c, so a -r /dev/zero ran out of memory and a FIFO include hung, all for a hint; and that the note said direct dependencies were checked when the pyproject.toml listed none. The hint now skips files over 2 MB and any file with -r/-c, and the note says pyproject.toml was checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

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.

1 participant