Tryton Language Server

Here is a first iteration that implement the register in tryton.cfg: Use `tryton.cfg` to register in the Pool (!2392) · Merge requests · Tryton / Tryton · GitLab

I fully agree with albert.

One of the major benefits of Python is the ease of coding. Typing adds a lot of burden to developers and makes the code much less readable (and thus understandable).

Adding typing to the core modules might be a good idea (as adding typing to important Python packages), but requiring it for custom modules is not.

I have a better design which will prevent to import at runtime more types by removing the usage of cast:

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    class Party(metaclass=PoolMeta):
        __name__ = 'party.party'

    PartyType = type[Party]


class Custom(Model):
    ...

    def func(self):
        pool = Pool()
        Party: PartyType = pool.get('party.party')
        ...

And maybe it will be possible to add to mypy a check that the __name__ of PartyType is the same as the string passed to Pool.get.