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

Python library needs interfaces and type hinting #291

Open
dpkristensen opened this issue Feb 13, 2024 · 0 comments
Open

Python library needs interfaces and type hinting #291

dpkristensen opened this issue Feb 13, 2024 · 0 comments

Comments

@dpkristensen
Copy link

This library has nice functionality, but the Python bindings are really difficult to use:

  • No interface definitions (*.pyi), so it is difficult to tell what the function call signatures are, and even more difficult to tell what the signatures of callback functions are. One has to go look at the C++ code and try to infer how to use it rather than being able to rely on type hinting.
  • Modern IDEs (e.g., VS code) will use libraries such as pylint to identify problems with the code before it is run, so there are many false positives identified in calls to this library due to lack of documentation.
  • Many of the functions in data classes (e.g., Service and Characteristics) would be better represented as properties.
  • Python objects have no dict. The classes do, but it would be nice if the objects did as well for runtime inspection.

Keeping the bindings up to date by hand would require extra effort, and pybind11 does not generate typing information; but there are other tools that might help to generate it from the bindings, such as https://pthom.github.io/litgen/litgen_book/00_00_intro.html

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

1 participant