Skip to content

fix: add tokenizers to no-torch deps and TORCH_CONSTRAINT for arm64 macOS py313+ - #4748

Merged
danielhanchen merged 6 commits into
mainfrom
fix/no-torch-tokenizers-and-torch-constraint
Apr 1, 2026
Merged

danielhanchen merged 6 commits into
mainfrom
fix/no-torch-tokenizers-and-torch-constraint

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

  • Add tokenizers to no-torch-runtime.txt (before transformers). Without it, from transformers import AutoConfig crashes on startup because --no-deps skips transitive dependencies.
  • Add TORCH_CONSTRAINT variable to install.sh. On arm64 macOS with Python 3.13+, tightens torch requirement to >=2.6 since torch <2.6 has no cp313 arm64 wheels. Replaces the hard-coded constraint in the uv pip install line.
  • install.ps1 is intentionally left unchanged -- Windows/PowerShell does not need the arm64 macOS guard.

Changes

File What
studio/backend/requirements/no-torch-runtime.txt Add tokenizers before transformers
install.sh Add TORCH_CONSTRAINT variable with arm64+macOS+py313+ tightening; use $TORCH_CONSTRAINT in pip install
tests/python/test_tokenizers_and_torch_constraint.py 42 pytest tests across 7 classes
tests/sh/test_torch_constraint.sh 24 bash assertions
tests/run_all.sh Wire up both new test files
tests/python/conftest.py Register e2e marker

Test coverage (66 total, all passing)

Structural checks (instant, no network):

  • tokenizers present as standalone line, appears before transformers, torch not in file
  • TORCH_CONSTRAINT default and tightened assignments exist in install.sh
  • $TORCH_CONSTRAINT used in pip install line (not hard-coded)
  • Hard-coded torch>=2.4,<2.11.0 appears exactly once (default assignment only)
  • Tightening block guarded by SKIP_TORCH=false, arm64, and macos
  • install.ps1 unchanged: no TORCH_CONSTRAINT variable, still has hard-coded constraint

Shell snippet tests (bash subprocess, mocked python, no network):
13 platform/version combinations:

  • arm64 macOS + py3.13 --> torch>=2.6,<2.11.0 (tightened)
  • arm64 macOS + py3.14 --> tightened (future-proofed)
  • arm64 macOS + py3.12/3.11 --> default
  • Linux x86_64/aarch64 + py3.13 --> default (Linux unaffected)
  • Intel Mac x86_64 + py3.12/3.13 --> default (arch mismatch)
  • SKIP_TORCH=true + arm64 macOS + py3.13 --> block skipped, default
  • WSL + py3.13 --> default
  • py_minor=0 (failed query fallback) --> default
  • Boundary: py_minor=12 not tightened, py_minor=13 tightened
  • Mock uv receives correct constraint string for both cases

E2E tests (real uv venvs, Python 3.12 and 3.13):

  • from transformers import AutoConfig succeeds with tokenizers installed
  • tokenizers directly importable
  • torch NOT importable (no-torch scenario maintained)
  • Negative control: AutoConfig fails without tokenizers
  • Full no-torch sandbox: AutoConfig, tokenizers, safetensors, huggingface_hub all work; torch stays absent

Test plan

Fast tests run in <1s, E2E tests take ~10s (cached) to ~5min (cold):

# Fast tests
bash tests/sh/test_torch_constraint.sh
pytest tests/python/test_tokenizers_and_torch_constraint.py -v -k "not e2e"

# E2E tests
pytest tests/python/test_tokenizers_and_torch_constraint.py -v -m e2e

… for arm64 macOS py313+

Two installer fixes:

1. Add `tokenizers` to `no-torch-runtime.txt` before `transformers`.
   Without it, `from transformers import AutoConfig` crashes on startup
   because `--no-deps` skips transitive dependencies.

2. Add `TORCH_CONSTRAINT` variable to `install.sh`. On arm64 macOS with
   Python 3.13+, tighten the torch requirement to `>=2.6` since torch
   <2.6 has no cp313 arm64 wheels. The variable replaces the previously
   hard-coded constraint in the uv pip install line.

Includes 66 tests (42 pytest + 24 bash) covering:
- Structural checks on install.sh, install.ps1, no-torch-runtime.txt
- Shell snippet tests with mocked python for 13 platform/version combos
- Mock uv integration verifying correct constraint string
- E2E venv tests on Python 3.12 and 3.13 confirming AutoConfig works
- Negative control proving AutoConfig fails without tokenizers
- Full no-torch sandbox regression guards (safetensors, huggingface_hub)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a TORCH_CONSTRAINT variable in install.sh to ensure that Python 3.13+ on arm64 macOS uses torch>=2.6, addressing wheel availability issues. It also adds tokenizers to the no-torch-runtime.txt requirements to prevent crashes during AutoConfig imports. Comprehensive tests, including both shell and Python scripts, have been added to verify these changes. Feedback was provided regarding the portability of sed -i in the new shell tests, suggesting the use of heredocs instead to ensure compatibility across different sed implementations.

Comment thread tests/sh/test_torch_constraint.sh Outdated
Comment on lines +206 to +211
cat > "$TMPDIR_BASE/mock_uv_tight" <<'UVEOF'
#!/bin/bash
echo "$@" >> UV_LOG_PLACEHOLDER
UVEOF
sed -i "s|UV_LOG_PLACEHOLDER|$_UV_LOG|" "$TMPDIR_BASE/mock_uv_tight"
chmod +x "$TMPDIR_BASE/mock_uv_tight"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of sed -i is not portable across different sed implementations. For instance, BSD sed (default on macOS) requires an extension argument (e.g., sed -i ''), whereas GNU sed does not. Since this pull request specifically targets macOS fixes, ensuring test portability is important. Additionally, using | as a delimiter in sed can fail if the path in $_UV_LOG contains that character. A more robust and portable approach is to use an unquoted heredoc to expand the variable directly when creating the mock script.

Suggested change
cat > "$TMPDIR_BASE/mock_uv_tight" <<'UVEOF'
#!/bin/bash
echo "$@" >> UV_LOG_PLACEHOLDER
UVEOF
sed -i "s|UV_LOG_PLACEHOLDER|$_UV_LOG|" "$TMPDIR_BASE/mock_uv_tight"
chmod +x "$TMPDIR_BASE/mock_uv_tight"
cat > "$TMPDIR_BASE/mock_uv_tight" <<UVEOF
#!/bin/bash
echo "\$@" >> $_UV_LOG
UVEOF
chmod +x "$TMPDIR_BASE/mock_uv_tight"

Comment thread tests/sh/test_torch_constraint.sh Outdated
Comment on lines +233 to +238
cat > "$TMPDIR_BASE/mock_uv_default" <<'UVEOF'
#!/bin/bash
echo "$@" >> UV_LOG_PLACEHOLDER
UVEOF
sed -i "s|UV_LOG_PLACEHOLDER|$_UV_LOG2|" "$TMPDIR_BASE/mock_uv_default"
chmod +x "$TMPDIR_BASE/mock_uv_default"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the previous comment, sed -i is not portable and the delimiter choice is risky. Using an unquoted heredoc is a more robust way to inject the log path into the mock script.

