Adding type hints to OpenStack (starting with Oslo)

Cyril Roelandt cyril at
Sun Jan 27 01:03:26 UTC 2019


On 01/26/19 23:27, Sean Mooney wrote:
> there is also a third, looping stephen into the conversation.
> stephen did some experiments in this regard in the past.
> the commet form is backwards compatiabl but you can also put thetype hints in 
> a seperate .pyi file. The .pyi file version has the advantage of also working for c modules
> and not modifying any of the existing code.

Indeed, I forgot to mention this way of adding type hints. I must admit
it is not my favourite, since it requires editing code in two different
places. I did not know it worked with C modules as well, which is really

> we previously disscused the idea of using 
> to auto discover the types of existing libs and generate the stub .pyi files.
> ideally we should just be able to run our existing unit/functional test under mockeytype 
> to discover the relevent types and create the pyi files.

This seems interesting, but I think it requires the unit tests to be
really thorough. I guess this would require careful human review anyway.


More information about the openstack-discuss mailing list