Skip to content

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Apr 16, 2025

Source commit:
python/typeshed@45c0e52

Typeshed has dropped support for Python 3.8 now! Merge only when mypy can drop support for --python-version 3.8 as well.

@cdce8p cdce8p marked this pull request as draft April 16, 2025 11:10
@github-actions

This comment has been minimized.

@cdce8p

This comment was marked as outdated.

@cdce8p cdce8p mentioned this pull request Apr 16, 2025
@cdce8p cdce8p marked this pull request as ready for review April 16, 2025 15:39
@github-actions

This comment has been minimized.

@cdce8p

This comment was marked as outdated.

cdce8p and others added 9 commits May 19, 2025 11:43
This is allegedly causing large performance problems, see 13821 typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing to undo. Patching this in typeshed also feels weird, since there's a more general soundness issue. If a typevar has a bound or constraint, we might not want to solve it to a Literal. If we can confirm the performance regression or fix the unsoundness within mypy, I might pursue upstreaming this in typeshed. (Reminder: add this to the sync_typeshed script once merged)
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

trio (https://github.com/python-trio/trio) + src/trio/_repl.py:26: error: Unused "type: ignore" comment [unused-ignore] prefect (https://github.com/PrefectHQ/prefect) + src/prefect/filesystems.py:162: error: Value of type variable "_StrPathT" of "copytree" cannot be "Optional[str]" [type-var] - src/prefect/filesystems.py:162: error: Argument 2 to "copytree" has incompatible type "Optional[str]"; expected "Union[str, PathLike[str]]" [arg-type] pydantic (https://github.com/pydantic/pydantic) - pydantic/_internal/_decorators.py:200: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], ReturnType] | Any", expected "PydanticDescriptorProxy[ReturnType]") [return-value] + pydantic/_internal/_decorators.py:200: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], ReturnType] | Any | property", expected "PydanticDescriptorProxy[ReturnType]") [return-value] pandas (https://github.com/pandas-dev/pandas) + pandas/io/common.py:995: note: def open(cls, name: str | bytes | PathLike[str] | PathLike[bytes] | Buffer | None, mode: Literal['r|*', 'r|', 'r|gz', 'r|bz2', 'r|xz'], fileobj: _Fileobj | None = ..., bufsize: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., errors: str = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ...) -> TarFile + pandas/io/common.py:995: note: def open(cls, name: str | bytes | PathLike[str] | PathLike[bytes] | Buffer | None, mode: Literal['w|', 'w|xz'], fileobj: _Fileobj | None = ..., bufsize: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., errors: str = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ...) -> TarFile + pandas/io/common.py:995: note: def open(cls, name: str | bytes | PathLike[str] | PathLike[bytes] | Buffer | None, mode: Literal['w|gz', 'w|bz2'], fileobj: _Fileobj | None = ..., bufsize: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., errors: str = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., compresslevel: int = ...) -> TarFile + pandas/io/formats/csvs.py:264: error: Argument "quoting" to "writer" has incompatible type "int"; expected "Literal[0, 1, 2, 3]" [arg-type] static-frame (https://github.com/static-frame/static-frame) + static_frame/core/frame.py:9096: error: Argument "quoting" to "writer" has incompatible type "int"; expected "Literal[0, 1, 2, 3, 4, 5]" [arg-type] spark (https://github.com/apache/spark) + python/pyspark/sql/session.py:166: error: Signature of "__get__" incompatible with supertype "property" [override] + python/pyspark/sql/session.py:166: note: Superclass: + python/pyspark/sql/session.py:166: note: @overload + python/pyspark/sql/session.py:166: note: def __get__(self, None, type, /) -> classproperty + python/pyspark/sql/session.py:166: note: @overload + python/pyspark/sql/session.py:166: note: def __get__(self, Any, type | None = ..., /) -> Any + python/pyspark/sql/session.py:166: note: Subclass: + python/pyspark/sql/session.py:166: note: def __get__(self, instance: Any, owner: Any = ...) -> Builder urllib3 (https://github.com/urllib3/urllib3) + test/test_response.py:770: error: Unused "type: ignore" comment [unused-ignore] + test/test_response.py:770: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var] + test/test_response.py:770: note: Error code "type-var" not covered by "type: ignore" comment + test/test_response.py:782: error: Unused "type: ignore" comment [unused-ignore] + test/test_response.py:782: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var] + test/test_response.py:782: note: Error code "type-var" not covered by "type: ignore" comment + test/test_response.py:787: error: Unused "type: ignore" comment [unused-ignore] + test/test_response.py:787: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var] + test/test_response.py:787: note: Error code "type-var" not covered by "type: ignore" comment + test/test_response.py:800: error: Unused "type: ignore" comment [unused-ignore] + test/test_response.py:800: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var] + test/test_response.py:800: note: Error code "type-var" not covered by "type: ignore" comment materialize (https://github.com/MaterializeInc/materialize) - misc/python/materialize/mzbuild.py:825: error: Incompatible types in assignment (expression has type "BufferedRandom", variable has type "BufferedReader") [assignment] + misc/python/materialize/mzbuild.py:825: error: Incompatible types in assignment (expression has type "BufferedRandom", variable has type "BufferedReader[_BufferedReaderStream]") [assignment] beartype (https://github.com/beartype/beartype) + beartype/claw/_importlib/_clawimpload.py:447: error: Unused "type: ignore" comment [unused-ignore] werkzeug (https://github.com/pallets/werkzeug) - tests/test_wsgi.py:158: error: Incompatible types in assignment (expression has type "TextIOWrapper[BufferedReader]", variable has type "LimitedStream") [assignment] + tests/test_wsgi.py:158: error: Incompatible types in assignment (expression has type "TextIOWrapper[BufferedReader[LimitedStream]]", variable has type "LimitedStream") [assignment] + tests/test_wsgi.py:158: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "LimitedStream" [type-var] 
@hauntsaninja hauntsaninja merged commit 33d1eed into python:master May 27, 2025
18 checks passed
@cdce8p cdce8p deleted the sync-typeshed branch May 27, 2025 20:22
hauntsaninja pushed a commit that referenced this pull request May 28, 2025
Drop last remaining support for Python 3.8. Support for running with 3.8 was removed in #17492 already. This PR removes the option to use 3.8 with `--python-version` since the type stubs only support 3.9+, see #18930.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants