pyros-dev / pyros-msgs

ROS messages and service definitions for use with pyros
MIT License
0 stars 3 forks source link

better type system based on py3 type hints #3

Open asmodehn opened 7 years ago

asmodehn commented 7 years ago

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...

asmodehn commented 7 years ago

typing is supported for python 2.7 and mypy can be used for checking types (could be integrated with catkin_pip)

asmodehn commented 7 years ago

Note there is two distinct topics here :

asmodehn commented 7 years ago

Another (complementary ?) option : https://andreacensi.github.io/contracts/

asmodehn commented 7 years ago

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.

asmodehn commented 7 years ago

Python3 is now in progress in https://github.com/asmodehn/pyros-msgs/pull/14 However we are not doing anything with python3 types yet.