Manifest
The Manifest class represents an Odoo module manifest (__manifest__.py).
- exception oduit.manifest.ManifestError[source]
Bases:
ExceptionBase exception for manifest-related errors.
- exception oduit.manifest.InvalidManifestError[source]
Bases:
ManifestErrorRaised when manifest contains invalid syntax or structure.
- exception oduit.manifest.ManifestNotFoundError[source]
Bases:
ManifestErrorRaised when manifest file is not found.
- class oduit.manifest.Manifest(module_path: str)[source]
Bases:
objectRepresents 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).
- 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
Class Reference
- class oduit.manifest.Manifest(module_path: str)[source]
Bases:
objectRepresents 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).
- 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
Exceptions
- exception oduit.manifest.ManifestError[source]
Bases:
ExceptionBase exception for manifest-related errors.
- exception oduit.manifest.InvalidManifestError[source]
Bases:
ManifestErrorRaised when manifest contains invalid syntax or structure.
- exception oduit.manifest.ManifestNotFoundError[source]
Bases:
ManifestErrorRaised 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}")