typodoo
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.
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| typodoo-0.4.1.tar.gz | 5.0 kB | With provenance | Details for typodoo-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| typodoo-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for typodoo-0.4.1-py3-none-any.whl |
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 logRelease 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 logSecurity for typodoo 0.4.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for typodoo-0.4.1.tar.gz
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 logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.