Skip to content

Weekly accuracy check: compare wheelgap with pip on real packages - #252

Merged
patrickballard merged 2 commits into
mainfrom
fix-226-accuracy-check
Nov 12, 2026
Merged

patrickballard merged 2 commits into
mainfrom
fix-226-accuracy-check

Conversation

@patrickballard

@patrickballard patrickballard commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #226

Made with Claude Code.

What changed

  • scripts/check_against_pip.py: for 52 packages with interesting wheel sets (numpy, cryptography, pydantic-core, psycopg2-binary, orjson, lxml, grpcio, pyarrow, ruff, psutil, pywin32, mysqlclient, plus a pure wheel and an sdist-only control) and nine targets (3.14 on manylinux and musllinux x86_64/aarch64, win-amd64, win-arm64 and macos-arm64; 3.14t on linux-x86_64; 3.14 on linux-x86_64 with glibc 2.17):

    • wheelgap finds the latest release and checks it pinned (check_packages([(name, version)])), so yanked files count as they do for pip (PEP 592);
    • pip is asked what it would install of NAME==VERSION: pip install --dry-run --ignore-installed --no-deps --only-binary=:all: --report … with exactly the tags AGENTS.md lists. A dry run picks a file the same way pip download does, but fetches only the wheel's metadata;
    • pip picks a wheel ⇔ wheelgap says wheel. Every disagreement is printed in a table with a pip command that reproduces it, and the script exits 1.
  • "No wheel" needs positive evidence. pip prints "No matching distribution found" even when it can't reach the index (connection refused, a dead proxy, retries used up, a 404 or 429 that it skips). So pip runs with -vv, and "no wheel" counts only if the log has Fetched page https://pypi.org/simple/<name>/ and no Retrying ( or Could not fetch URL line. Anything else is an error. Errors, failed lookups and crashes are listed as "couldn't compare" and exit 2, so a broken run can't pass as clean. I checked this with real pip as well as in the tests: a dead HTTPS_PROXY and a 404 index both come out as errors.

  • pip is isolated. It runs with --isolated --no-cache-dir --disable-pip-version-check, every PIP_* variable is removed from its environment, and its only output is a small report in a temp folder deleted after each run.

  • Tags. musllinux goes down to musllinux_1_0, and Linux targets also get plain linux_<arch>, since pip and wheelgap accept both. AGENTS.md's musl line now lists musllinux_1_0, and the armv7l note says pip accepts linux_<arch> on every arch. Both are factual fixes; no rules change.

  • One case isn't compared. If the release has a live sdist, a yanked wheel that pip takes only because --only-binary hides the sdist is skipped. A normal install builds the sdist, so wheelgap's source is right there.

  • .github/workflows/accuracy.yml:

    • runs weekly (Monday) and on workflow_dispatch, with a concurrency group;
    • has permissions: contents: read, no secrets and persist-credentials: false, and uses the same SHA-pinned actions as ci.yml;
    • writes the report to the summary page inside a ~~~~~~~~~~ fence that the log can't close.

    CI's test job stays offline.

  • CONTRIBUTING.md: how to run it locally. It only adds how-to text; no rules change.

  • tests/test_check_against_pip.py, all offline:

    • the pip tags per target, including the macOS minor version, and that they match targets.py's on Linux;
    • run_pip with a faked subprocess.run: a wheel, a real no-wheel, retry-then-no-match, Could not fetch URL, a timeout, a non-zero exit with a wheel in the report, exit 0 without a wheel, and exit 0 with two wheels;
    • that PIP_* variables are dropped;
    • the pinned yanked case;
    • missing not being treated as wheel, and the unknown guard;
    • main's exit codes, and a crash exiting 2.

    I checked that the main guards are covered by changing each one and seeing a test fail.

No CHANGELOG entry: it's maintainer tooling, so users won't notice.

Why the pip tags are written out instead of taken from targets.py

pip is the referee here. If the script took its --platform list from Target.platform_tags(), a regression in targets.py's lists (like #79) would reach pip too, and both sides would agree on the wrong answer. So pip_platforms() follows AGENTS.md on its own. A unit test pins it to AGENTS.md's worked example, and another checks it against targets.py on Linux. The tracker's cross-check (wheelgap/tracker#48) deliberately does the opposite: it takes the tags from the released wheelgap that made the scan, so it has no copy of the tag lists, and this weekly check covers the lists themselves.

Verification

  • The first version of the script ran the full list once with pip download (pip 26.3, Python 3.14): 468 checks, 468 agree, 0 disagree.
  • After the review fixes, a 10-package sample on all nine targets (numpy, cryptography, psutil, ruff, pywin32, mysqlclient, docopt, requests, pyarrow, grpcio): 90 checks, 90 agree (61 wheel, 29 no wheel), 0 disagree, 0 couldn't be compared. A small run with a package that isn't on PyPI exits 2.
  • ruff format, ruff check, mypy and pytest (1643 passed) all pass.

.github/ and AGENTS.md changed, so this gets the closer review.

🤖 Generated with Claude Code

scripts/check_against_pip.py checks about 50 packages' latest releases on
nine targets with wheelgap and with `pip download --no-deps
--only-binary=:all:` given exactly the tags AGENTS.md lists, prints every
disagreement with its pip command, and exits 1 on any. A weekly,
read-only workflow runs it; CONTRIBUTING.md says how to run it locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes for #252:
- pip prints "No matching distribution found" when it can't reach the
  index too, so "no wheel" now needs pip's -vv log to show the project's
  page was fetched, with no retry and no failed fetch; anything else is
  an error. pip runs as `install --dry-run --report` (same choice as
  download, metadata only), isolated from pip.conf and PIP_* variables.
- wheelgap is asked about the pinned release, as pip is, so yanked files
  count the same (PEP 592); a yanked wheel pip takes only because
  --only-binary hides the sdist isn't compared.
- musllinux_1_0 and plain linux_<arch>, which pip and wheelgap accept, are
  passed too, and AGENTS.md's musl line lists musllinux_1_0.
- A crash exits 2; the workflow has a concurrency group and a fence the
  log can't close.
- Tests for run_pip with a faked subprocess.run, main's exit codes, and
  the guards mutation testing found untested.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patrickballard
patrickballard merged commit f2a77c4 into main Nov 12, 2026
9 checks passed
patrickballard added a commit that referenced this pull request Nov 12, 2026
…rdening

pixi.lock's PyPI package names now go through package_name like the other
lockfiles' (conda names are left alone: they aren't PEP 508 names). Its
quoted-scalars test used the name pure'wheel, which is now an input
error; it uses purewheel, and test_block_yaml_reads still covers ''.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patrickballard
patrickballard deleted the fix-226-accuracy-check branch November 13, 2026 08:34
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.

Accuracy check: compare wheelgap with pip on real packages every week

1 participant