Skip to content

[flake8-pyi] Note that PYI051 is an opinionated stylistic rule - #26179

Merged
ntBre merged 2 commits into
astral-sh:mainfrom
MakenRosa:docs-ruff-pyi051-opinionated
Jun 23, 2026
Merged

ntBre merged 2 commits into
astral-sh:mainfrom
MakenRosa:docs-ruff-pyi051-opinionated

Conversation

@MakenRosa

Copy link
Copy Markdown
Contributor

Summary

Clarifies the PYI051 documentation to describe the rule as opinionated and stylistic.

The added text explains that the rule focuses on type-checking behavior, while acknowledging cases where projects may intentionally keep Literal members for editor suggestions, generated documentation, or other non-type-checking purposes.

Validation

  • Compared the modified rule documentation against the current main version
  • git diff --no-index --check

Fixes #23134

@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre June 20, 2026 21:35
/// that `Literal`.
///
/// ## Why is this bad?
/// This rule is opinionated and stylistic. It treats type-checking behavior as

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.

This seems much too prominent to me. This would put the disclaimer at the very top of the rule docs. I'd probably put a mention of the pedantic nature at the very end in a ## Known issues section or similar.

@ntBre ntBre added the documentation Improvements or additions to public-facing documentation label Jun 22, 2026

@ntBre ntBre 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.

Thanks!

@ntBre
ntBre enabled auto-merge (squash) June 23, 2026 18:35
@ntBre
ntBre disabled auto-merge June 23, 2026 18:35
@ntBre ntBre changed the title docs: clarify PYI051 is opinionated [flake8-pyi] Note that PYI051 is an opinionated stylistic rule Jun 23, 2026
@ntBre
ntBre enabled auto-merge (squash) June 23, 2026 18:36
@ntBre
ntBre merged commit 93c8c59 into astral-sh:main Jun 23, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to public-facing documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve PYI051 docs to indicate that it is an opinionated stylistic rule

2 participants