Skip to main content

Create the ultimate Odoo addons_path constructor

Project description

odoo-addons-path

Automatically detect and construct Odoo addons_path for various project layouts.

Problem

Different Odoo project frameworks use different directory structures:

  • Trobz, Camptocamp, Odoo.sh, Doodba each have unique layouts
  • Manual configuration is error-prone and time-consuming
  • Developers need consistent addons_path across team projects

Solution

odoo-addons-path auto-detects your project layout and generates the correct configuration:

$ odoo-addons-path /home/project
/home/project/odoo/addons,/home/project/addons/repo1,/home/project/addons/repo2

Installation

pip install odoo-addons-path

Quick Start

CLI Usage

# Auto-detect layout (detector runs)
odoo-addons-path /path/to/your/odoo/project

# With verbose output (categorized paths)
odoo-addons-path /path/to/project --verbose

# Manual addon paths - detector SKIPPED (uses explicit path only)
odoo-addons-path /path/to/project --addons-dir "./addons/*/18.0, ./custom"

# Manual Odoo path - detector SKIPPED (uses explicit path only)
odoo-addons-path /path/to/project --odoo-dir /opt/odoo

# Both explicit - detector SKIPPED (uses both paths)
odoo-addons-path /path/to/project --odoo-dir /opt/odoo --addons-dir "./custom"

# Use environment variable with auto-detection
export CODEBASE=/home/project
odoo-addons-path

Detector Skip Behavior: Detector is skipped if ANY explicit path is provided (--addons-dir or --odoo-dir). This ensures predictable behavior with explicit configuration.

Programmatic Usage

from pathlib import Path
from odoo_addons_path import get_addons_path

# Auto-detect layout
paths = get_addons_path(Path("/path/to/project"))
print(paths)
# Output: /path/to/project/addons,/path/to/project/enterprise

# With options
paths = get_addons_path(
    codebase=Path("/home/project"),
    addons_dir=[Path("/home/project/custom")],
    verbose=True
)

Supported Layouts

Auto-detects these Odoo project organizational patterns:

Layout Marker Detection Status
Trobz .trobz/ directory Explicit marker ✓ Supported
Camptocamp (C2C) Dockerfile with label File content ✓ Supported
Odoo.sh 4-dir structure Directory check ✓ Supported
Doodba .copier-answers.yml YAML config ✓ Supported
Generic Any __manifest__.py Recursive search ✓ Fallback

See tests/data/ directory for layout examples.

Features

  • Zero Configuration: Works out-of-the-box for standard layouts
  • Multiple Interfaces: CLI tool and Python library
  • Flexible Input: Glob patterns, comma-separated paths, environment variables
  • Type Safe: Full Python type hints
  • Well Tested: 5 real-world layout patterns covered
  • Production Ready: Used in multiple Odoo teams

Documentation

Development

Setup

uv sync
uv run pre-commit install

Testing

# Single version
make test

# All supported versions (3.10-3.13)
tox

# Quality checks
make check

Release

Releases are automated via semantic versioning on merge to main:

git commit -m "feat: add new feature"  # Creates MINOR version
git commit -m "fix: bug fix"           # Creates PATCH version
git commit -m "feat!: breaking change" # Creates MAJOR version

Requirements

  • Python 3.10+
  • pyyaml
  • typer >= 0.19.2

Status

v1.0.0 - Stable release (Nov 25, 2025)

See CHANGELOG.md for version history.

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

odoo_addons_path-1.4.0.tar.gz (460.8 kB view details)

Uploaded Source

Built Distribution

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

odoo_addons_path-1.4.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file odoo_addons_path-1.4.0.tar.gz.

File metadata

  • Download URL: odoo_addons_path-1.4.0.tar.gz
  • Upload date:
  • Size: 460.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for odoo_addons_path-1.4.0.tar.gz
Algorithm Hash digest
SHA256 a00f4ca5cea78ee4dd885dbfc125f4defb4b11e3cc130f19fae7c15468e0aaf0
MD5 4bcf666a84b1d8afb3806df29b9d4569
BLAKE2b-256 7f97948c0657e71b1b689bed6895215a6a708be94d9cf3ebede4862d40843944

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoo_addons_path-1.4.0.tar.gz:

Publisher: release.yaml on trobz/odoo-addons-path

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file odoo_addons_path-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addons_path-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f8d65671c4fd6a60070598dbf40eeef902a590a1990268d1db41823d4a16e31
MD5 ac65616896613070c1d7efc68f8ad14c
BLAKE2b-256 3230f2408ebcb36ff59cced027d8b369f2ccf319acd8b99916f93eba0822cad6

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoo_addons_path-1.4.0-py3-none-any.whl:

Publisher: release.yaml on trobz/odoo-addons-path

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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