-
Notifications
You must be signed in to change notification settings - Fork 330
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 support for python type hints in python package #309
Comments
It would also be possible to publish the typing information as a "stub-only" package separately, like |
Well its for sure possible to add support and package the There are tools in mypy that can autogenerate them, but they perform extremely poorly on boost::python generated bindings. For lanelet2, not a single function signature was deduced correctly when I tested it. |
This issue is stale because it has been open for 90 days with no activity. Is this issue still work in progress? If yes, mark it as "WIP" or comment, otherwise it will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. |
Would love to have Python type hints included! |
This shouldn't have been closed. This issue is waiting for a knight in shining armor to resolve it. |
Hello everyone 😄,
I would like to ask whether support for python typings could be added to the library, after the recent release of
lanelet2
on PyPI.This would enable static type checking in python (i.e. using mypy), intellisense features, and better feature discoverability in general (since functions will be suggested in the autocomplete UI in code editors).
This section on the mypy site explains how to publish type information for an existing PyPI package (for package maintainers). This is also related to the official PEP 561 - Distributing and Packaging Type Information.
I am not very familiar with
Boost.Python
, or how the C bindings work forlanelet2
, so I am unsure how one would implement the typing support in a way that requires little maintenance (i.e. so that type stub files are auto-generated, much like the python code is itself auto-generated anyway...).One possible, but very manual solution is to create the
.pyi
files manually, containing the public interface of the library ... and I have started doing this a little bit for a personal project, so I could contribute something to this, but it is clear that these.pyi
files would have to be updated with any interface change of the package ... which would presumably not be too hard, but one extra step.Please also see the
python/typeshed
repo for further reference. This repo is a collection of typing files for popular third-party packages which do not have typing support themselves, they are usually contributed by users of the libraries. The typing files forlanelet2
could also be added here ... however, the repo maintainers state as a requirement that "the third-party package needs to support any Python version supported by typeshed" ... which would be Python 3.7 and up, whichlanelet2
does not support.Anyways, perhaps this is something you would consider for future versions of the
lanelet2
python package.The text was updated successfully, but these errors were encountered: