Skip to content
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

Emit PEP 585 syntax from stubgen #16737

Open
ktbarrett opened this issue Jan 2, 2024 · 1 comment
Open

Emit PEP 585 syntax from stubgen #16737

ktbarrett opened this issue Jan 2, 2024 · 1 comment
Labels

Comments

@ktbarrett
Copy link

Feature

stubgen currently does not emit PEP 585 syntax, it should, it is permissible, and typeshed has been using PEP 585 syntax for a long while now.

For example, stubgen outputs the following non-PEP-585 syntax in the most current version.

from typing import Tuple

def get_sim_time() -> Tuple[int, int]: ...

Pitch

stubgen should output PEP-585 syntax.

def get_sim_time() -> tuple[int, int]: ...
@AlexWaygood AlexWaygood added topic-stubgen topic-pep-585 PEP 585 (builtin generics) labels Jan 6, 2024
@hamdanal
Copy link
Collaborator

I have a working prototype of this that I haven't submitted yet. It uses some of the changes made in #16519 so I would like for that PR to get merged first (the other PR is also less controversial so if it is not accepted I don't this will be accepted).

JelleZijlstra pushed a commit that referenced this issue Feb 18, 2024
)

Addresses part of #16737

This only replaces typing symbols that have equivalents in the
`builtins` module. Replacing other symbols, like those from the
`collections.abc` module, are a bit more complicated so I suggest we
handle them separately.

I also changed the default `TypedDict` module from `typing_extensions`
to `typing` as typeshed dropped support for Python 3.7.
hamdanal added a commit to hamdanal/mypy that referenced this issue Feb 20, 2024
…hon#16780)

Addresses part of python#16737

This only replaces typing symbols that have equivalents in the
`builtins` module. Replacing other symbols, like those from the
`collections.abc` module, are a bit more complicated so I suggest we
handle them separately.

I also changed the default `TypedDict` module from `typing_extensions`
to `typing` as typeshed dropped support for Python 3.7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants