unsloth/scripts/data
Daniel Han a855815e1f
Strip distro .devN markers from the Colab pins (#11326)
* Strip distro .devN markers from the Colab pins

My own regression, from the oracle refresh in #11324. I dispatched the smoke
matrix on main to confirm the torchcodec fix and all eight legs failed earlier
than before, in 'Install Colab-shaped venv':

    ERROR: No matching distribution found for mako==1.3.2.dev0

The Colab image moved to Ubuntu 24.04 in this rotation, and its Mako is the
distro build, which labels itself 1.3.2.dev0. PyPI has 1.3.2 and never had
1.3.2.dev0. The freeze is a snapshot of an image, so it records versions as the
image labels them; the seed already strips a local version (+cu128) for exactly
this reason and had nothing for .devN. One unresolvable pin fails the bulk
resolve for all 690 of them.

Strip the marker to the base version rather than skipping the package: the image
really does carry Mako, and skipping would quietly shrink the venv this job
exists to reproduce.

Two tests, both replaying the seed's own transformation: no seeded pin may carry
a .dev or + marker PyPI cannot resolve, and a package whose marker was stripped
must still be pinned rather than dropped. Removing the strip fails both, the
first naming mako==1.3.2.dev0 exactly as CI did.

tests/notebooks: 324 passed, 2 skipped.

Not verified here: this box cannot run the smoke matrix. The failure and the
version list PyPI offered both come from the dispatched run on main
(35432057179), and the fix is checked against the committed snapshot rather
than against a resolve.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rewrite the distro pin by name, and test the workflow's own seed script

Two defects, both reported, both real.

The blind strip was wrong. .devN is also a genuine PEP 440 prerelease, and
rewriting it by pattern would turn a real pkg==2.0.dev3 into pkg==2.0, a
different release that may not exist and is not what the image had. Mako is a
distro anomaly, not a rule. It now goes through an explicit
distro_dev_version entry keyed on the exact (package, recorded version), so a
pin nobody has judged passes through untouched and fails the resolve loudly,
where a human decides.

The tests were worse: they re-implemented the seed transform, so deleting the
rewrite from the workflow left both of them green. The regression they exist to
catch was not guarded at all, and the sabotage I ran to 'prove' them removed
the strip from the test helper rather than from the workflow, so it proved
nothing. They now lift the seed heredoc out of the workflow and execute it, with
only the output paths redirected and the snapshot's python_version set to the
running interpreter -- that guard is about the snapshot matching the runner and
has its own test.

Sabotage against the workflow this time. Removing the rewrite fails both pin
tests, naming mako==1.3.2.dev0 exactly as CI did; putting the blind pattern
strip back fails the new test that an undeclared .devN pin is left alone.

tests/notebooks: 325 passed, 2 skipped.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Scope the marker assertion to declared rewrites, not to .devN as a shape

The assertion I added contradicted the test beside it. One deliberately injects
an undeclared pkg==2.0.dev3 and requires the seed to preserve it; the other
rejected every seeded .devN. A future snapshot carrying a genuine published
prerelease would satisfy the design and fail the suite, pushing a valid pin
towards being rewritten or suppressed for no reason.

Check the versions declared in distro_dev_version instead: a pin that still
carries a declared "from" version is one the rewrite failed to apply, which is
the actual regression. Local versions stay a blanket check, because the seed
strips +cu128 from every pin whatever the package, so any survivor there is a
defect.

Still catches the real thing: removing the rewrite from the workflow fails it
with ['mako==1.3.2.dev0']. And a freeze carrying some-real-pkg==2.0.dev3 now
passes, with the prerelease preserved.

tests/notebooks: 325 passed, 2 skipped.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Judge every .devN pin from the freeze, so losing the mapping fails loudly

Scoping the checks to what distro_dev_version declares left a hole I put there:
delete or misspell that key and the declared set is empty, so the marker test
passes vacuously and the rewrite test skips, while the seed hands pip the
unresolvable Mako==1.3.2.dev0 and every leg of the matrix dies exactly as it
did. A green suite over the original regression.

Read the requirement from the FREEZE instead, which is what the image actually
has. Every .devN entry must be judged one way or the other: a distro label with
a distro_dev_version rewrite, or a prerelease upstream really published, listed
under the new published_prerelease key and passed through untouched. Neither
answer is derivable from the version string, so a new one fails until a person
says which it is.

Deleting distro_dev_version now fails, and so does misspelling it, which is the
case that would otherwise have been silent.

tests/notebooks: 326 passed, 2 skipped.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-09-19 02:16:39 -07:00
..
colab_apt_list.gpu.txt Acknowledge the Colab oracle drift, and stop the diff hiding entries (#11324) 2026-09-19 00:04:01 -07:00
colab_os_info.gpu.txt Acknowledge the Colab oracle drift, and stop the diff hiding entries (#11324) 2026-09-19 00:04:01 -07:00
colab_pip_freeze.gpu.txt Acknowledge the Colab oracle drift, and stop the diff hiding entries (#11324) 2026-09-19 00:04:01 -07:00
colab_to_cpu_pin.json Strip distro .devN markers from the Colab pins (#11326) 2026-09-19 02:16:39 -07:00