Skip to content

Commit e9904b0

Browse files
jaracoclaude
andcommitted
Match the distutils sdist base type for the user_options override
The RUF012 ClassVar annotation used the Command base's union type, which mypy rejects as an incompatible override of distutils.command.sdist — whose typeshed stub (present on Python < 3.12) types user_options as list[tuple[str, str | None, str]]. Narrow the annotation to match. Surfaced only by CI's 3.11 job; local mypy defaults to a newer Python where the distutils stub is absent and the base resolves to Any, so `mypy .` passed. Reproduce with `mypy --python-version 3.11`. Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 parent 8fc2c84 commit e9904b0

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎setuptools/command/sdist.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ def walk_revctrl(dirname='') -> Iterator:
2626
class sdist(orig.sdist):
2727
"""Smart sdist that finds anything supported by revision control"""
2828

29-
user_options: ClassVar[
30-
list[tuple[str, str, str]] | list[tuple[str, str | None, str]]
31-
] = [
29+
# Match the (narrower) type of the distutils sdist base rather than the
30+
# Command base union, which mypy rejects as an incompatible override when
31+
# distutils stubs are present (Python < 3.12).
32+
user_options: ClassVar[list[tuple[str, str | None, str]]] = [
3233
('formats=', None, "formats for source distribution (comma-separated list)"),
3334
(
3435
'keep-temp',

0 commit comments

Comments
 (0)