Skip to content

[Internal] Fix ty type-checking errors after latest release#3978

Merged
hanouticelina merged 3 commits intomainfrom
fix-ty-quality
Mar 26, 2026
Merged

[Internal] Fix ty type-checking errors after latest release#3978
hanouticelina merged 3 commits intomainfrom
fix-ty-quality

Conversation

@hanouticelina
Copy link
Copy Markdown
Contributor

@hanouticelina hanouticelina commented Mar 26, 2026

ty v0.0.25 (released 2026-03-24) introduced a breaking change: # type: ignore[code] comments with mypy-specific codes (e.g. arg-type) are no longer treated as blanket suppressions by ty. Previously, ty ignored the code in brackets and suppressed all errors on the line. Now it only suppresses errors matching its own codes, so all existing # type: ignore[mypy-code] comments stopped working for ty.

Changes

  • Replace specific # type: ignore[mypy-code] with bare # type: ignore on affected lines — this is the only form both checkers respect.
  • Add import importlib.util in serialization/_torch.py to fix a new possibly-missing-submodule warning.
  • Fix new type errors in CLI modules (buckets, cache, repos, models, datasets, jobs, webhooks, _cli_utils).
  • Regenerate _async_client.py via make style.

Both uvx ty check src and mypy src pass.

Investigation and fixes done by Claude Code (Codex failed on this)


Note

Medium Risk
Mostly mechanical typing/comment changes, but it also tweaks CLI argument types and the hf repos settings --gated value mapping, which could impact command-line parsing and repo settings updates if incorrect.

Overview
Updates the codebase to be compatible with ty v0.0.25 by replacing many mypy-specific # type: ignore[...] suppressions with bare # type: ignore across inference, upload, filesystem, dataclass, and provider code.

Tightens CLI typing: hf repos create/duplicate now type --flavor/--storage as SpaceHardware/SpaceStorage (and the generated CLI docs now enumerate valid values), make_expand_properties_parser is made generic over allowed expand strings, and hf repos settings adjusts how --gated false is converted before calling update_repo_settings. Also adds import importlib.util to silence a new submodule warning and regenerates _async_client.py.

Written by Cursor Bugbot for commit a2e0cff. This will update automatically on new commits. Configure here.

@hanouticelina hanouticelina requested a review from Wauplin March 26, 2026 13:23
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

It looks like you've updated code related to model or dataset cards in this PR.

Some content is duplicated among the following files. Please make sure that everything stays consistent.

@bot-ci-comment
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Copy Markdown
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Too bad we can't use type ignore[code] anymore but honestly pretty fine with me like this^^

Thanks for handling it!

@hanouticelina
Copy link
Copy Markdown
Contributor Author

failing tests are unrelated

@hanouticelina hanouticelina merged commit 4c6b01e into main Mar 26, 2026
19 of 23 checks passed
@hanouticelina hanouticelina deleted the fix-ty-quality branch March 26, 2026 14:37
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.

3 participants