Skip to main content

A build backend for Odoo modules supporting multiple versions

Project description

Polytropos

Polytropos logo

Polytropos is a Python build backend for Odoo modules that enables writing code once and using it across multiple Odoo releases.

Features

  • Multi-release support: Write your module once, target multiple Odoo releases
  • Conditional manifests: Configure different manifest values per Odoo release, to let you include or exclude data files per release
  • Editable installs: Develop in editable is supported
  • PEP 517 compliant: Works with any PEP 517 compatible frontend

Quick Example

Replace your module's __manifest__.py with this pyproject.toml file:

[build-system]
requires = ["polytropos[build]"]
build-backend = "polytropos.build"

[project]
name = "odoo-addon-my-module"
version = "1.0.0"
dependencies = [
    # Specify supported Odoo versions here
    "odoo>=17"
]

# All versions have this data
[[tool.polytropos.manifest]]
depends = ["base"]
data = ["data/views.xml"]

# This section is only for Odoo 18+
[[tool.polytropos.manifest]]
releases = ">=18"
data = ["security/ir.model.access.csv"]

Then, inside the module folder:

# Don't forget the module must be a Python package
touch __init__.py

# Build wheels for different odoo releases
uv build --sdist
uv build --wheel --config-setting odoo_release=17.0
uv build --wheel --config-setting odoo_release=18.0
uv build --wheel --config-setting odoo_release=19.0

# List artifacts
ls -1 dist/
my_module-1.0.0.tar.gz
odoo_addon_my_module-17.0.1.0.0-py3-none-any.whl
odoo_addon_my_module-18.0.1.0.0-py3-none-any.whl
odoo_addon_my_module-19.0.1.0.0-py3-none-any.whl

Single branch, single code, multiple releases! 🤯

Installation

Python will auto-install the build backend when you build a module.

But yes, you can install a small CLI with:

pip install polytropos[cli]

For development, the recommended tool you need is uv. Then:

uvx polytropos[cli] --help-all

Why Polytropos?

Odoo modules traditionally require separate codebases or branches for each release. Polytropos solves this by generating release-specific code at build time, allowing you to maintain a single codebase.

So, it will help you or not depending on your product vision:

What is your product? What does that mean? Is Polytropos for you?
Odoo + its release + all addons in that release Customers that want new features must upgrade to newer Odoo releases. ⛔ No
Addons that should work always the same way Customers need new features and cannot wait for the upgrade to the next Odoo release; but when they upgrade, they expect the same features they have now ✅ Yes

Examples

Check out the examples folder for real-world modules with views, models, and tests that exercise the conditional logic.

Credits

Moduon logo

Polytropos is developed and maintained by Moduon. Need a professional Odoo partner? Contact us.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polytropos-3.2.1.tar.gz (127.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polytropos-3.2.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file polytropos-3.2.1.tar.gz.

File metadata

  • Download URL: polytropos-3.2.1.tar.gz
  • Upload date:
  • Size: 127.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for polytropos-3.2.1.tar.gz
Algorithm Hash digest
SHA256 a1e1a8001dcc20f087e39fe1c4f3e68cb343f97c1918ad9d1a10d47478be4c93
MD5 885e93734e40b8b7ce2d7b6e8ff52a60
BLAKE2b-256 499adfe906cf58d89c59f0522db72251cbf5fd8ec569a5ba973ee847bcb914b6

See more details on using hashes here.

File details

Details for the file polytropos-3.2.1-py3-none-any.whl.

File metadata

  • Download URL: polytropos-3.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for polytropos-3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffc117ea7042ba00e7f08ad03d34f4c3744eee701692e67b66d9a3bfc0b86a3b
MD5 6e45a910468252d83ddc51c108916756
BLAKE2b-256 ea6ba1280fd225ad884d019c0658a75d9e9a8cd7d8267b0cfad7d300dc9fd69b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page