SimpleBLE
SimpleBLE copied to clipboard
Python library needs interfaces and type hinting
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