Manifest¶
manifest
¶
Odoo manifest reading, parsing, and addon discovery.
Sections
- Path lookup: locate manifest files within addon directories
- Dict parsing: read manifests as plain Python dicts (via ast.literal_eval)
- CST parsing: read manifests as concrete syntax trees (via libcst) for lossless rewriting
- Discovery: enumerate addons and manifest paths under a directory
Functions:
| Name | Description |
|---|---|
find_addons_extended |
Yield (name, path, manifest) for each addon found in a directory. |
find_manifests |
Yield the path to each manifest file found in a directory. |
get_manifest_path |
Return the path to the manifest file inside an addon directory. |
load_manifest |
Load and parse the Odoo manifest found inside an addon directory. |
parse_manifest |
Parse an Odoo manifest file into a Python dict via ast.literal_eval. |
parse_manifest_cst |
Parse a manifest source string into a libcst module node. |
read_manifest |
Read and parse the manifest file in an addon directory as a CST node. |
find_addons_extended
¶
find_addons_extended(addons_dir: Union[str, Path], installable_only: bool = False, names: Optional[list] = None) -> Generator[tuple[str, Path, dict]]
Yield (name, path, manifest) for each addon found in a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Union[str, Path]
|
Directory to scan for addon subdirectories. |
required |
|
bool
|
If True, skip addons where installable is False. Defaults to False. |
False
|
|
Optional[list]
|
If provided, only yield addons whose name is in this list. |
None
|
Yields:
| Type | Description |
|---|---|
Generator[tuple[str, Path, dict]]
|
Tuple of (addon_name, addon_path, manifest_dict) for each matching addon. |
Source code in oops/io/manifest.py
find_manifests
¶
Yield the path to each manifest file found in a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Directory to scan for addon subdirectories. |
required |
|
Optional[list]
|
If provided, only yield manifests for addons in this list. |
None
|
Yields:
| Type | Description |
|---|---|
Generator[Optional[str]]
|
Path to each manifest file found. |
Source code in oops/io/manifest.py
get_manifest_path
¶
Return the path to the manifest file inside an addon directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Path to the addon directory to search. |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Absolute path to the manifest file, or None if not found. |
Source code in oops/io/manifest.py
load_manifest
¶
Load and parse the Odoo manifest found inside an addon directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Path
|
Path to the addon directory containing the manifest file. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Parsed manifest as a dict, or an empty dict if no manifest is found. |
Source code in oops/io/manifest.py
parse_manifest
¶
Parse an Odoo manifest file into a Python dict via ast.literal_eval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Path
|
Path to the manifest file (not the addon directory). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Parsed manifest as a dict, or an empty dict if evaluation fails. |
Source code in oops/io/manifest.py
parse_manifest_cst
¶
read_manifest
¶
Read and parse the manifest file in an addon directory as a CST node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Path to the addon directory containing the manifest file. |
required |
Returns:
| Type | Description |
|---|---|
CSTNode
|
Parsed CST module node of the manifest file. |
Raises:
| Type | Description |
|---|---|
NoManifestFound
|
If no manifest file exists in the given directory. |