Skip to content

Type hints for other projects #697

Open

Description

@vnmabus

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?

Activity

  1. honno commented on Oct 23, 2023

    @honno
    Member

    +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:

  2. vnmabus commented on Nov 16, 2023

    @vnmabus
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions