CodeEngine
CodeEngine ¶
DomoCodeEngine Package and Version Classes
This module provides classes for interacting with Domo CodeEngine packages including package management, version control, and code deployment.
Class Hierarchy¶
The CodeEngine classes follow the DomoEntity pattern:
- DomoCodeEngine_Package (DomoEntity): Represents a CodeEngine package
- Contains multiple versions
- Manages package metadata (name, description, language)
-
Provides methods for creation, retrieval, updates, and deployment
-
DomoCodeEngine_PackageVersion (DomoSubEntity): Represents a specific version
- Belongs to a parent DomoCodeEngine_Package
- Contains source code and function definitions
- Inherits authentication from parent package
-
May contain a CodeEngineManifest for Python packages
-
DomoCodeEngine_Packages (DomoManager): Manages collections of packages
- Provides search and retrieval methods
- Returns lists of DomoCodeEngine_Package instances
Relationships¶
classDiagram
class DomoEntity {
+str id
+DomoAuth auth
+dict raw
+display_url() str
+from_dict() DomoEntity
+get_by_id() DomoEntity
}
class DomoSubEntity {
+DomoEntity parent
+auth (from parent)
}
class DomoManager {
+DomoAuth auth
+get() list
}
class DomoCodeEngine_Package {
+str id
+str name
+str language
+str current_version
+list~DomoCodeEngine_PackageVersion~ versions
+create() DomoCodeEngine_Package
+get_by_id() DomoCodeEngine_Package
+upsert() DomoCodeEngine_Package
+deploy_version() dict
+_create_manifest_from_code() CodeEngineManifest
+_build_payload() dict
}
class DomoCodeEngine_PackageVersion {
+str package_id
+str version
+str code
+CodeEngineManifest Manifest
+from_dict() DomoCodeEngine_PackageVersion
+get_by_id_and_version() DomoCodeEngine_PackageVersion
+download_source_code() str
}
class DomoCodeEngine_Packages {
+get() list~DomoCodeEngine_Package~
+search_by_name() list~DomoCodeEngine_Package~
}
class CodeEngineManifest {
+list~CodeEngineManifest_Function~ functions
+dict configuration
+from_python_string() CodeEngineManifest
}
DomoEntity <|-- DomoCodeEngine_Package
DomoSubEntity <|-- DomoCodeEngine_PackageVersion
DomoManager <|-- DomoCodeEngine_Packages
DomoCodeEngine_Package "1" *-- "many" DomoCodeEngine_PackageVersion : contains
DomoCodeEngine_PackageVersion "1" *-- "0..1" CodeEngineManifest : has
DomoCodeEngine_Packages "1" *-- "many" DomoCodeEngine_Package : manages
DomoCodeEngine_Package ..> CodeEngineManifest : creates via _create_manifest_from_code
Usage Example¶
from crew_dcs.auth import DomoTokenAuth
from crew_dcs.classes.DomoCodeEngine import DomoCodeEngine_Package
auth = DomoTokenAuth(domo_instance="...", domo_access_token="...")
# Create a new package from Python code
code = "def process_data(input_data: list, limit: int = 100) -> dict:\n return {'processed': len(input_data[:limit])}"
package = await DomoCodeEngine_Package.create(
auth=auth,
name="Data Processor",
code=code,
version="1.0.0"
)
# Get the current version
current_version = await package.get_current_version()
print(f"Current version: {current_version.version}")
# Deploy new code to existing package
result = await package.deploy_version(
code=updated_code,
is_new_version=True
)
# Download source code
file_path = await current_version.download_source_code()
Classes:
| Name | Description |
|---|---|
DomoCodeEngine_Package |
Main package entity class |
DomoCodeEngine_Packages |
Manager class for package collections |
DomoCodeEngine_PackageVersion |
Package version subentity |
CodeEngine_CRUD_Error ¶
CodeEngine_CRUD_Error(
operation: str = "CRUD",
entity_id: str | None = None,
res: ResponseGetData | None = None,
message: str | None = None,
**kwargs
)
Bases: RouteError
Raised when codeengine create, update, or delete operations fail.
Source code in src/crew_dcs/routes/codeengine/exceptions.py
60 61 62 63 64 65 66 67 68 69 70 | |
CodeEngine_GET_Error ¶
CodeEngine_GET_Error(
entity_id: str | None = None,
res: ResponseGetData | None = None,
message: str | None = None,
**kwargs
)
Bases: RouteError
Raised when codeengine retrieval operations fail.
Source code in src/crew_dcs/routes/codeengine/exceptions.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
DomoCodeEngine_ConfigError ¶
DomoCodeEngine_ConfigError(
cls_instance=None,
package_id: str | None = None,
version: str | None = None,
message: str | None = None,
domo_instance: str | None = None,
)
Bases: ClassError
Exception raised when CodeEngine configuration is invalid.
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
DomoCodeEngine_Package
dataclass
¶
DomoCodeEngine_Package(
auth: DomoAuth,
id: str,
raw: dict,
name: str,
description: str,
language: str,
environment: str,
availability: str,
owner_id: int,
created: datetime,
last_modified: datetime,
functions: list,
current_version: str | None = None,
versions: (
list[DomoCodeEngine_PackageVersion] | None
) = None,
owner: list[DomoUser] | None = None,
)
Bases: DomoEntity
Domo CodeEngine Package entity.
Represents a CodeEngine package with versions and associated metadata. Packages contain executable code functions that can be deployed in Domo.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique package identifier |
auth |
DomoAuth
|
Authentication object |
raw |
dict
|
Raw API response data |
name |
str
|
Package display name |
description |
str
|
Package description |
language |
str
|
Programming language (PYTHON or JAVASCRIPT) |
environment |
str
|
Execution environment |
availability |
str
|
Package availability status |
owner_id |
int
|
ID of the package owner |
created |
datetime
|
Package creation datetime |
last_modified |
datetime
|
Last modification datetime |
functions |
list
|
List of function definitions |
current_version |
str | None
|
Latest version number |
versions |
list[DomoCodeEngine_PackageVersion] | None
|
List of DomoCodeEngine_PackageVersion instances |
owner |
list[DomoUser] | None
|
DomoUser instance of the package owner |
Relationships
- Package → Versions: One package contains many versions (one-to-many)
- Package → Manager: DomoCodeEngine_Packages manages collections of packages
- Version → Manifest: Each version may contain a CodeEngineManifest (for Python packages)
Class Constants
DEFAULT_RUNTIME: Default runtime version ("PYTHON_3_13") DEFAULT_ENVIRONMENT: Default execution environment ("LAMBDA") DEFAULT_LANGUAGE: Default programming language ("PYTHON")
Key Methods
- create(): Create a new package from Python code
- deploy_version(): Deploy code to this package (updates or creates new version)
- _create_manifest_from_code(): Internal method to create manifest from Python code
- _build_payload(): Internal method to build API payload
Example
package = await DomoCodeEngine_Package.create( ... auth=auth, ... name="My Package", ... code="def hello(): return 'world'" ... ) result = await package.deploy_version( ... code="def hello(): return 'updated'", ... is_new_version=True ... )
describe
property
¶
describe: dict
Quick introspection — package description + function names and docstrings.
Use this to answer "does this CodeEngine library already have a function that does X?" before building a new one.
Note: For Python packages, functions are parsed from the code via Manifest (with full docstrings, input args, output types). For JavaScript packages, functions come from the API version response.
Returns:
| Type | Description |
|---|---|
dict
|
dict with name, description, language, current_version, function_count, |
dict
|
and a list of function summaries (name, display_name, description/docstring, |
dict
|
is_private, input names). |
display_url
property
¶
display_url: str
Generate the URL to display this package in the Domo interface.
associate_accounts
async
¶
associate_accounts(
account_mappings: list[dict[str, str | int]],
is_set: bool = True,
version_id: str | None = None,
*,
context: RouteContext | None = None,
return_raw: bool = False,
**context_kwargs
)
Associate Domo accounts with this package so its functions can call codeengine.get_account().
Account associations map a Domo account (by ID) to an alias. Inside a deployed
Code Engine function, codeengine.get_account(alias) looks up credentials by
that alias — the function never receives raw secrets as text inputs. The Domo UI
has deprecated the account-association picker, but the mapping remains a required
part of the Code Engine architecture: without it, get_account() has nothing to
resolve. Call this after deploying a package (i.e. after current_version is set)
to wire up the aliases the function code expects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_mappings
|
list[dict[str, str | int]]
|
List of dicts with 'accountId' and 'alias' keys. Example: [{"accountId": 13, "alias": "domo"}, {"accountId": 16, "alias": "github"}] |
required |
is_set
|
bool
|
If True, replace all existing account mappings with new ones. If False, merge new mappings into existing ones (default: True). |
True
|
version_id
|
str | None
|
Package version to associate accounts with. Defaults to this package's current_version. |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration. |
None
|
return_raw
|
bool
|
If True, return the raw ResponseGetData. |
False
|
**context_kwargs
|
Additional context parameters. |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData for the account-sharing request. |
Example
package = await DomoCodeEngine_Package.upsert(auth=auth, name="Domo Docs Sync", code=code) await package.associate_accounts([ ... {"accountId": 16, "alias": "github"}, ... {"accountId": 13, "alias": "domo"}, ... ])
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | |
create
async
classmethod
¶
create(
auth: DomoAuth,
name: str,
code: str,
version: str = "1.0.0",
metadata: dict | None = None,
*,
debug_api: bool = False,
debug_num_stacks_to_drop: int = 2,
session: AsyncClient | None = None,
context: RouteContext | None = None,
**context_kwargs
) -> DomoCodeEngine_Package
Create a new CodeEngine package from Python source code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object with access to the target Domo instance. |
required |
name
|
str
|
Display name for the new package. |
required |
code
|
str
|
Python source code string to upload. |
required |
version
|
str
|
Initial version string (default: "1.0.0"). |
'1.0.0'
|
metadata
|
dict | None
|
Optional overrides for manifest / package configuration. Supported keys: - runtime: Runtime version (default: "PYTHON_3_13") - accountsMapping: List of account mapping dicts - description: Package description - environment: Execution environment (default: "LAMBDA") - language: Language identifier (default: "PYTHON") |
None
|
debug_api
|
bool
|
Enable API debugging for underlying calls. |
False
|
debug_num_stacks_to_drop
|
int
|
Stack frames to drop in logging. |
2
|
session
|
AsyncClient | None
|
Optional httpx session for connection reuse. |
None
|
Returns:
| Type | Description |
|---|---|
DomoCodeEngine_Package
|
DomoCodeEngine_Package instance for the created package. |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | |
delete
async
¶
delete(
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Delete this CodeEngine package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_raw
|
bool
|
If True, return raw API response |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData containing deletion result |
Raises:
| Type | Description |
|---|---|
CodeEngine_CRUD_Error
|
If deletion fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | |
deploy_release
async
classmethod
¶
deploy_release(
auth: DomoAuth,
package_id: str,
version: str,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Deploy (release) a specific package version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object |
required |
package_id
|
str
|
Package identifier |
required |
version
|
str
|
Version string to deploy |
required |
return_raw
|
bool
|
If True, return raw API response |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData if return_raw=True, otherwise the deployment result |
Raises:
| Type | Description |
|---|---|
CodeEngine_CRUD_Error
|
If deployment fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 | |
deploy_version
async
¶
deploy_version(
code: str,
is_new_version: bool = False,
metadata: dict | None = None,
context: RouteContext | None = None,
**context_kwargs
) -> dict
Deploy Python code to this package.
Creates a manifest from the code and deploys it to this package. Supports either updating the current version or creating a new version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
Python source code string to deploy |
required |
is_new_version
|
bool
|
If True, create a new version. If False (default), update the current version. |
False
|
metadata
|
dict | None
|
Optional metadata overrides including: - runtime: Runtime version (default: "PYTHON_3_13") - accountsMapping: List of account mapping dicts - name: Package name override - description: Package description - handler_name: Name of the handler function |
None
|
debug_api
|
Enable API debugging |
required | |
session
|
Optional httpx session for connection reuse |
required |
Returns:
| Type | Description |
|---|---|
dict
|
dict containing: - package_id: The package ID - version: The version that was created/updated - status: "created" or "updated" - response: Raw API response data |
Raises:
| Type | Description |
|---|---|
CodeEngine_GET_Error
|
If package retrieval fails |
CodeEngine_CRUD_Error
|
If deployment fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 | |
describe_async
async
¶
describe_async() -> dict
Async version of describe — fetches current version if functions not populated.
Use this when the package was retrieved from a list (where functions aren't included) and you need the full function details.
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | |
from_dict
classmethod
¶
from_dict(auth: DomoAuth, obj: dict[str, Any])
Create DomoCodeEngine_Package from API response dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object |
required |
obj
|
dict[str, Any]
|
API response dictionary |
required |
Returns:
| Type | Description |
|---|---|
|
DomoCodeEngine_Package instance |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | |
get_by_id
async
classmethod
¶
get_by_id(
auth: DomoAuth,
package_id: str,
params: dict | None = None,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Retrieve a CodeEngine package by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object |
required |
package_id
|
str
|
Package identifier |
required |
params
|
dict | None
|
Optional query parameters |
None
|
return_raw
|
bool
|
If True, return raw API response |
False
|
debug_api
|
Enable API debugging |
required | |
debug_num_stacks_to_drop
|
Stack frames to drop in logging |
required | |
session
|
Optional httpx session |
required | |
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
DomoCodeEngine_Package instance or ResponseGetData if return_raw=True |
Raises:
| Type | Description |
|---|---|
CodeEngine_GET_Error
|
If package retrieval fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | |
get_current_version
async
¶
get_current_version(
*, context: RouteContext | None = None, **context_kwargs
) -> DomoCodeEngine_PackageVersion
Get the current (latest) version of this package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters (debug_api, session, debug_num_stacks_to_drop, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
DomoCodeEngine_PackageVersion
|
DomoCodeEngine_PackageVersion instance |
Raises:
| Type | Description |
|---|---|
DomoCodeEngine_ConfigError
|
If no current version found |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | |
get_entity_by_id
async
classmethod
¶
get_entity_by_id(auth: DomoAuth, entity_id: str, **kwargs)
Fetch a CodeEngine package by its ID.
This method is used by the base DomoEntity class for entity resolution.
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
783 784 785 786 787 788 789 | |
get_owner
async
¶
get_owner(
*, context: RouteContext | None = None, **context_kwargs
) -> DomoUser | None
Get the owner (user) of this package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters (debug_api, session, debug_num_stacks_to_drop, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
DomoUser | None
|
DomoUser instance or None if owner_id not set |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | |
run_function
async
classmethod
¶
run_function(
auth: DomoAuth,
package_id: str,
version: str,
function_name: str,
input_variables: dict,
is_get_logs: bool = True,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Execute a CodeEngine function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object |
required |
package_id
|
str
|
Package identifier |
required |
version
|
str
|
Package version |
required |
function_name
|
str
|
Name of the function to execute |
required |
input_variables
|
dict
|
Dictionary of input variables for the function |
required |
is_get_logs
|
bool
|
Whether to retrieve execution logs (default: True) |
True
|
return_raw
|
bool
|
If True, return raw API response |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData if return_raw=True, otherwise the function execution result |
Raises:
| Type | Description |
|---|---|
CodeEngine_GET_Error
|
If function execution fails |
CodeEngine_FunctionCallError
|
If function call is invalid |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
update_owner
async
¶
update_owner(
owner_id: int,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Update the owner of this CodeEngine package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
owner_id
|
int
|
New owner user ID |
required |
return_raw
|
bool
|
If True, return raw API response |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData if return_raw=True, otherwise the updated package |
Raises:
| Type | Description |
|---|---|
CodeEngine_CRUD_Error
|
If owner update fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 | |
upsert
async
classmethod
¶
upsert(
auth: DomoAuth,
name: str,
code: str,
*,
search_existing: bool = True,
create_if_missing: bool = True,
is_new_version: bool = True,
version: str = "1.0.0",
metadata: dict | None = None,
context: RouteContext | None = None,
**context_kwargs
) -> DomoCodeEngine_Package
Create or update a CodeEngine package from Python source code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object. |
required |
name
|
str
|
Logical package name to search for / create. |
required |
code
|
str
|
Python source to deploy. |
required |
search_existing
|
bool
|
If True, search by name before creating. |
True
|
create_if_missing
|
bool
|
If True, create a new package when none exists. |
True
|
is_new_version
|
bool
|
Passed to deploy_version for existing packages. |
True
|
version
|
str
|
Initial version to use when creating a new package. |
'1.0.0'
|
metadata
|
dict | None
|
Optional manifest / package metadata overrides. |
None
|
debug_api
|
Enable API debugging for underlying calls. |
required | |
debug_num_stacks_to_drop
|
Stack frames to drop in logging. |
required | |
session
|
Optional httpx session for connection reuse. |
required |
Returns:
| Type | Description |
|---|---|
DomoCodeEngine_Package
|
DomoCodeEngine_Package for the updated or created package. |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 | |
DomoCodeEngine_PackageVersion
dataclass
¶
DomoCodeEngine_PackageVersion(
parent: DomoEntity,
package_id: str,
version: str,
language: str | None = None,
description: str | None = None,
createdby_id: int | None = None,
released_dt: datetime | None = None,
configuration: dict | None = None,
createdby: DomoUser | None = None,
accounts_mapping: list[int] | None = None,
ml_model: list[str] | None = None,
code: str | None = None,
functions: dict | None = None,
Manifest: CodeEngineManifest | None = None,
)
Bases: DomoSubEntity
CodeEngine Package Version subentity.
Represents a specific version of a CodeEngine package with its code, configuration, and function definitions.
Attributes:
| Name | Type | Description |
|---|---|---|
parent |
DomoEntity
|
Reference to the parent DomoCodeEngine_Package (inherited from DomoSubEntity) |
auth |
Authentication object (inherited from parent via DomoSubEntity) |
|
package_id |
str
|
ID of the parent package |
version |
str
|
Version string (e.g., "1.0.0") |
language |
str | None
|
Programming language |
description |
str | None
|
Version description |
createdby_id |
int | None
|
ID of user who created this version |
released_dt |
datetime | None
|
Release datetime |
configuration |
dict | None
|
Version configuration dict |
code |
str | None
|
Source code string |
functions |
dict | None
|
Function definitions dict |
Manifest |
CodeEngineManifest | None
|
CodeEngineManifest for Python packages |
createdby |
DomoUser | None
|
DomoUser who created this version |
accounts_mapping |
list[int] | None
|
Account mapping configuration |
ml_model |
list[str] | None
|
ML model configuration |
delete
async
¶
delete(
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Delete this package version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_raw
|
bool
|
If True, return raw API response |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData containing deletion result |
Raises:
| Type | Description |
|---|---|
CodeEngine_CRUD_Error
|
If version deletion fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
download_source_code
async
¶
download_source_code(
download_folder: str = "./EXPORT/codeengine",
file_name: str | None = None,
replace_folder: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Download the source code for this version to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
download_folder
|
str
|
Folder to save the code |
'./EXPORT/codeengine'
|
file_name
|
str | None
|
Optional file name (auto-generated if not provided) |
None
|
replace_folder
|
bool
|
Whether to replace existing folder |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters (debug_api, session, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
|
Path to the downloaded file |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |
export ¶
export(
file_name: str | None = None,
output_folder: str = "EXPORT/codeengine/",
)
Export the source code to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str | None
|
Optional file name (defaults to package_id) |
None
|
output_folder
|
str
|
Output folder path |
'EXPORT/codeengine/'
|
Returns:
| Type | Description |
|---|---|
|
Path to the exported file |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | |
from_dict
classmethod
¶
from_dict(
auth: DomoAuth,
obj: dict[str, Any],
package_id: str,
language: str | None = None,
is_supress_error: bool = True,
parent: DomoCodeEngine_Package | None = None,
)
Create DomoCodeEngine_PackageVersion from API response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object |
required |
obj
|
dict[str, Any]
|
API response dictionary |
required |
package_id
|
str
|
Parent package ID |
required |
language
|
str | None
|
Programming language (optional, will use obj value if not provided) |
None
|
is_supress_error
|
bool
|
Whether to suppress configuration errors |
True
|
parent
|
DomoCodeEngine_Package | None
|
Optional parent package reference (set after package creation if None) |
None
|
Returns:
| Type | Description |
|---|---|
|
DomoCodeEngine_PackageVersion instance |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
get_by_id_and_version
async
classmethod
¶
get_by_id_and_version(
auth: DomoAuth,
package_id: str,
version: str,
language: str | None = None,
params: dict | None = None,
debug_api: bool = False,
debug_num_stacks_to_drop: int = 2,
return_raw: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
)
Retrieve a specific package version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object |
required |
package_id
|
str
|
Package identifier |
required |
version
|
str
|
Version string |
required |
language
|
str | None
|
Programming language (optional) |
None
|
params
|
dict | None
|
Optional query parameters |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
debug_num_stacks_to_drop
|
int
|
Stack frames to drop in logging |
2
|
return_raw
|
bool
|
If True, return raw API response |
False
|
session
|
AsyncClient | None
|
Optional httpx session |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
DomoCodeEngine_PackageVersion instance or ResponseGetData if return_raw=True |
Raises:
| Type | Description |
|---|---|
CodeEngine_GET_Error
|
If version retrieval fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
DomoCodeEngine_Packages
dataclass
¶
DomoCodeEngine_Packages(auth: DomoAuth)
Bases: DomoManager
Manager class for CodeEngine package collections.
Provides methods to retrieve, search, and manage multiple CodeEngine packages.
Attributes:
| Name | Type | Description |
|---|---|---|
auth |
DomoAuth
|
Authentication object |
describe_all
async
¶
describe_all(
*, context: RouteContext | None = None, **context_kwargs
) -> list[dict]
Get descriptions of all CodeEngine packages and their functions.
Fetches each package's current version to extract function names and docstrings. Use this to quickly scan all deployed CodeEngine libraries and answer "is there already a function that does X?" before building a new one.
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of dicts, each with name, description, language, current_version, |
list[dict]
|
function_count, and functions list (name, description/docstring, inputs). |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 | |
get
async
¶
get(
debug_api: bool = False,
debug_num_stacks_to_drop: int = 2,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[DomoCodeEngine_Package]
Get all CodeEngine packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
debug_num_stacks_to_drop
|
int
|
Stack frames to drop in logging |
2
|
session
|
AsyncClient | None
|
Optional httpx session |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
list[DomoCodeEngine_Package]
|
List of DomoCodeEngine_Package instances |
Raises:
| Type | Description |
|---|---|
CodeEngine_GET_Error
|
If package retrieval fails |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | |
search
async
¶
search(
search_text: str | None = None,
additional_filters_ls: list[dict] | None = None,
maximum: int | None = None,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[DomoCodeEngine_Package] | ResponseGetData
Search for CodeEngine packages via the datacenter search API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_text
|
str | None
|
Optional text to filter packages by name |
None
|
additional_filters_ls
|
list[dict] | None
|
Additional filters to apply to the search |
None
|
maximum
|
int | None
|
Maximum number of results to return |
None
|
return_raw
|
bool
|
If True, return raw API response |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
list[DomoCodeEngine_Package] | ResponseGetData
|
List of DomoCodeEngine_Package instances, or ResponseGetData if return_raw=True |
Raises:
| Type | Description |
|---|---|
SearchDatacenterNoResultsFoundError
|
If no packages match the search |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 | |
search_by_name
async
¶
search_by_name(
name: str,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[DomoCodeEngine_Package]
Search for packages by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Package name to search for (case-insensitive partial match) |
required |
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters (debug_api, session, debug_num_stacks_to_drop, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
list[DomoCodeEngine_Package]
|
List of matching DomoCodeEngine_Package instances |
Raises:
| Type | Description |
|---|---|
SearchCodeEngine_NotFound
|
If no packages match the search |
Source code in src/crew_dcs/classes/DomoCodeEngine/CodeEngine.py
1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 | |
ExportExtension ¶
Bases: Enum
File extension types for CodeEngine exports.
SearchCodeEngineNotFoundError ¶
SearchCodeEngineNotFoundError(
search_criteria: str,
res: ResponseGetData | None = None,
**kwargs
)
Bases: RouteError
Raised when codeengine search operations return no results.
Source code in src/crew_dcs/routes/codeengine/exceptions.py
43 44 45 46 47 48 49 50 51 52 53 54 | |