Manifest

The Manifest class represents an Odoo module manifest (__manifest__.py).

exception oduit.manifest.ManifestError[source]

Bases: Exception

Base exception for manifest-related errors.

exception oduit.manifest.InvalidManifestError[source]

Bases: ManifestError

Raised when manifest contains invalid syntax or structure.

exception oduit.manifest.ManifestNotFoundError[source]

Bases: ManifestError

Raised when manifest file is not found.

class oduit.manifest.Manifest(module_path: str)[source]

Bases: object

Represents an Odoo module manifest (__manifest__.py).

This is a wrapper around manifestoo-core’s Manifest class that provides backward compatibility with the original oduit API.

__init__(module_path: str)[source]

Initialize Manifest from a module directory path.

Parameters:

module_path – Absolute path to the module directory

Raises:
  • ManifestNotFoundError – If __manifest__.py is not found

  • InvalidManifestError – If manifest contains invalid syntax or structure

classmethod from_dict(data: dict[str, Any], module_name: str = 'test_module') Manifest[source]

Create a Manifest instance from a dictionary (primarily for testing).

Parameters:
  • data – Dictionary containing manifest data

  • module_name – Name of the module (for testing purposes)

Returns:

Manifest instance

property name: str

Get the module name from manifest or use directory name as fallback.

property version: str

Get the module version.

property codependencies: list[str]

Get codependencies from manifest ‘depends’ field.

Codependencies are modules that this module depends on, meaning changes to those modules may impact this module.

Returns:

List of codependency module names, empty list if no codependencies

property installable: bool

Check if the module is installable.

property auto_install: bool

Check if the module is auto-installable.

property summary: str

Get the module summary/description.

property description: str

Get the module description.

property author: str

Get the module author.

property website: str

Get the module website.

property license: str

Get the module license.

property external_dependencies: dict[str, list[str]]

Get external dependencies (python packages, system binaries).

property python_dependencies: list[str]

Get Python package dependencies.

property binary_dependencies: list[str]

Get system binary dependencies.

get_raw_data() dict[str, Any][source]

Get the raw manifest data dictionary.

is_installable() bool[source]

Check if the module is installable (alias for installable property).

has_dependency(dependency_name: str) bool[source]

Check if the module has a specific codependency.

Parameters:

dependency_name – Name of the codependency to check for

Returns:

True if the codependency exists, False otherwise

validate_structure() list[str][source]

Validate the manifest structure and return any warnings.

Returns:

List of validation warnings (empty if no issues)

__str__() str[source]

String representation of the manifest.

__repr__() str[source]

Developer representation of the manifest.

Class Reference

class oduit.manifest.Manifest(module_path: str)[source]

Bases: object

Represents an Odoo module manifest (__manifest__.py).

This is a wrapper around manifestoo-core’s Manifest class that provides backward compatibility with the original oduit API.

__init__(module_path: str)[source]

Initialize Manifest from a module directory path.

Parameters:

module_path – Absolute path to the module directory

Raises:
  • ManifestNotFoundError – If __manifest__.py is not found

  • InvalidManifestError – If manifest contains invalid syntax or structure

classmethod from_dict(data: dict[str, Any], module_name: str = 'test_module') Manifest[source]

Create a Manifest instance from a dictionary (primarily for testing).

Parameters:
  • data – Dictionary containing manifest data

  • module_name – Name of the module (for testing purposes)

Returns:

Manifest instance

property name: str

Get the module name from manifest or use directory name as fallback.

property version: str

Get the module version.

property codependencies: list[str]

Get codependencies from manifest ‘depends’ field.

Codependencies are modules that this module depends on, meaning changes to those modules may impact this module.

Returns:

List of codependency module names, empty list if no codependencies

property installable: bool

Check if the module is installable.

property auto_install: bool

Check if the module is auto-installable.

property summary: str

Get the module summary/description.

property description: str

Get the module description.

property author: str

Get the module author.

property website: str

Get the module website.

property license: str

Get the module license.

property external_dependencies: dict[str, list[str]]

Get external dependencies (python packages, system binaries).

property python_dependencies: list[str]

Get Python package dependencies.

property binary_dependencies: list[str]

Get system binary dependencies.

get_raw_data() dict[str, Any][source]

Get the raw manifest data dictionary.

is_installable() bool[source]

Check if the module is installable (alias for installable property).

has_dependency(dependency_name: str) bool[source]

Check if the module has a specific codependency.

Parameters:

dependency_name – Name of the codependency to check for

Returns:

True if the codependency exists, False otherwise

validate_structure() list[str][source]

Validate the manifest structure and return any warnings.

Returns:

List of validation warnings (empty if no issues)

__str__() str[source]

String representation of the manifest.

__repr__() str[source]

Developer representation of the manifest.

Exceptions

exception oduit.manifest.ManifestError[source]

Bases: Exception

Base exception for manifest-related errors.

exception oduit.manifest.InvalidManifestError[source]

Bases: ManifestError

Raised when manifest contains invalid syntax or structure.

exception oduit.manifest.ManifestNotFoundError[source]

Bases: ManifestError

Raised when manifest file is not found.

Usage Examples

Basic Manifest Operations

from oduit.manifest import Manifest

# Load manifest from a module directory
manifest = Manifest('/path/to/module')

# Access manifest properties
print(f"Name: {manifest.name}")
print(f"Version: {manifest.version}")
print(f"Installable: {manifest.installable}")
print(f"Auto-install: {manifest.auto_install}")

# Get codependencies
codeps = manifest.codependencies
print(f"Codependencies: {codeps}")

# Check for specific dependency
has_sale = manifest.has_dependency('sale')
print(f"Depends on sale: {has_sale}")

Creating Manifest from Dict

# Create manifest from dictionary (useful for testing)
manifest_data = {
    'name': 'My Module',
    'version': '1.0.0',
    'depends': ['base', 'sale'],
    'installable': True,
}
manifest = Manifest.from_dict(manifest_data, module_name='my_module')

Validating Manifest

# Validate manifest structure
warnings = manifest.validate_structure()
if warnings:
    print("Validation warnings:")
    for warning in warnings:
        print(f"  - {warning}")

# Get raw manifest data
raw_data = manifest.get_raw_data()
print(f"Raw data: {raw_data}")