This repository was archived by the owner on Jun 10, 2020. It is now read-only.
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
Add typing_extensions as a dependency #60
Closed
Description
The typing_extensions
module contains backports of new typing
features for earlier versions of Python. It is understood by type checkers like Mypy and Pyre. In #59 it is proposed that we add it as a dependency, which I think is a good idea. Beyond just that PR, some potential benefits are:
- Using
Literal
to better type specific (but fairly common) overloads, e.g.np.array(..., dtype="float")
Protocol
might be a good way to approach typingArrayLike
- Using
TypedDict
to better describe complex dtypes.
I imagine that the biggest concern would be forcing it to be a hard dependency of NumPy should the stubs be moved there, but I believe we can avoid that.
-
If everything stays stubs only, then it's not a problem
-
If we do add annotations to source files, we can still work around it with constructs like
from typing import TYPE_CHECKING if TYPE_CHECKING: from typing_extensions import Literal x: 'Literal[1]' = 1 # Or use `from __future__ import annotations` post 3.8 ...
Objections? In the absence of them we'll move forward with including it.
Metadata
Metadata
Assignees
Labels
No labels