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

[Feature Request] Python type annotation #155

Open
EarlMilktea opened this issue Aug 21, 2024 · 3 comments
Open

[Feature Request] Python type annotation #155

EarlMilktea opened this issue Aug 21, 2024 · 3 comments

Comments

@EarlMilktea
Copy link

Are there any plans for adding type hints to the Python bindings?
(If not, I'm willing to submit a PR 😄 )

@yangcal
Copy link
Collaborator

yangcal commented Aug 22, 2024

Currently our library is not set up to accept PR from github but we appreciate your feedback. I will create an internal ticket to keep track of this feature request.

@leofang
Copy link
Member

leofang commented Aug 26, 2024

Hi @EarlMilktea, could you be more explicitly on which APIs you need for type hints? Note that the low-level bindings are auto-generated Cython code (we do not modify them manually) and already use Cython static typing (instead of the Pure Python Mode). Cython's .pxd/.pyx files aren't really fully compatible with PEP-484 type hints. For example, cython/cython#4756 is one relevant issue.

For high-level pythonic APIs I agree type hints can be valuable, though some of the functions are hard to annotate (ex: contract accepts multiple array types, making typing impossible).

@EarlMilktea
Copy link
Author

EarlMilktea commented Aug 26, 2024

I don't have specific requests for details.
Let me just say that I submitted this issue with numpy.typing in mind: I know it cannot be exhaustive (ex. undocumented/internal modules can be untyped) or complete (ex. return type can be Any if too complex/array dtype can be missing) in principle.
Thank you in advance!

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

No branches or pull requests

3 participants