-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: typing support for helpers #2588
Conversation
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.
As far as I'm concerned this is not too big or too extensive to still add to 2.6.0. But neither would I expect it's very urgent (do people actually add typing to their setup.py
?).
It doesn't really touch real code (save for the one mentioned change), just adds supporting files mostly, so I rather think it's fine too.
Given how poor support for typing is in typeshed for distutils (
Nope, which is why I didn't get around to it until now. (Plus it's best to add a pyi file after the py file is mostly stable). |
Ah yes, if it helps, why not. This one CI job keeps the |
It should complain if you add a function that has no type info (the *: Lying defined as making a type statement that does not satisfy the code type check. You may lie about inner details, inheritance, skip non public methods, etc, and that's not lying in this sense. |
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.
I think this is fine to include in 2.6.0.
Description
The goal here is to enable external typing support, so users can type check code containing pybind11 calls (just the
import pybind11
, not something magical with compiled extensions)! It is also checked internally with mypy, as well, integrated into the pre-commit checks.However, it did expose a small logical issue when checked internally;
sysconfig.get_path
logically is not required to return a string, so we could be adding None's to the path. Fixed by only adding truthy strings.If this is too large to go into 2.6.0, we can go with #2589 instead.
Suggested changelog entry:
- Added external typing support to the helper module, code from ``import pybind11`` can now be type checked.