Skip to main content

typodoo

PyPI - Version PyPI - Python Version


Towards idiomatic Python with types for Odoo models.

This package supports the Odoo Experience 2022 talk (sildes, video).

It works best when a few type annotations are added to the Odoo core.

/!\ This is pre-alpha stuff /!\

What?

pip install typodoo to monkey patch the Odoo metaclass on Odoo startup.

Then, you can still write this, as usual:

from odoo import models, fields

class ResPartner(models.Model):
    _inherit = "res.partner"

    friend = fields.Boolean()
    industry2_id = fields.Many2one(
        'res.partner.industry',
        string='Secondary Industry',
        required=True,
    )

But you can also write this:

from odoo import fields

from odoo.addons.base.models.res_partner import (
    Partner, ResPartnerIndustry
)

class ResPartner(Partner):
    friend = fields.Boolean()
    industry2_id = fields.Many2one[ResPartnerIndustry](
        string='Secondary Industry',
    )

And also this:

from odoo.addons.my_addon.models.res_partner import ResPartner


partners = ResPartner(self.env).search([])

Why?

Idiomatic python.

Native auto completion in IDEs.

Static type checking.

Development

pip install -e .

Then, copy typodoo_activate.pth to $VIRTUAL_ENV/lib/python3.10/site-packages. Automating this setup is a TODO.

License

typodoo is distributed under the terms of the MIT license.

Release files for typodoo 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typodoo 0.4.1
File Size Uploaded
typodoo-0.4.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for typodoo 0.4.1
File Interpreter ABI Platform
typodoo-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / typodoo-0.4.1.tar.gz

Download URL typodoo-0.4.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4a5167f9fd5613f0489d9cc809cba00a3574bf1d8c7755071355feb8f1ead2dd
BLAKE2b-256 checksum
How to use checksums
2f19191b8ddb3a655a9f0fec80237284327cf31c7d1e8dd3801bf196ef124df4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2024.

Transparency log

Release files / typodoo-0.4.1-py3-none-any.whl

Download URL typodoo-0.4.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36123f7184398cf4e741e163ff9ef904cdf242ef51a90190665e1f5f0e6c511e
BLAKE2b-256 checksum
How to use checksums
6934670e5d5753e006ca6a56e37f8293e60bf862ff2fe3b89d18adec18777192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page