这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@BenjaminBossan
Copy link
Member

Subjectively, there have been more issues recently with contributor PRs being rejected by ruff. This could possibly be caused by them using a different ruff version (presumably: more recent). This PR upgrades ruff to the latest version to hopefully reduce these issues.

The only change needed to make this ruff version pass was to disable UP045. This rule requires changing code like:

x: Optional[int]

into

x: int | None

in 220 places. Personally, I don't think it's crucial. Moreover, ruff won't fix this automatically, except with --unsafe-fixes. Note that Python 3.9 needs a __future__ import for this, so that could be the reason why it's not done automatically. Perhaps, once Python 3.9 is dropped, we can revisit this. For now, my preference is thus just to disable the rule, but LMK if you disagree.

Subjectively, there have been more issues recently with contributor PRs
being rejected by ruff. This could possibly be caused by them using a
different ruff version (presumably: more recent). This PR upgrades ruff
to the latest version to hopefully reduce these issues.

The only change needed to make this ruff version pass was to disable
UP045. This rule requires changing code like:

x: Optional[int]

into

x: int | None

in 220 places. Personally, I don't think it's crucial. Moreover, ruff
won't fix this automically, except with --unsafe-fixes (note that Python
3.9 needs a __future__ import for this, so that could be the reason). My
preference is thus just to disable the rule, but LMK if you disagree.
@HuggingFaceDocBuilderDev

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
Collaborator

@githubnemo githubnemo left a comment

Choose a reason for hiding this comment

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

Thanks for updating, I agree that we revisit the optional syntax when we drop 3.9

@BenjaminBossan BenjaminBossan merged commit eb1a25a into huggingface:main Aug 14, 2025
16 of 27 checks passed
@BenjaminBossan BenjaminBossan deleted the chore-upgrade-ruff-0.12.8 branch August 14, 2025 16:03
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