Skip to content

Postpone annotation evaluation in engine_compat.py so main's PEP 604 ratchet holds - #12556

Merged
danielhanchen merged 1 commit into
mainfrom
studio/engine-compat-future-annotations
Oct 2, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio/engine-compat-future-annotations

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Repo tests (CPU, rest) is red on main since #11491 (merged 2026-10-02 13:40 UTC), and on every PR whose run includes it (#12528, #12526, #12535):

FAILED tests/test_python39_compatibility.py::test_studio_evaluated_unions_do_not_grow
36 studio files now evaluate PEP 604 unions on the floor, against 35 recorded.
    studio/backend/requirements/engines/engine_compat.py

engine_compat.py, added by #11491, annotates wheel_size(...) -> int | None without from __future__ import annotations, so the union is evaluated when the function is defined and raises TypeError on the Python 3.9 floor. The ratchet asks for the future import rather than a higher count, and nothing in the script reads annotations at runtime (no dataclasses, pydantic or get_type_hints), so postponing them changes nothing else.

Change

studio/backend/requirements/engines/engine_compat.py: from __future__ import annotations after the module docstring.

Verification

Check main this PR
tests/test_python39_compatibility.py test_studio_evaluated_unions_do_not_grow fails, naming this file 8 passed
studio/backend/tests/test_managed_engines.py (reads this script's output) 207 passed
function definitions executed under Python 3.9.25 annotations evaluated at definition time load cleanly

tests/test_formatter_fixed_point.py passes.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T18:42:44.774073Z a50dd1a Manual request
🔒 Security Review ⚠️ Failed 2026-10-02T18:40:21.681094Z a50dd1a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-02T18:40:19.118683Z a50dd1a PR opened
🔒 Security Review ⚠️ Failed 2026-10-02T18:40:21.681094Z a50dd1a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: a50dd1adff

ℹ️ 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".

@danielhanchen
danielhanchen merged commit 0b108f0 into main Oct 2, 2026
@danielhanchen
danielhanchen deleted the studio/engine-compat-future-annotations branch October 2, 2026 20:53
JoshuaL3000 pushed a commit to JoshuaL3000/unsloth that referenced this pull request Oct 4, 2026
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