-
Notifications
You must be signed in to change notification settings - Fork 125
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 python? #263
Comments
This is most likely due to your IDE or plug-in not relying on or parsing the help output. Maybe it's expecting the function to have a docstring in a given format? We could try to add one as described here and see if this solves your issue. I don't have time for this at the moment, but feel free to give it a try and contribute it back with a PR if it works. |
I'm sorry I don't have much knowledge in this subject. I use VSCode with Pylance. From my understanding and what I read online. For Pylance to understand the types of the module it is necessary a stub file. This stubfile can be generated with pybind11-stubgen or with mypy's stubgen. Both of them give me errors when trying to generate the stubs because some missing imports. |
Hi @Coelhomatias, I just tried generating stubfiles with |
@Phil26AT Thank you very much, you just saved me a lot of time and effort! |
I see a lot of type definitions in the code but for some reason type hints in python only show the Unknown type in the tooltip.
If I print
type(...)
it works and gives me the correct type.Would love some code completion instead of always running
help(...)
The text was updated successfully, but these errors were encountered: