Manifest
Manifest ¶
CodeEngineManifest
dataclass
¶
CodeEngineManifest(
functions: list[CodeEngineManifest_Function],
configuration: dict[str, Any],
raw: str = None,
)
from_python_file
classmethod
¶
from_python_file(
file_path: str, accounts_mapping: list[Any]
) -> CodeEngineManifest
Analyze all functions in a Python script file and return a structured manifest.
This is the main public method that orchestrates the complete analysis process. It loads the specified file, parses its AST, and generates comprehensive metadata descriptions for every function found in the script, returning them as a Manifest object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the Python script file to analyze |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Manifest |
CodeEngineManifest
|
A manifest object containing: - functions (list[FunctionMetadata]): list of function metadata objects - configuration (dict[str, Any]): Configuration dictionary with accountsMapping |
Error Handling
- Returns a Manifest with empty functions list if file loading fails
- Prints error messages for individual function analysis failures but continues processing
- Skips functions that cannot be analyzed due to errors
Example
analyzer = CodeEngineScriptAnalyzer() manifest = analyzer.analyze_all_functions('my_script.py') for func in manifest.functions: ... print(f"Function: {func.name} ({len(func.inputs)} parameters)")
Note
This method walks the entire AST and processes all function definitions found, including nested functions and methods within classes.
Source code in src/crew_dcs/classes/DomoCodeEngine/Manifest.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
from_python_string
classmethod
¶
from_python_string(
python_str: str,
accounts_mapping: list[Any],
validate: bool = True,
) -> CodeEngineManifest
Analyze all functions in a Python script string and return a structured manifest.
This is the main public method that orchestrates the complete analysis process. It loads the specified string, parses its AST, and generates comprehensive metadata descriptions for every function found in the script, returning them as a Manifest object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_str
|
str
|
Python script content to analyze |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Manifest |
CodeEngineManifest
|
A manifest object containing: - functions (list[FunctionMetadata]): list of function metadata objects - configuration (dict[str, Any]): Configuration dictionary with accountsMapping |
Error Handling
- Returns a Manifest with empty functions list if string loading fails
- Prints error messages for individual function analysis failures but continues processing
- Skips functions that cannot be analyzed due to errors
Example
analyzer = CodeEngineScriptAnalyzer() manifest = analyzer.analyze_all_functions('def my_func(x): return x') for func in manifest.functions: ... print(f"Function: {func.name} ({len(func.inputs)} parameters)")
Note
This method walks the entire AST and processes all function definitions found, including nested functions and methods within classes.
Source code in src/crew_dcs/classes/DomoCodeEngine/Manifest.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
to_dict ¶
to_dict() -> dict[str, Any]
Convert manifest to dictionary format for API submission.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with 'functions' and 'configuration' keys. |
Source code in src/crew_dcs/classes/DomoCodeEngine/Manifest.py
180 181 182 183 184 185 186 187 188 189 | |
validate_descriptions ¶
validate_descriptions() -> None
Raise if any function docstring exceeds Domo's description cap.
Called before the manifest is sent so an over-long docstring fails here, naming the function and the overage, instead of as Domo's anonymous 400. See MAX_FUNCTION_DESCRIPTION_LEN for how the limit was established.
Source code in src/crew_dcs/classes/DomoCodeEngine/Manifest.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |