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

Type hints for other projects #697

Open
vnmabus opened this issue Oct 23, 2023 · 2 comments
Open

Type hints for other projects #697

vnmabus opened this issue Oct 23, 2023 · 2 comments
Labels
topic: Static Typing Static typing.

Comments

@vnmabus
Copy link

vnmabus commented Oct 23, 2023

I see that you are using type hints internally to check the spec. However, I am not sure if there are plans to export type hint annotations for being used in projects consuming and/or implementing this spec.

I am currently working in a project that uses Mypy to catch typing errors. I wanted to change it so that it does not assume NumPy arrays, but uses the interfaces and semantics defined in the array API standard. However, I am worried that doing so leaves me without a way to statically check via Mypy that my typing is correct. Is there currently any way to do it?

@honno
Copy link
Member

honno commented Oct 23, 2023

+1. #589 will make the existing type hints more practical by having our array class be a Protocol, and then we can think about packaging the type hints as a standalone package, or alongside stubs (#472).

See also:

@rgommers rgommers added the topic: Static Typing Static typing. label Oct 31, 2023
@vnmabus
Copy link
Author

vnmabus commented Nov 16, 2023

I also noticed that, although it would be very useful to make the Array protocol generic w.r.t. shape and dtype, that could not be meaningfully used without Python support for higher kinded types, and there is not even a PEP for that yet: python/typing#548.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: Static Typing Static typing.
Projects
None yet
Development

No branches or pull requests

3 participants