Open asmodehn opened 7 years ago
typing is supported for python 2.7 and mypy can be used for checking types (could be integrated with catkin_pip)
Note there is two distinct topics here :
Another (complementary ?) option : https://andreacensi.github.io/contracts/
pycontracts seems to be lacking quite a few features, especially when comparing with hypothesis... We have currently implemented a very basic functional type checker, following hypothesis strategies, not sure if the effort in improving pycontracts is worth it.
Not sure what should be done here to improve/solidify this... maybe generating a type checker for python from a more rigorously typed language like idris ?
Anyway it seems to be quite distinct from defining messages for pyros : We want to give python a nice type system that can :
This will help overall stability for our distributed system.
Python3 is now in progress in https://github.com/asmodehn/pyros-msgs/pull/14 However we are not doing anything with python3 types yet.
We should take inspiration from python3 type hints and https://www.python.org/dev/peps/pep-0483/
It would make things more solid, and would also provide simple python3 compatibility.
The type checker would operate at runtime, with the types providing a "contract" regarding the message structure and content.
Later we might want to extend it to provide contracts for complex node behaviors...