patrick-kidger / patrick-kidger/jaxtyping
Why not `TypeVarTuple`?
Open
Nobody has claimed this yet.
question
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 96
- PR merge metrics
- No merged PRs in 30d
Description
TypeVarTuple is about to be introduced in Python 3.11, but it's already usable with typing_extensions.
Docs: https://docs.python.org/3.11/library/typing.html#typing.TypeVarTuple
Example:
from typing import Generic, Literal, TypeVar
from typing_extensions import TypeVarTuple, Unpack
dims = TypeVarTuple("dims")
dtype = TypeVar("dtype")
dim1 = Literal["dim1"]
dim2 = Literal["dim2"]
dim3 = Literal["dim3"]
batch = Literal["batch"]
c1 = Literal["c1"]
c2 = Literal["c2"]
class f32(Generic[Unpack[dims]]): ...
class PyTree(Generic[dtype]): ...
def matrix_multiply(x: f32[dim1, dim2], y: f32[dim2, dim3]) -> f32[dim1, dim3]:
...
def accepts_pytree_of_ints(x: PyTree[int]):
...
def accepts_pytree_of_arrays(x: PyTree[f32[batch, None, c2]]):
...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files or tests. Start by reviewing the project's current typing support against Python 3.11's TypeVarTuple documentation and the typing_extensions examples; done would require a decided scope and support for the examples shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100