-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add type annotations for hnswlib
#13529
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Not a full review, but some remarks:
|
Thank you for the quick response @srittau. I added a stubtest allowlist as you suggested. As for the usage of |
This comment has been minimized.
This comment has been minimized.
The easiest for now is using |
Alright, I replaced |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR adds type annotations for
hnswlib
, a popular library for nearest neighbor search in vector spaces.As this is my first time contributing to typeshed, I'd be happy to receive feedback on a couple of aspects:
stubtest
raises the errorhnswlib.Index is inconsistent, metaclass differs
and reportspybind11_builtins.pybind11_type
as the metaclass. However, sincepybind11
is not a runtime dependency ofhnswlib
, I understand that I'm not allowed to import it for type annotations. What is the best practice to handle this?pyright
reportsVariable not allowed in type expression
whenever I useNDArray
from Numpy as a type annotation. Numpy is a dependency ofhsnwlib
so I understand that I can use it in type annotations. How can I fix this?