Suggested change
cat > "$TMPDIR_BASE/mock_uv_default" <<'UVEOF'
#!/bin/bash
echo "$@" >> UV_LOG_PLACEHOLDER
UVEOF
sed -i "s|UV_LOG_PLACEHOLDER|$_UV_LOG2|" "$TMPDIR_BASE/mock_uv_default"
chmod +x "$TMPDIR_BASE/mock_uv_default"
cat > "$TMPDIR_BASE/mock_uv_default" <<UVEOF
#!/bin/bash
echo "\$@" >> $_UV_LOG2
UVEOF
chmod +x "$TMPDIR_BASE/mock_uv_default"

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b6b616845

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +414 to +418
self._pip_install(
venv,
"tokenizers", "transformers", "huggingface_hub",
"safetensors", "packaging", "pyyaml", "numpy",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert install succeeds before checking torch absence

test_torch_not_importable ignores the result of _pip_install(...), so this test can pass even when dependency installation fails (for example due to resolver/network/index issues) because import torch will still fail in an empty or partially installed venv. That makes this E2E check a false positive and can hide regressions in the no-torch requirements; capture the install result and assert returncode == 0 before asserting torch is unavailable.

Useful? React with 👍 / 👎.

…eps path

- Add missing transitive deps to no-torch-runtime.txt that are required
  under --no-deps: regex, typing_extensions, filelock, httpx, httpcore,
  certifi, idna, anyio, sniffio, h11. Without these, `from transformers
  import AutoConfig` still fails after install.sh --no-torch.

- Change all E2E tests to use --no-deps (matching what install.sh does)
  instead of normal dep resolution. Previous tests passed even with an
  incomplete manifest because uv backfilled transitive deps.

- Rewrite negative control to derive from the real no-torch-runtime.txt
  with tokenizers stripped, proving the specific fix matters.

- Replace GNU-only sed -i with heredoc in shell test for macOS compat.

- Remove unused os/sys imports from Python test file.

- Quote SKIP_TORCH and mock uv paths in bash -c strings.
@danielhanchen

Copy link
Copy Markdown
Member Author

/gemini review

Address review feedback: test_torch_not_importable and
test_tokenizers_directly_importable in Group 3 now assert that
uv pip install returns 0 before checking import behavior. This
prevents false positives when the install itself fails silently.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a dynamic TORCH_CONSTRAINT in install.sh to ensure compatibility for arm64 macOS users on Python 3.13+ and adds several transitive dependencies to no-torch-runtime.txt to prevent AutoConfig crashes during --no-deps installations. It also includes a new suite of structural and end-to-end tests. Review feedback highlights the potential need for requests and its dependencies in the requirements file to support remote Hub operations and notes PEP 8 styling inconsistencies regarding keyword argument spacing in the new test code.

Comment on lines +34 to +43
regex
typing_extensions
filelock
httpx
httpcore
certifi
idna
anyio
sniffio
h11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While adding these transitive dependencies helps resolve import issues, requests (and its own dependencies like urllib3 and charset-normalizer) appears to be missing from this list. Since transformers and huggingface_hub are installed with --no-deps in this context, requests is required for most remote operations, such as fetching model configurations from the Hub. Consider adding it to ensure the environment is functional beyond just basic imports.



def _read(path: pathlib.Path) -> str:
return path.read_text(encoding = "utf-8")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line uses spaces around the = sign for a keyword argument (encoding = "utf-8"), which violates PEP 8. This style is pervasive throughout the new test file (e.g., lines 160, 185, 392, 514).

Suggested change
return path.read_text(encoding = "utf-8")
return path.read_text(encoding="utf-8")
References
  1. PEP 8: Don’t use spaces around the = sign when used to indicate a keyword argument, or when used to indicate a default value for an unannotated function parameter. (link)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc6ec6cda3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

),
encoding = "utf-8",
)
self._pip_install(venv, "--no-deps", "-r", str(req_no_tokenizers))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert negative-control requirements install succeeds

Capture and check the return code from _pip_install(...) here before asserting AutoConfig import failure. In its current form, this negative-control test can pass when the requirements install fails for unrelated reasons (resolver/network/index issues), because from transformers import AutoConfig then fails simply because transformers was never installed, producing the same ModuleNotFoundError the test expects.

Useful? React with 👍 / 👎.

- Add missing install-success assertion in test_negative_control_no_tokenizers
  to prevent false positives from network/install failures.

- Tighten error message check to look for "tokenizers" in stderr or
  ModuleNotFoundError, rather than the generic "No module" substring
  which could match unrelated import failures.
@danielhanchen

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a dynamic TORCH_CONSTRAINT in install.sh to handle specific requirements for macOS arm64 on Python 3.13+, ensuring compatibility where older PyTorch wheels are unavailable. It also updates no-torch-runtime.txt with several transitive dependencies, such as tokenizers and httpx, which are necessary when installing with the --no-deps flag. A comprehensive suite of structural and end-to-end tests has been added to verify these installation fixes. Feedback indicates that additional transitive dependencies like requests, urllib3, and fsspec may still be required to ensure the no-torch environment is fully functional.

Comment on lines +34 to +43
regex
typing_extensions
filelock
httpx
httpcore
certifi
idna
anyio
sniffio
h11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While adding httpx and its dependencies is necessary for newer versions of huggingface_hub, several other critical transitive dependencies for transformers and huggingface_hub appear to be missing from this --no-deps list. Specifically, requests, urllib3, charset-normalizer, and fsspec are required for core functionality like downloading models and managing the cache. Without these, from transformers import AutoConfig or any subsequent from_pretrained call is likely to fail in a clean environment. Consider adding them to ensure the 'no-torch' environment is fully functional.

@danielhanchen

Copy link
Copy Markdown
Member Author

Review Summary (3 iterations)

Ran 3 full review cycles with 5 parallel automated reviewers + 3 independent manual reviews each round (8 reviewers per cycle, 24 total reviews).

Round 1 findings (all fixed)

Reviewers Severity Finding Status
7/8 High E2E tests did not use --no-deps, masking broken manifest Fixed in 31ef19b
6/8 High no-torch-runtime.txt missing transitive deps (regex, typing_extensions, filelock, httpx chain) needed under --no-deps Fixed in 31ef19b
2/8 Medium sed -i in shell test is GNU-only, fails on macOS Fixed in 31ef19b
2/8 Low Negative control not asserting install success; error check too loose Fixed in bc6ec6c, 5f07f30
2/8 Low Unquoted SKIP_TORCH and mock uv paths in bash -c Fixed in 31ef19b
1/8 Low Unused imports (os, sys) Fixed in 31ef19b

Round 2 findings

Reviewers Severity Finding Status
5/5 + 2/3 - APPROVE, no new defects -
1/3 Low anyio/h11 could use floor pins Not actionable -- uv resolves latest, and pins would add maintenance burden for no practical benefit

Round 3 findings

Reviewers Severity Finding Status
4/5 + 3/3 - APPROVE, no defects found -
1/5 Low Transitive deps lack version pins Same as round 2 -- not actionable for the same reason

Gemini review findings

Finding Status
sed -i not portable Already fixed before Gemini reviewed
Missing requests/urllib3/fsspec False positive -- verified from transformers import AutoConfig works without these. huggingface_hub 1.x uses httpx, not requests
PEP 8 spacing (encoding = "utf-8") Style formatting applied by pre-commit.ci, not introduced by this PR

Test results

All 66 tests pass consistently (ran 3x for stability):

  • 24/24 bash assertions
  • 42/42 pytest (30 fast + 12 E2E with real --no-deps venvs on Python 3.12 and 3.13)

Verification

Manually confirmed in a clean isolated venv that uv pip install --no-deps -r no-torch-runtime.txt followed by from transformers import AutoConfig succeeds, while import torch correctly fails.

@danielhanchen
danielhanchen merged commit d22b2a1 into main Apr 1, 2026
5 checks passed
@danielhanchen
danielhanchen deleted the fix/no-torch-tokenizers-and-torch-constraint branch April 1, 2026 13:12
shibizhao pushed a commit to shibizhao/unsloth-npu that referenced this pull request Apr 7, 2026
…acOS py313+ (unslothai#4748)

* fix: add tokenizers to no-torch runtime deps and add TORCH_CONSTRAINT for arm64 macOS py313+

Two installer fixes:

1. Add `tokenizers` to `no-torch-runtime.txt` before `transformers`.
   Without it, `from transformers import AutoConfig` crashes on startup
   because `--no-deps` skips transitive dependencies.

2. Add `TORCH_CONSTRAINT` variable to `install.sh`. On arm64 macOS with
   Python 3.13+, tighten the torch requirement to `>=2.6` since torch
   <2.6 has no cp313 arm64 wheels. The variable replaces the previously
   hard-coded constraint in the uv pip install line.

Includes 66 tests (42 pytest + 24 bash) covering:
- Structural checks on install.sh, install.ps1, no-torch-runtime.txt
- Shell snippet tests with mocked python for 13 platform/version combos
- Mock uv integration verifying correct constraint string
- E2E venv tests on Python 3.12 and 3.13 confirming AutoConfig works
- Negative control proving AutoConfig fails without tokenizers
- Full no-torch sandbox regression guards (safetensors, huggingface_hub)

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

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

* Fix incomplete no-torch manifest and align E2E tests with real --no-deps path

- Add missing transitive deps to no-torch-runtime.txt that are required
  under --no-deps: regex, typing_extensions, filelock, httpx, httpcore,
  certifi, idna, anyio, sniffio, h11. Without these, `from transformers
  import AutoConfig` still fails after install.sh --no-torch.

- Change all E2E tests to use --no-deps (matching what install.sh does)
  instead of normal dep resolution. Previous tests passed even with an
  incomplete manifest because uv backfilled transitive deps.

- Rewrite negative control to derive from the real no-torch-runtime.txt
  with tokenizers stripped, proving the specific fix matters.

- Replace GNU-only sed -i with heredoc in shell test for macOS compat.

- Remove unused os/sys imports from Python test file.

- Quote SKIP_TORCH and mock uv paths in bash -c strings.

* Assert install succeeds before checking import results in E2E tests

Address review feedback: test_torch_not_importable and
test_tokenizers_directly_importable in Group 3 now assert that
uv pip install returns 0 before checking import behavior. This
prevents false positives when the install itself fails silently.

* Assert install succeeds in negative control and tighten error check

- Add missing install-success assertion in test_negative_control_no_tokenizers
  to prevent false positives from network/install failures.

- Tighten error message check to look for "tokenizers" in stderr or
  ModuleNotFoundError, rather than the generic "No module" substring
  which could match unrelated import failures.

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

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

---------

Co-authored-by: Daniel Han <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
danielhanchen added a commit that referenced this pull request Sep 7, 2026
…control

setup.ps1 is what Windows updates run and it already carries the anyio repair
probe this one is modelled on, so the tokenizers probe belongs beside it rather
than only in setup.sh. Exercised against real venvs through pwsh: a stranded pair
forces the dependency pass, a healthy pair and an unreadable one do not, matching
the bash sibling case for case.

tests/python/test_tokenizers_and_torch_constraint.py's negative control dropped
the tokenizers line by comparing the whole line against "tokenizers". That
matched the bare entry #4748 added and matched nothing once #5359 gave it a
version bound, so the control installed tokenizers and then asserted an import
failure that could not happen. It has been failing on every tree since, unnoticed
because the class carries the e2e marker the CI lane filters out. Match by package
name instead, which survives the next bound too. The class passes 7/7.
danielhanchen added a commit that referenced this pull request Sep 8, 2026
…ort (#10431)

* Pin tokenizers with transformers so Apple Silicon keeps Train and Export

transformers declares a tokenizers window and enforces it at import, so a venv
holding a transformers that rejects its tokenizers cannot 'import transformers'
at all. mlx_lm imports transformers, so mlx_stack_blockers() reports a blocker
and Studio settles chat-only with Train and Export disabled.

A fresh 'install.sh --local' on macOS arm64 produced exactly that pair. The core
phase resolves with UV_OVERRIDE=overrides-darwin-arm64.txt and without
constraints.txt, and a uv override replaces every requirement on a package, so
that file's unbounded 'transformers>=5.5.0' also replaced pyproject's <=5.5.0
cap. Since transformers 5.16.0 (2026-08-26), the first release wanting
tokenizers>=0.23.1, that resolve lands transformers 5.16.1 + tokenizers 0.23.2;
step 3b of install_python_stack.py then installs extras-no-deps.txt with
--no-deps, which pins transformers back to 5.5.0 and leaves tokenizers stranded.
No commit here caused it: a third-party release walked into an unbounded
override, which is why the new gate checks the resolved pair rather than a
version number a diff would show.

extras-no-deps.txt now names both halves, which is the file that decides the
final versions on every platform and on both fresh install and update.
constraints.txt carries the same window globally, for the reason the anyio cap
gives: a later with-deps step must not re-resolve it up. no-torch-runtime.txt
spells its existing cap as the same full window so one canonical pair exists.

setup.sh gets a sibling of the anyio repair probe: an already-broken venv whose
unsloth is current takes the fast update path, which never reaches the step that
repairs the pair, so 'unsloth studio update' would report 'up to date' and fix
nothing. It reads metadata rather than importing transformers, since importing
is what is broken.

tests/studio/install/test_transformers_tokenizers_pair.py locks the shape: every
installing requirements file that pins transformers must bound tokenizers to the
window that release declares, no file may admit 0.23.2, and a sequential resolve
of the real macOS arm64 install (core phase, then the --no-deps overlay) must end
with a pair transformers accepts. On the tree before this commit, four of its six
checks fail.

* Drop two stale deselects from Backend CI

Both named a tokenizers pin no-torch-runtime.txt was missing; #5359 added it and
both tests pass now. They were redundant regardless: the -m filter on the same
command already excludes their e2e class marker.

* Bound the macOS arm64 transformers override to the version it pins against

The override existed to raise mlx-vlm/mlx-lm's transformers floor, but an
override replaces every requirement on the package, so the bare floor also
replaced unsloth's own transformers<=5.5.0 cap on the one uv command that does
not pass constraints.txt: install.sh's core install. From transformers 5.16.0
that resolve started landing 5.16.1 with tokenizers 0.23.2 on Apple Silicon,
which the later --no-deps pin turned into a stranded pair.

Capping at the version constraints.txt already pins makes the core phase resolve
consistently on its own rather than being repaired a step later. Verified with
uv pip compile for aarch64-apple-darwin / py3.13: transformers 5.5.0,
tokenizers 0.22.2, and mlx 0.32.1 / mlx-lm 0.31.3 / mlx-vlm 0.6.17 unchanged
from the uncapped resolve.

This cannot go unsatisfiable the way the huggingface_hub override once did: that
one replaced other packages' requirements on hub while a direct requirement still
had to be satisfied, whereas no requirement on transformers survives this
override to contradict it. A new test keeps the override and constraints.txt in
lockstep.

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

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

* Give the repair probe a Windows sibling, and restore a dead negative control

setup.ps1 is what Windows updates run and it already carries the anyio repair
probe this one is modelled on, so the tokenizers probe belongs beside it rather
than only in setup.sh. Exercised against real venvs through pwsh: a stranded pair
forces the dependency pass, a healthy pair and an unreadable one do not, matching
the bash sibling case for case.

tests/python/test_tokenizers_and_torch_constraint.py's negative control dropped
the tokenizers line by comparing the whole line against "tokenizers". That
matched the bare entry #4748 added and matched nothing once #5359 gave it a
version bound, so the control installed tokenizers and then asserted an import
failure that could not happen. It has been failing on every tree since, unnoticed
because the class carries the e2e marker the CI lane filters out. Match by package
name instead, which survives the next bound too. The class passes 7/7.

* Exclude the pinned release from the override test's excess check

* Derive the override's excess candidates from the pin

Building on the previous commit, which was right that the pinned release must not
count as excess. The remaining half is that a fixed pair of releases goes vacuous
once the pin passes them: with 5.16.1 pinned, neither 5.16.1 nor 5.15.1 is above
it and the check tests nothing. Derive the next minor and the next major from the
pin, keep the two named releases since they are the ones that shipped the
tokenizers window change, and the assertion keeps asking its question after every
future bump.

Verified both ways: passes on this branch, and against an unbounded override it
reports ['5.15.1', '5.16.1', '5.6.0', '6.0.0'].

* Make the resolver check fail only on a resolver verdict

Codex is right that this test runs in the ordinary CPU lane and reaches the index
twice plus a urlopen, so it had two ways to turn someone else's PR red for
reasons that say nothing about our pins: subprocess.TimeoutExpired was not caught
at all, and any uv failure whose stderr missed a four-word list became a hard
failure, which a 429 or an index 500 would.

Inverted instead of marked. Marking it e2e would take it out of the lane the
regression it guards actually reaches, and the e2e marker is registered in
tests/python/conftest.py, which does not cover this directory. Now the test fails
only when uv returns a resolution verdict (no solution found, unsatisfiable,
because, conflict) and skips on everything else, including a timeout, a missing
uv, an OSError, and a PyPI reply that is slow, throttled or not JSON. The compile
budget drops from 600s to 180s so a hung index cannot hold a job for ten minutes.

Verified all three ways against a live uv: an unreachable index skips, an
unsatisfiable pair still fails with 'No solution found when resolving
dependencies: Because transformers==5.5.0 depends on tokenizers>=0.22.0,<=0.23.0',
and a healthy resolve returns.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nilay Yadav <[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