Skip to content

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Sep 4, 2025

Tests and docs look good

@ntBre ntBre added this to the v0.13 milestone Sep 4, 2025
@ntBre ntBre added the rule Implementing or modifying a lint rule label Sep 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2025

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+21 -0 violations, +0 -0 fixes in 5 projects; 50 projects unchanged)

apache/airflow (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

+ airflow-core/src/airflow/serialization/serialized_objects.py:3239:36: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 

langchain-ai/langchain (+6 -0 violations, +0 -0 fixes)

+ libs/langchain/langchain/chat_models/base.py:40:34: PYI061 [*] Use `None` rather than `Literal[None]`
+ libs/langchain/langchain/chat_models/base.py:48:20: PYI061 [*] Use `None` rather than `Literal[None]`
+ libs/langchain/langchain/chat_models/base.py:51:34: PYI061 [*] Use `None` rather than `Literal[None]`
+ libs/langchain_v1/langchain/chat_models/base.py:36:34: PYI061 [*] Use `None` rather than `Literal[None]`
+ libs/langchain_v1/langchain/chat_models/base.py:44:20: PYI061 [*] Use `None` rather than `Literal[None]`
+ libs/langchain_v1/langchain/chat_models/base.py:47:34: PYI061 [*] Use `None` rather than `Literal[None]`

latchbio/latch (+1 -0 violations, +0 -0 fixes)

+ src/latch/types/metadata.py:496:45: PYI061 [*] Use `Optional[Literal[...]]` rather than `Literal[None, ...]` 

pandas-dev/pandas (+4 -0 violations, +0 -0 fixes)

+ pandas/core/groupby/groupby.py:4324:39: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ pandas/core/groupby/indexing.py:299:39: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ pandas/io/html.py:1045:28: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ pandas/io/html.py:223:32: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 

zulip/zulip (+9 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

+ corporate/views/billing_page.py:329:24: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ corporate/views/remote_billing_page.py:155:26: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ corporate/views/remote_billing_page.py:156:42: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ corporate/views/remote_billing_page.py:157:48: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ corporate/views/remote_billing_page.py:676:26: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ corporate/views/remote_billing_page.py:677:42: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ corporate/views/remote_billing_page.py:678:48: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ corporate/views/remote_billing_page.py:67:5: PYI061 [*] Use `Literal[...] | None` rather than `Literal[None, ...]` 
+ zerver/lib/event_types.py:906:62: PYI061 [*] Use `None` rather than `Literal[None]`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PYI061 21 21 0 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre
Copy link
Contributor Author

ntBre commented Sep 4, 2025

I can kind of see why people would prefer Literal[1, 2, 3, None] over Literal[1, 2, 3] | None or Optional[Literal[1, 2, 3]], but these all look like true positives to me. If you prefer the other style, I guess you just wouldn't activate the rule. Literal[None] -> None seems less contentious, but it does appear in the ecosystem check, mostly for @overloads.

@ntBre ntBre marked this pull request as ready for review September 4, 2025 17:50
@ntBre ntBre requested a review from AlexWaygood September 4, 2025 17:50
@ntBre
Copy link
Contributor Author

ntBre commented Sep 5, 2025

Just to record the decision here, we're aware of #20265, but I agree with Alex that it doesn't need to block stabilization.

@ntBre ntBre merged commit 82f73b7 into brent/0.13.0 Sep 5, 2025
35 checks passed
@ntBre ntBre deleted the brent/pyi061 branch September 5, 2025 14:05
@ntBre ntBre mentioned this pull request Sep 5, 2025
2 tasks
ntBre added a commit that referenced this pull request Sep 8, 2025
ntBre added a commit that referenced this pull request Sep 10, 2025
ntBre added a commit that referenced this pull request Sep 10, 2025
ntBre added a commit that referenced this pull request Sep 10, 2025
dcreager added a commit that referenced this pull request Sep 10, 2025
* main: (26 commits)
  Ignore deprecated rules unless selected by exact code (#20167)
  Stabilize adding future import via config option (#20277)
  [`flake8-errmsg`] Stabilize extending `raw-string-in-exception` (`EM101`) to support byte strings (#20273)
  Stabilize the remaining Airflow rules (#20250)
  [`flake8-bugbear`] Stabilize support for non-context-manager calls in `assert-raises-exception` (`B017`) (#20274)
  [`flake8-commas`] Stabilize support for trailing comma checks in type parameter lists (`COM812`, `COM819`) (#20275)
  [`pygrep_hooks`] Stabilize using`AsyncMock` methods in `invalid-mock-access` (`PGH005`) (#20272)
  Stabilize new strategy for classifying imports as first party (#20268)
  [`pylint`] Stabilize ignoring `__init__.py` for `useless-import-alias` (`PLC0414`) (#20271)
  [`pylint`] Stabilize adding U+061C to `bidirectional-unicode` (`PLE2502`) (#20276)
  [`flake8-simplify`] Stabilize fix safety of `multiple-with-statements` (`SIM117`) (#20270)
  Stabilize `pytest-raises-ambiguous-pattern` (`RUF043`) (#20253)
  Stabilize `f-string-number-format` (`FURB116`) (#20247)
  [`pyupgrade`] Remove `non-pep604-isinstance` (`UP038`) (#19156)
  [`pandas-vet`] Remove `pandas-df-variable-name` (`PD901`) (#19223)
  Remove deprecated macOS config file discovery (#19210)
  Stabilize `redundant-none-literal` (`PYI061`) (#20236)
  Stabilize `generic-not-last-base-class` (`PYI059`) (#20246)
  Stabilize `useless-class-metaclass-type` (`UP050`) (#20230)
  Stabilize `os-symlink` (`PTH211`) (#20229)
  ...
@user27182
Copy link

I can kind of see why people would prefer Literal[1, 2, 3, None] over Literal[1, 2, 3] | None or Optional[Literal[1, 2, 3]], but these all look like true positives to me.

This is more than a style preference, as it modifies the output of typing.get_args, see #20729. This auto-fix caused test failures in the pyvista repo when trying to update the ruff pre-commit hook:
pyvista/pyvista@d908bd7

@ntBre
Copy link
Contributor Author

ntBre commented Oct 7, 2025

Ah that's good to know. Thank you for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants