odoo icon indicating copy to clipboard operation
odoo copied to clipboard

[16.0] type annotation ideas

Open sbidoul opened this issue 2 years ago • 9 comments

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.

sbidoul avatar Oct 15 '22 11:10 sbidoul

@rco-odoo, as promised

sbidoul avatar Oct 15 '22 11:10 sbidoul

Pull request status dashboard

robodoo avatar Oct 15 '22 11:10 robodoo

Can you add typing_extensions to the requirements.txt to have a working runbot build? :)

Xavier-Do avatar Oct 21 '22 14:10 Xavier-Do

@Xavier-Do done.

lmignon avatar Oct 21 '22 14:10 lmignon

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 avatar Nov 14 '22 11:11 yajo

@yajo it's not clear what you are referring to.

sbidoul avatar Nov 14 '22 17:11 sbidoul

The parts you highlighted in red, in models.py and api.py: imagen

yajo avatar Nov 15 '22 09:11 yajo

Was that forgotten or is there a better reason?

@yajo I must have forgotten to push this part. This worked just fine.

sbidoul avatar Nov 15 '22 18:11 sbidoul

@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?

zachwaite avatar Nov 29 '22 19:11 zachwaite

xref #167307

sbidoul avatar Jul 05 '24 16:07 sbidoul