Metadata-Version: 2.4
Name: polytropos
Version: 3.0.0
Summary: A build backend for Odoo modules supporting multiple versions
Author: Polytropos Team
License: LGPL-3
License-File: LICENSE.md
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: packaging>=24.0
Provides-Extra: build
Requires-Dist: pathspec>=0.12; extra == 'build'
Requires-Dist: whool>=1.3; extra == 'build'
Provides-Extra: cli
Requires-Dist: plumbum>=1.8; extra == 'cli'
Description-Content-Type: text/markdown

# Polytropos

![Polytropos logo](img/logo.svg){ width="400" style="display: block; margin: 0 auto;" }

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

## Features

-   **Multi-version support**: Write your module once, target multiple Odoo releases
-   **Conditional manifests**: Configure different manifest values per Odoo version, to
    let you include or exclude XML files per version (views, assets or other data)
-   **Editable installs**: Develop in editable mode with full version support
-   **PEP 517 compliant**: Works with any PEP 517 compatible frontend

## Quick Example

```toml title="pyproject.toml"
[build-system]
requires = ["polytropos[build]"]
build-backend = "polytropos.build"

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

[tool.polytropos]
default_odoo_release = "18.0"

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

# In Odoo 18+, there are special permissions
[[tool.polytropos.manifest]]
releases = ">=18"
data = ["security/ir.model.access.csv"]
```

## Installation

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

But yes, you can install a small CLI with:

```bash
pip install polytropos[cli]
```

For development, the recommended tool you need is
[uv](https://docs.astral.sh/uv/#installation). Then:

```shell
uvx polytropos[cli] --help-all
```

## Why Polytropos?

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

If your product is the combination of Odoo + its release, you probably won't need
Polytropos.

If your product are Odoo addons, and you want to provide the same product to your
customers regardless of the Odoo version they're running, then you will benefit a lot by
Polytropos.

## Architecture

Polytropos leverages [whool](https://github.com/sbidoul/whool) as its build backend:

1. **Polytropos** reads `pyproject.toml` and generates a version-specific
   `__manifest__.py`
2. **Whool** builds the wheel/sdist from the generated manifest

This separation of concerns allows Polytropos to focus on multi-version manifest
generation while delegating the actual build process to whool's well-tested
implementation.

## Examples

Check out the
[examples folder](https://gitlab.com/moduon/polytropos/-/tree/main/examples) for
real-world modules with views, models, and tests that exercise the conditional logic.
