odoo
odoo copied to clipboard
[16.0] type annotation ideas
This PR, which is not meant to be merged, goes along with my Odoo Experience 2022 talk "Towards Idiomatic Python with Types for the Odoo ORM" (slides, video).
It does not much more than the examples shown in the talk:
- annotate some core ORM methods
- annotate field descriptors
For the class instanciation and inheritance examples shown in the talk to work, you need to pip install typodoo
(repo), which monkey patches the metaclass.
@rco-odoo, as promised
Can you add typing_extensions
to the requirements.txt
to have a working runbot build? :)
@Xavier-Do done.
I'm missing here what is done in this slide: https://youtu.be/pAVGpEVORbY?t=373
Was that forgotten or is there a better reason?
@yajo it's not clear what you are referring to.
The parts you highlighted in red, in models.py
and api.py
:
Was that forgotten or is there a better reason?
@yajo I must have forgotten to push this part. This worked just fine.
@sbidoul @lmignon This is great work. Is there anything we in the greater community can do to contribute or encourage additional work in this area?
xref #167307