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

PEP 613 (Explicit Type Aliases) tracker #4913

Closed
7 tasks done
srittau opened this issue Jan 6, 2021 · 14 comments
Closed
7 tasks done

PEP 613 (Explicit Type Aliases) tracker #4913

srittau opened this issue Jan 6, 2021 · 14 comments
Labels
project: feature tracker Tracks whether a typing feature can be used in typeshed stubs

Comments

@srittau
Copy link
Collaborator

srittau commented Jan 6, 2021

This issue is supposed to track when we can start to use explicit type aliases (PEP 613) in typeshed. Support is needed in released versions of:

@srittau srittau added the project: feature tracker Tracks whether a typing feature can be used in typeshed stubs label Jan 6, 2021
@srittau srittau changed the title PEP 613 Explicit Type Aliases tracker PEP 613 (Explicit Type Aliases) tracker Jan 6, 2021
@srittau
Copy link
Collaborator Author

srittau commented Jan 6, 2021

@rchen152 I am sorry for the mention spam, but does pytype support PEP 613? If not, would you mind me creating a ticket that we can reference from here?

@sproshev
Copy link
Contributor

sproshev commented Jan 6, 2021

Supported since PyCharm 2020.3 https://youtrack.jetbrains.com/issue/PY-42334

@rchen152
Copy link
Collaborator

rchen152 commented Jan 7, 2021

pytype doesn't support this yet. Opened google/pytype#787.

@srittau
Copy link
Collaborator Author

srittau commented Jun 14, 2021

I used this simple script to test this feature.

from typing_extensions import TypeAlias

Alias1 = str
Alias2: TypeAlias = str

def foo() -> Alias1: pass
def bar() -> Alias2: pass

reveal_type(foo)
reveal_type(bar)

@srittau
Copy link
Collaborator Author

srittau commented Dec 22, 2021

mypy 0.930 now supports this.

@rchen152
Copy link
Collaborator

pytype-2022.03.21 supports explicit type aliases.

@AlexWaygood
Copy link
Member

Seems like there's nothing left to do here :)

@srittau
Copy link
Collaborator Author

srittau commented Mar 22, 2022

Reopening as mypy still seems to have problems. #7534

@srittau srittau reopened this Mar 22, 2022
@AlexWaygood
Copy link
Member

@rchen152, #7534 also has several pytype errors, but they all look like valid type aliases to me — any idea what the problem is? :)

@rchen152
Copy link
Collaborator

Whoops, that's embarrassing XD
It looks almost like the type aliases aren't being stored at all - I'll investigate.

@srittau
Copy link
Collaborator Author

srittau commented Mar 30, 2022

mypy and pytype are now fixed. 🎉

@srittau srittau closed this as completed Mar 30, 2022
@laundmo
Copy link

laundmo commented Apr 4, 2022

Does the closing of this issue mean that TypeAlias can now be used in TypeShed?

if yes, this should probably be edited:

typeshed/CONTRIBUTING.md

Lines 241 to 242 in be64b01

- [PEP 613](https://www.python.org/dev/peps/pep-0613/) (TypeAlias):
see [#4913](https://github.com/python/typeshed/issues/4913)

@AlexWaygood
Copy link
Member

Does the closing of this issue mean that TypeAlias can now be used in TypeShed?

if yes, this should probably be edited:

typeshed/CONTRIBUTING.md

Lines 241 to 242 in be64b01

- [PEP 613](https://www.python.org/dev/peps/pep-0613/) (TypeAlias):
see [#4913](https://github.com/python/typeshed/issues/4913)

It does — and yes, CONTRIBUTING does need to be edited :) I think the guidance on ParamSpec is also slightly out of date.

PR welcome, if you'd like to help out!

@kkirsche
Copy link
Contributor

Does the closing of this issue mean that TypeAlias can now be used in TypeShed?
if yes, this should probably be edited:

typeshed/CONTRIBUTING.md

Lines 241 to 242 in be64b01

- [PEP 613](https://www.python.org/dev/peps/pep-0613/) (TypeAlias):
see [#4913](https://github.com/python/typeshed/issues/4913)

It does — and yes, CONTRIBUTING does need to be edited :) I think the guidance on ParamSpec is also slightly out of date.

PR welcome, if you'd like to help out!

#8397 created to address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: feature tracker Tracks whether a typing feature can be used in typeshed stubs
Projects
None yet
Development

No branches or pull requests

6 participants