-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Deprecate _typeshed.Supports{Read,Write}
#14149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
srittau
wants to merge
2
commits into
python:main
Choose a base branch
from
srittau:reader-writer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace with `typing_extensions.{Reader,Writer}` in stdlib
Draft until typing_extensions 4.14.0 final is released. I'll give the third-party stubs a week or two after the release. |
Diff from mypy_primer, showing the effect of this PR on open source code: django-stubs (https://github.com/typeddjango/django-stubs)
+ django-stubs/core/management/utils.pyi:4: error: class _typeshed.SupportsWrite is deprecated: Use typing_extensions.Writer instead. Will be removed in December 2025 or later. [deprecated]
+ django-stubs/core/serializers/json.pyi:8: error: class _typeshed.SupportsRead is deprecated: Use typing_extensions.Reader instead. Will be removed in December 2025 or later. [deprecated]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/logging.py: note: In class "WarningStreamHandler":
+ sphinx/util/logging.py:204:50: error: Type argument "SafeEncodingWriter" of "StreamHandler" must be a subtype of "Writer[str]" [type-var]
+ sphinx/util/logging.py: note: In class "NewLineStreamHandler":
+ sphinx/util/logging.py:210:50: error: Type argument "SafeEncodingWriter" of "StreamHandler" must be a subtype of "Writer[str]" [type-var]
+ sphinx/util/logging.py: note: In function "setup":
+ sphinx/util/logging.py:636:26: error: No overload variant of "StreamHandler" matches argument type "LastMessagesWriter" [call-overload]
+ sphinx/util/logging.py:636:26: note: Possible overload variants:
+ sphinx/util/logging.py:636:26: note: def [_StreamT: Writer[str]] __init__(self, stream: None = ...) -> StreamHandler[TextIO]
+ sphinx/util/logging.py:636:26: note: def [_StreamT: Writer[str]] __init__(self, stream: _StreamT) -> StreamHandler[_StreamT]
+ sphinx/_cli/util/errors.py: note: In function "handle_exception":
+ sphinx/_cli/util/errors.py:183:9: error: No overload variant of "print" matches argument types "tuple[str, ...]", "SupportsWrite" [call-overload]
+ sphinx/_cli/util/errors.py:183:9: note: Possible overload variants:
+ sphinx/_cli/util/errors.py:183:9: note: def print(*values: object, sep: str | None = ..., end: str | None = ..., file: Writer[str] | None = ..., flush: Literal[False] = ...) -> None
+ sphinx/_cli/util/errors.py:183:9: note: def print(*values: object, sep: str | None = ..., end: str | None = ..., file: _SupportsWriteAndFlush[str] | None = ..., flush: bool) -> None
pandas (https://github.com/pandas-dev/pandas)
+ pandas/util/_print_versions.py:147: error: Argument 2 to "dump" has incompatible type "StreamReaderWriter"; expected "Writer[str]" [arg-type]
+ pandas/util/_print_versions.py:147: note: Following member(s) of "StreamReaderWriter" have conflicts:
+ pandas/util/_print_versions.py:147: note: Expected:
+ pandas/util/_print_versions.py:147: note: def write(self, str, /) -> int
+ pandas/util/_print_versions.py:147: note: Got:
+ pandas/util/_print_versions.py:147: note: def write(self, data: str) -> None
cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/executors.py: note: In member "run_jobs" of class "SingleJobExecutor":
+ cwltool/executors.py:243:34: error: Argument "file" to "print" has incompatible type "SupportsWrite[str] | None"; expected "Writer[str] | None" [arg-type]
|
This is a bit more primer output than expected (due to
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace with
typing_extensions.{Reader,Writer}
in stdlib