setuptools-odoo

3.3.2 · active · verified Thu Apr 16

setuptools-odoo is a Python library that extends setuptools to simplify packaging and distribution of Odoo addons. It handles specific Odoo addon file structures and metadata, ensuring that module manifest files, static assets, and other Odoo-specific components are correctly included in Python packages. The current version is 3.3.2, with a fairly active release cadence primarily for compatibility updates and core addon list refreshes.

Common errors

Warnings

Install

Imports

Quickstart

To package an Odoo addon with setuptools-odoo, you typically define your build system in `pyproject.toml` and optionally use a `setup.py` for advanced `setuptools-odoo` specific configurations. The example demonstrates setting up `build-system` requirements in `pyproject.toml` and a basic `setup.py` that utilizes `OdooDistribution` and `odoo_addons=True` to correctly package an Odoo module.

# pyproject.toml
[build-system]
requires = ["setuptools>=61.0.0", "setuptools-odoo~=3.3.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "my_odoo_addon"
version = "1.0.0"
description = "My custom Odoo addon"
authors = [
    {name = "Your Name", email = "your@example.com"}
]
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.8"
classifiers = [
    "Framework :: Odoo",
    "Framework :: Odoo :: 16.0",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10"
]
dependencies = [
    # Add your Odoo module dependencies here, e.g., 'odoo>=16.0.0'
]

# setup.py (optional, but needed for specific Odoo options)
import setuptools
from setuptools_odoo import find_packages, OdooDistribution

if __name__ == '__main__':
    setuptools.setup(
        name="my_odoo_addon",
        version="1.0.0", # Should match pyproject.toml
        distclass=OdooDistribution,
        packages=find_packages(),
        include_package_data=True,
        odoo_addons=True, # Enable Odoo addon specific packaging
        # odoo_addon_dir='my_addon_dir', # Optional: if your addon is not at root
        zip_safe=False,
    )

view raw JSON →