UncountablePythonSDK 0.0.29__py3-none-any.whl → 0.0.31__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of UncountablePythonSDK might be problematic. Click here for more details.
- {UncountablePythonSDK-0.0.29.dist-info → UncountablePythonSDK-0.0.31.dist-info}/METADATA +4 -4
- {UncountablePythonSDK-0.0.29.dist-info → UncountablePythonSDK-0.0.31.dist-info}/RECORD +38 -86
- {UncountablePythonSDK-0.0.29.dist-info → UncountablePythonSDK-0.0.31.dist-info}/top_level.txt +0 -1
- docs/conf.py +9 -4
- docs/requirements.txt +5 -5
- examples/async_batch.py +2 -3
- examples/create_entity.py +4 -7
- examples/upload_files.py +1 -1
- pkgs/argument_parser/case_convert.py +4 -3
- pkgs/serialization/serial_class.py +31 -37
- pkgs/type_spec/emit_python.py +0 -1
- pkgs/type_spec/type_info/emit_type_info.py +14 -6
- uncountable/__init__.py +1 -2
- uncountable/core/__init__.py +10 -3
- uncountable/core/async_batch.py +1 -1
- uncountable/core/client.py +27 -17
- uncountable/core/file_upload.py +3 -5
- uncountable/core/types.py +1 -1
- uncountable/integration/construct_client.py +1 -1
- uncountable/integration/cron.py +4 -2
- uncountable/integration/db/connect.py +1 -1
- uncountable/integration/entrypoint.py +4 -5
- uncountable/integration/executors/script_executor.py +11 -5
- uncountable/integration/job.py +5 -8
- uncountable/integration/server.py +5 -5
- uncountable/types/__init__.py +8 -0
- uncountable/types/api/entity/list_entities.py +7 -0
- uncountable/types/api/inputs/set_intermediate_type.py +43 -0
- uncountable/types/api/recipes/add_recipe_to_project.py +35 -0
- uncountable/types/api/recipes/associate_recipe_as_input.py +1 -0
- uncountable/types/api/recipes/edit_recipe_inputs.py +27 -1
- uncountable/types/api/recipes/remove_recipe_from_project.py +35 -0
- uncountable/types/api/recipes/set_recipe_outputs.py +2 -0
- uncountable/types/async_batch_processor.py +0 -1
- uncountable/types/client_base.py +72 -0
- uncountable/types/inputs.py +1 -0
- uncountable/types/recipes.py +21 -0
- examples/recipe-import/importer.py +0 -39
- type_spec/external/api/batch/execute_batch.yaml +0 -56
- type_spec/external/api/batch/execute_batch_load_async.yaml +0 -18
- type_spec/external/api/chemical/convert_chemical_formats.yaml +0 -33
- type_spec/external/api/entity/create_entities.yaml +0 -45
- type_spec/external/api/entity/create_entity.yaml +0 -51
- type_spec/external/api/entity/get_entities_data.yaml +0 -29
- type_spec/external/api/entity/list_entities.yaml +0 -52
- type_spec/external/api/entity/lock_entity.yaml +0 -21
- type_spec/external/api/entity/resolve_entity_ids.yaml +0 -29
- type_spec/external/api/entity/set_values.yaml +0 -18
- type_spec/external/api/entity/transition_entity_phase.yaml +0 -44
- type_spec/external/api/entity/unlock_entity.yaml +0 -18
- type_spec/external/api/field_options/upsert_field_options.yaml +0 -37
- type_spec/external/api/id_source/list_id_source.yaml +0 -35
- type_spec/external/api/id_source/match_id_source.yaml +0 -32
- type_spec/external/api/input_groups/get_input_group_names.yaml +0 -29
- type_spec/external/api/inputs/create_inputs.yaml +0 -48
- type_spec/external/api/inputs/get_input_data.yaml +0 -95
- type_spec/external/api/inputs/get_input_names.yaml +0 -38
- type_spec/external/api/inputs/get_inputs_data.yaml +0 -82
- type_spec/external/api/inputs/set_input_attribute_values.yaml +0 -33
- type_spec/external/api/inputs/set_input_category.yaml +0 -23
- type_spec/external/api/inputs/set_input_subcategories.yaml +0 -23
- type_spec/external/api/material_families/update_entity_material_families.yaml +0 -33
- type_spec/external/api/outputs/get_output_data.yaml +0 -92
- type_spec/external/api/outputs/get_output_names.yaml +0 -35
- type_spec/external/api/outputs/resolve_output_conditions.yaml +0 -50
- type_spec/external/api/permissions/set_core_permissions.yaml +0 -69
- type_spec/external/api/project/get_projects.yaml +0 -42
- type_spec/external/api/project/get_projects_data.yaml +0 -50
- type_spec/external/api/recipe_links/create_recipe_link.yaml +0 -25
- type_spec/external/api/recipe_metadata/get_recipe_metadata_data.yaml +0 -41
- type_spec/external/api/recipes/archive_recipes.yaml +0 -20
- type_spec/external/api/recipes/associate_recipe_as_input.yaml +0 -19
- type_spec/external/api/recipes/associate_recipe_as_lot.yaml +0 -19
- type_spec/external/api/recipes/create_recipe.yaml +0 -42
- type_spec/external/api/recipes/create_recipes.yaml +0 -47
- type_spec/external/api/recipes/disassociate_recipe_as_input.yaml +0 -16
- type_spec/external/api/recipes/edit_recipe_inputs.yaml +0 -85
- type_spec/external/api/recipes/get_curve.yaml +0 -21
- type_spec/external/api/recipes/get_recipe_calculations.yaml +0 -39
- type_spec/external/api/recipes/get_recipe_links.yaml +0 -26
- type_spec/external/api/recipes/get_recipe_names.yaml +0 -29
- type_spec/external/api/recipes/get_recipe_output_metadata.yaml +0 -36
- type_spec/external/api/recipes/get_recipes_data.yaml +0 -244
- type_spec/external/api/recipes/set_recipe_inputs.yaml +0 -42
- type_spec/external/api/recipes/set_recipe_metadata.yaml +0 -20
- type_spec/external/api/recipes/set_recipe_outputs.yaml +0 -52
- type_spec/external/api/recipes/set_recipe_tags.yaml +0 -62
- type_spec/external/api/recipes/unarchive_recipes.yaml +0 -17
- type_spec/external/api/triggers/run_trigger.yaml +0 -18
- {UncountablePythonSDK-0.0.29.dist-info → UncountablePythonSDK-0.0.31.dist-info}/WHEEL +0 -0
uncountable/core/client.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import base64
|
|
2
|
-
from datetime import datetime, timedelta
|
|
3
2
|
import json
|
|
4
3
|
import typing
|
|
5
4
|
from dataclasses import dataclass
|
|
5
|
+
from datetime import datetime, timedelta
|
|
6
6
|
from enum import StrEnum
|
|
7
7
|
from urllib.parse import urljoin
|
|
8
|
+
from uuid import uuid4
|
|
8
9
|
|
|
9
10
|
import requests
|
|
10
11
|
from requests.exceptions import JSONDecodeError
|
|
@@ -18,6 +19,7 @@ from .file_upload import FileUpload, FileUploader, UploadedFile
|
|
|
18
19
|
from .types import AuthDetailsAll, AuthDetailsApiKey, AuthDetailsOAuth
|
|
19
20
|
|
|
20
21
|
DT = typing.TypeVar("DT")
|
|
22
|
+
UNC_REQUEST_ID_HEADER = "X-UNC-REQUEST-ID"
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
class EndpointMethod(StrEnum):
|
|
@@ -30,19 +32,17 @@ class HTTPRequestBase:
|
|
|
30
32
|
method: EndpointMethod
|
|
31
33
|
url: str
|
|
32
34
|
headers: dict[str, str]
|
|
33
|
-
body: typing.Optional[typing.Union[str, dict[str, str]]] = None
|
|
34
|
-
query_params: typing.Optional[dict[str, str]] = None
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
@dataclass(kw_only=True)
|
|
38
38
|
class HTTPGetRequest(HTTPRequestBase):
|
|
39
|
-
method
|
|
39
|
+
method = EndpointMethod.GET
|
|
40
40
|
query_params: dict[str, str]
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
@dataclass(kw_only=True)
|
|
44
44
|
class HTTPPostRequest(HTTPRequestBase):
|
|
45
|
-
method
|
|
45
|
+
method = EndpointMethod.POST
|
|
46
46
|
body: typing.Union[str, dict[str, str]]
|
|
47
47
|
|
|
48
48
|
|
|
@@ -101,13 +101,15 @@ class APIResponseError(BaseException):
|
|
|
101
101
|
|
|
102
102
|
class SDKError(BaseException):
|
|
103
103
|
message: str
|
|
104
|
+
request_id: str
|
|
104
105
|
|
|
105
|
-
def __init__(self, message: str) -> None:
|
|
106
|
+
def __init__(self, message: str, *, request_id: str) -> None:
|
|
106
107
|
super().__init__(message)
|
|
107
108
|
self.message = message
|
|
109
|
+
self.request_id = request_id
|
|
108
110
|
|
|
109
111
|
def __str__(self) -> str:
|
|
110
|
-
return f"internal SDK error, please contact Uncountable support: {self.message}"
|
|
112
|
+
return f"internal SDK error (request id {self.request_id}), please contact Uncountable support: {self.message}"
|
|
111
113
|
|
|
112
114
|
|
|
113
115
|
@dataclass(kw_only=True)
|
|
@@ -147,7 +149,9 @@ class Client(ClientMethods):
|
|
|
147
149
|
self._file_uploader = FileUploader(self._base_url, self._auth_details)
|
|
148
150
|
self._cfg = config or ClientConfig()
|
|
149
151
|
|
|
150
|
-
def _get_response_json(
|
|
152
|
+
def _get_response_json(
|
|
153
|
+
self, response: requests.Response, request_id: str
|
|
154
|
+
) -> dict[str, JsonValue]:
|
|
151
155
|
if response.status_code < 200 or response.status_code > 299:
|
|
152
156
|
extra_details: dict[str, JsonValue] | None = None
|
|
153
157
|
try:
|
|
@@ -160,12 +164,15 @@ class Client(ClientMethods):
|
|
|
160
164
|
status_code=response.status_code, extra_details=extra_details
|
|
161
165
|
)
|
|
162
166
|
try:
|
|
163
|
-
return response.json()
|
|
164
|
-
except JSONDecodeError:
|
|
165
|
-
raise SDKError("unable to process response")
|
|
167
|
+
return typing.cast(dict[str, JsonValue], response.json())
|
|
168
|
+
except JSONDecodeError as e:
|
|
169
|
+
raise SDKError("unable to process response", request_id=request_id) from e
|
|
166
170
|
|
|
167
171
|
def do_request(self, *, api_request: APIRequest, return_type: type[DT]) -> DT:
|
|
168
|
-
|
|
172
|
+
request_id = str(uuid4())
|
|
173
|
+
http_request = self._build_http_request(
|
|
174
|
+
api_request=api_request, request_id=request_id
|
|
175
|
+
)
|
|
169
176
|
match http_request:
|
|
170
177
|
case HTTPGetRequest():
|
|
171
178
|
response = requests.get(
|
|
@@ -179,18 +186,17 @@ class Client(ClientMethods):
|
|
|
179
186
|
http_request.url,
|
|
180
187
|
headers=http_request.headers,
|
|
181
188
|
data=http_request.body,
|
|
182
|
-
params=http_request.query_params,
|
|
183
189
|
verify=not self._cfg.allow_insecure_tls,
|
|
184
190
|
)
|
|
185
191
|
case _:
|
|
186
192
|
typing.assert_never(http_request)
|
|
187
|
-
response_data = self._get_response_json(response)
|
|
193
|
+
response_data = self._get_response_json(response, request_id=request_id)
|
|
188
194
|
cached_parser = self._get_cached_parser(return_type)
|
|
189
195
|
try:
|
|
190
196
|
data = response_data["data"]
|
|
191
197
|
return cached_parser.parse_api(data)
|
|
192
198
|
except (ValueError, JSONDecodeError, KeyError) as e:
|
|
193
|
-
raise SDKError("unable to process response") from e
|
|
199
|
+
raise SDKError("unable to process response", request_id=request_id) from e
|
|
194
200
|
|
|
195
201
|
def _get_cached_parser(self, data_type: type[DT]) -> CachedParser[DT]:
|
|
196
202
|
if data_type not in self._parser_map:
|
|
@@ -213,8 +219,9 @@ class Client(ClientMethods):
|
|
|
213
219
|
"scope": oauth_details.scope,
|
|
214
220
|
"grant_type": "client_credentials",
|
|
215
221
|
},
|
|
222
|
+
verify=not self._cfg.allow_insecure_tls,
|
|
216
223
|
)
|
|
217
|
-
data = self._get_response_json(response)
|
|
224
|
+
data = self._get_response_json(response, request_id=str(uuid4()))
|
|
218
225
|
token_data = oauth_bearer_token_data_parser.parse_storage(data)
|
|
219
226
|
self._oauth_bearer_token_cache = OAuthBearerTokenCache(
|
|
220
227
|
token=token_data.access_token,
|
|
@@ -235,8 +242,11 @@ class Client(ClientMethods):
|
|
|
235
242
|
return {"Authorization": f"Bearer {token}"}
|
|
236
243
|
typing.assert_never(self._auth_details)
|
|
237
244
|
|
|
238
|
-
def _build_http_request(
|
|
245
|
+
def _build_http_request(
|
|
246
|
+
self, *, api_request: APIRequest, request_id: str
|
|
247
|
+
) -> HTTPRequest:
|
|
239
248
|
headers = self._build_auth_headers()
|
|
249
|
+
headers[UNC_REQUEST_ID_HEADER] = request_id
|
|
240
250
|
method = api_request.method.lower()
|
|
241
251
|
data = {"data": json.dumps(serialize_for_api(api_request.args))}
|
|
242
252
|
match method:
|
uncountable/core/file_upload.py
CHANGED
|
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|
|
4
4
|
from enum import StrEnum
|
|
5
5
|
from io import BytesIO
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import Generator, Self
|
|
7
|
+
from typing import Generator, Literal, Self
|
|
8
8
|
|
|
9
9
|
import aiohttp
|
|
10
10
|
import aiotus
|
|
@@ -23,7 +23,7 @@ class MediaFileUpload:
|
|
|
23
23
|
"""Upload file from a path on disk"""
|
|
24
24
|
|
|
25
25
|
path: str
|
|
26
|
-
type: FileUploadType.MEDIA_FILE_UPLOAD = FileUploadType.MEDIA_FILE_UPLOAD
|
|
26
|
+
type: Literal[FileUploadType.MEDIA_FILE_UPLOAD] = FileUploadType.MEDIA_FILE_UPLOAD
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
FileUpload = MediaFileUpload
|
|
@@ -90,9 +90,7 @@ class FileUploader:
|
|
|
90
90
|
name=file_bytes.name, file_id=int(location.path.split("/")[-1])
|
|
91
91
|
)
|
|
92
92
|
|
|
93
|
-
def upload_files(
|
|
94
|
-
self: Self, *, file_uploads: list[FileUpload]
|
|
95
|
-
) -> list[UploadedFile]:
|
|
93
|
+
def upload_files(self: Self, *, file_uploads: list[FileUpload]) -> list[UploadedFile]:
|
|
96
94
|
return [
|
|
97
95
|
asyncio.run(self._upload_file(file_upload)) for file_upload in file_uploads
|
|
98
96
|
]
|
uncountable/core/types.py
CHANGED
uncountable/integration/cron.py
CHANGED
|
@@ -23,6 +23,8 @@ def cron_job_executor(**kwargs: dict) -> None:
|
|
|
23
23
|
client=construct_uncountable_client(profile_meta=args_passed.profile_metadata),
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
-
job = resolve_script_executor(
|
|
26
|
+
job = resolve_script_executor(
|
|
27
|
+
args_passed.definition.executor, args_passed.profile_metadata
|
|
28
|
+
)
|
|
27
29
|
|
|
28
|
-
job.run(args)
|
|
30
|
+
job.run(args=args)
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import os
|
|
2
2
|
from importlib import resources
|
|
3
3
|
|
|
4
|
-
from uncountable.integration.server import IntegrationServer
|
|
5
|
-
from uncountable.integration.types import ProfileDefinition
|
|
6
4
|
from pkgs.argument_parser import CachedParser
|
|
7
5
|
from uncountable.integration.db.connect import create_db_engine
|
|
8
|
-
|
|
6
|
+
from uncountable.integration.server import IntegrationServer
|
|
7
|
+
from uncountable.integration.types import ProfileDefinition
|
|
9
8
|
|
|
10
9
|
profile_parser = CachedParser(ProfileDefinition)
|
|
11
10
|
|
|
@@ -19,8 +18,8 @@ def main() -> None:
|
|
|
19
18
|
for entry in resources.files(profiles_module).iterdir()
|
|
20
19
|
if entry.is_dir()
|
|
21
20
|
]
|
|
22
|
-
for
|
|
23
|
-
profile_name =
|
|
21
|
+
for profile_file in profiles:
|
|
22
|
+
profile_name = profile_file.name
|
|
24
23
|
try:
|
|
25
24
|
profile = profile_parser.parse_yaml_resource(
|
|
26
25
|
package=".".join([profiles_module, profile_name]),
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import os
|
|
3
1
|
import importlib
|
|
4
2
|
import inspect
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
5
|
from uncountable.integration.job import Job
|
|
6
6
|
from uncountable.integration.types import JobExecutorScript, ProfileMetadata
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def resolve_script_executor(
|
|
10
|
-
|
|
9
|
+
def resolve_script_executor(
|
|
10
|
+
executor: JobExecutorScript, profile_metadata: ProfileMetadata
|
|
11
|
+
) -> Job:
|
|
12
|
+
job_module_path = ".".join([
|
|
13
|
+
os.environ["UNC_PROFILES_MODULE"],
|
|
14
|
+
profile_metadata.name,
|
|
15
|
+
executor.import_path,
|
|
16
|
+
])
|
|
11
17
|
job_module = importlib.import_module(job_module_path)
|
|
12
|
-
found_jobs: list[
|
|
18
|
+
found_jobs: list[Job] = []
|
|
13
19
|
for _, job_class in inspect.getmembers(job_module, inspect.isclass):
|
|
14
20
|
if getattr(job_class, "_unc_job_registered", False):
|
|
15
21
|
found_jobs.append(job_class())
|
uncountable/integration/job.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
1
2
|
from dataclasses import dataclass
|
|
3
|
+
|
|
2
4
|
from uncountable.core.client import Client
|
|
3
5
|
from uncountable.integration.types import JobDefinition
|
|
4
6
|
|
|
5
|
-
from abc import ABC, abstractmethod
|
|
6
|
-
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class JobArgumentsBase:
|
|
@@ -29,17 +29,14 @@ class Job(ABC):
|
|
|
29
29
|
_unc_job_registered: bool = False
|
|
30
30
|
|
|
31
31
|
@abstractmethod
|
|
32
|
-
def run(self, args: JobArguments) -> JobResult:
|
|
33
|
-
...
|
|
32
|
+
def run(self, args: JobArguments) -> JobResult: ...
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
class CronJob(Job):
|
|
37
|
-
|
|
38
36
|
@abstractmethod
|
|
39
|
-
def run(self, args: CronJobArguments) -> JobResult:
|
|
40
|
-
...
|
|
37
|
+
def run(self, args: CronJobArguments) -> JobResult: ...
|
|
41
38
|
|
|
42
39
|
|
|
43
|
-
def register_job(cls: Job):
|
|
40
|
+
def register_job(cls: Job) -> Job:
|
|
44
41
|
cls._unc_job_registered = True
|
|
45
42
|
return cls
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import signal
|
|
2
|
-
from types import TracebackType
|
|
3
2
|
from dataclasses import asdict
|
|
3
|
+
from types import TracebackType
|
|
4
4
|
from typing import Optional, assert_never
|
|
5
|
+
|
|
6
|
+
from apscheduler.executors.pool import ThreadPoolExecutor
|
|
7
|
+
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
|
|
5
8
|
from apscheduler.schedulers.background import BackgroundScheduler
|
|
6
9
|
from apscheduler.schedulers.base import BaseScheduler
|
|
7
|
-
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
|
|
8
|
-
from apscheduler.executors.pool import ThreadPoolExecutor
|
|
9
|
-
from uncountable.integration.cron import CronJobArgs, cron_job_executor
|
|
10
10
|
from apscheduler.triggers.cron import CronTrigger
|
|
11
11
|
from sqlalchemy.engine.base import Engine
|
|
12
12
|
|
|
13
|
+
from uncountable.integration.cron import CronJobArgs, cron_job_executor
|
|
13
14
|
from uncountable.integration.types import (
|
|
14
15
|
AuthRetrieval,
|
|
15
16
|
CronJobDefinition,
|
|
@@ -17,7 +18,6 @@ from uncountable.integration.types import (
|
|
|
17
18
|
ProfileMetadata,
|
|
18
19
|
)
|
|
19
20
|
|
|
20
|
-
|
|
21
21
|
_MAX_APSCHEDULER_CONCURRENT_JOBS = 1
|
|
22
22
|
|
|
23
23
|
|
uncountable/types/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# ruff: noqa: E402
|
|
4
4
|
# fmt: off
|
|
5
5
|
# isort: skip_file
|
|
6
|
+
from .api.recipes import add_recipe_to_project as add_recipe_to_project_t
|
|
6
7
|
from .api.recipes import archive_recipes as archive_recipes_t
|
|
7
8
|
from .api.recipes import associate_recipe_as_input as associate_recipe_as_input_t
|
|
8
9
|
from .api.recipes import associate_recipe_as_lot as associate_recipe_as_lot_t
|
|
@@ -61,6 +62,8 @@ from . import recipe_metadata as recipe_metadata_t
|
|
|
61
62
|
from . import recipe_output_metadata as recipe_output_metadata_t
|
|
62
63
|
from . import recipe_tags as recipe_tags_t
|
|
63
64
|
from . import recipe_workflow_steps as recipe_workflow_steps_t
|
|
65
|
+
from . import recipes as recipes_t
|
|
66
|
+
from .api.recipes import remove_recipe_from_project as remove_recipe_from_project_t
|
|
64
67
|
from .api.entity import resolve_entity_ids as resolve_entity_ids_t
|
|
65
68
|
from .api.outputs import resolve_output_conditions as resolve_output_conditions_t
|
|
66
69
|
from . import response as response_t
|
|
@@ -69,6 +72,7 @@ from .api.permissions import set_core_permissions as set_core_permissions_t
|
|
|
69
72
|
from .api.inputs import set_input_attribute_values as set_input_attribute_values_t
|
|
70
73
|
from .api.inputs import set_input_category as set_input_category_t
|
|
71
74
|
from .api.inputs import set_input_subcategories as set_input_subcategories_t
|
|
75
|
+
from .api.inputs import set_intermediate_type as set_intermediate_type_t
|
|
72
76
|
from .api.recipes import set_recipe_inputs as set_recipe_inputs_t
|
|
73
77
|
from .api.recipes import set_recipe_metadata as set_recipe_metadata_t
|
|
74
78
|
from .api.recipes import set_recipe_outputs as set_recipe_outputs_t
|
|
@@ -85,6 +89,7 @@ from . import workflows as workflows_t
|
|
|
85
89
|
|
|
86
90
|
|
|
87
91
|
__all__: list[str] = [
|
|
92
|
+
"add_recipe_to_project_t",
|
|
88
93
|
"archive_recipes_t",
|
|
89
94
|
"associate_recipe_as_input_t",
|
|
90
95
|
"associate_recipe_as_lot_t",
|
|
@@ -143,6 +148,8 @@ __all__: list[str] = [
|
|
|
143
148
|
"recipe_output_metadata_t",
|
|
144
149
|
"recipe_tags_t",
|
|
145
150
|
"recipe_workflow_steps_t",
|
|
151
|
+
"recipes_t",
|
|
152
|
+
"remove_recipe_from_project_t",
|
|
146
153
|
"resolve_entity_ids_t",
|
|
147
154
|
"resolve_output_conditions_t",
|
|
148
155
|
"response_t",
|
|
@@ -151,6 +158,7 @@ __all__: list[str] = [
|
|
|
151
158
|
"set_input_attribute_values_t",
|
|
152
159
|
"set_input_category_t",
|
|
153
160
|
"set_input_subcategories_t",
|
|
161
|
+
"set_intermediate_type_t",
|
|
154
162
|
"set_recipe_inputs_t",
|
|
155
163
|
"set_recipe_metadata_t",
|
|
156
164
|
"set_recipe_outputs_t",
|
|
@@ -8,6 +8,7 @@ import typing # noqa: F401
|
|
|
8
8
|
import datetime # noqa: F401
|
|
9
9
|
from decimal import Decimal # noqa: F401
|
|
10
10
|
from dataclasses import dataclass
|
|
11
|
+
from pkgs.serialization import serial_class
|
|
11
12
|
from pkgs.serialization import OpaqueKey
|
|
12
13
|
from ... import base as base_t
|
|
13
14
|
from ... import entity as entity_t
|
|
@@ -26,6 +27,9 @@ ENDPOINT_PATH = "api/external/entity/external_list_entities"
|
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
30
|
+
@serial_class(
|
|
31
|
+
unconverted_values={"attributes"},
|
|
32
|
+
)
|
|
29
33
|
@dataclass(kw_only=True)
|
|
30
34
|
class Arguments:
|
|
31
35
|
entity_type: entity_t.EntityType
|
|
@@ -36,6 +40,9 @@ class Arguments:
|
|
|
36
40
|
|
|
37
41
|
|
|
38
42
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
43
|
+
@serial_class(
|
|
44
|
+
unconverted_values={"column_values"},
|
|
45
|
+
)
|
|
39
46
|
@dataclass(kw_only=True)
|
|
40
47
|
class EntityResult:
|
|
41
48
|
entity: entity_t.Entity
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
2
|
+
# flake8: noqa: F821
|
|
3
|
+
# ruff: noqa: E402
|
|
4
|
+
# fmt: off
|
|
5
|
+
# isort: skip_file
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
import typing # noqa: F401
|
|
8
|
+
import datetime # noqa: F401
|
|
9
|
+
from decimal import Decimal # noqa: F401
|
|
10
|
+
from pkgs.strenum_compat import StrEnum
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from ... import identifier as identifier_t
|
|
13
|
+
|
|
14
|
+
__all__: list[str] = [
|
|
15
|
+
"Arguments",
|
|
16
|
+
"Data",
|
|
17
|
+
"ENDPOINT_METHOD",
|
|
18
|
+
"ENDPOINT_PATH",
|
|
19
|
+
"IntermediateType",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
ENDPOINT_METHOD = "POST"
|
|
23
|
+
ENDPOINT_PATH = "api/external/inputs/set_intermediate_type"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
27
|
+
class IntermediateType(StrEnum):
|
|
28
|
+
FINAL_PRODUCT = "final_product"
|
|
29
|
+
COMPOUND_AS_INTERMEDIATE = "compound_as_intermediate"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
33
|
+
@dataclass(kw_only=True)
|
|
34
|
+
class Arguments:
|
|
35
|
+
input_key: identifier_t.IdentifierKey
|
|
36
|
+
intermediate_type: IntermediateType
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
40
|
+
@dataclass(kw_only=True)
|
|
41
|
+
class Data:
|
|
42
|
+
pass
|
|
43
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
2
|
+
# flake8: noqa: F821
|
|
3
|
+
# ruff: noqa: E402
|
|
4
|
+
# fmt: off
|
|
5
|
+
# isort: skip_file
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
import typing # noqa: F401
|
|
8
|
+
import datetime # noqa: F401
|
|
9
|
+
from decimal import Decimal # noqa: F401
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from ... import identifier as identifier_t
|
|
12
|
+
|
|
13
|
+
__all__: list[str] = [
|
|
14
|
+
"Arguments",
|
|
15
|
+
"Data",
|
|
16
|
+
"ENDPOINT_METHOD",
|
|
17
|
+
"ENDPOINT_PATH",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
ENDPOINT_METHOD = "POST"
|
|
21
|
+
ENDPOINT_PATH = "api/external/recipes/add_recipe_to_project"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
25
|
+
@dataclass(kw_only=True)
|
|
26
|
+
class Arguments:
|
|
27
|
+
recipe_key: identifier_t.IdentifierKey
|
|
28
|
+
project_key: identifier_t.IdentifierKey
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
32
|
+
@dataclass(kw_only=True)
|
|
33
|
+
class Data:
|
|
34
|
+
pass
|
|
35
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -27,6 +27,7 @@ ENDPOINT_PATH = "api/external/recipes/associate_recipe_as_input"
|
|
|
27
27
|
class Arguments:
|
|
28
28
|
recipe_key: identifier_t.IdentifierKey
|
|
29
29
|
input_key: typing.Optional[identifier_t.IdentifierKey] = None
|
|
30
|
+
show_in_listings: typing.Optional[bool] = None
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -15,6 +15,7 @@ from ... import recipe_inputs as recipe_inputs_t
|
|
|
15
15
|
from ... import recipe_workflow_steps as recipe_workflow_steps_t
|
|
16
16
|
|
|
17
17
|
__all__: list[str] = [
|
|
18
|
+
"AnnotationEdit",
|
|
18
19
|
"Arguments",
|
|
19
20
|
"Data",
|
|
20
21
|
"ENDPOINT_METHOD",
|
|
@@ -25,6 +26,7 @@ __all__: list[str] = [
|
|
|
25
26
|
"RecipeInputEditClearInputs",
|
|
26
27
|
"RecipeInputEditInputBase",
|
|
27
28
|
"RecipeInputEditType",
|
|
29
|
+
"RecipeInputEditUpdateAnnotations",
|
|
28
30
|
"RecipeInputEditUpsertInput",
|
|
29
31
|
]
|
|
30
32
|
|
|
@@ -37,6 +39,7 @@ class RecipeInputEditType(StrEnum):
|
|
|
37
39
|
CLEAR_INPUTS = "clear_inputs"
|
|
38
40
|
UPSERT_INPUT = "upsert_input"
|
|
39
41
|
ADD_INPUT = "add_input"
|
|
42
|
+
UPDATE_ANNOTATIONS = "update_annotations"
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -88,7 +91,30 @@ class RecipeInputEditAddInput(RecipeInputEditInputBase):
|
|
|
88
91
|
|
|
89
92
|
|
|
90
93
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
91
|
-
|
|
94
|
+
@serial_class(
|
|
95
|
+
to_string_values={"lower_value", "upper_value"},
|
|
96
|
+
)
|
|
97
|
+
@dataclass(kw_only=True)
|
|
98
|
+
class AnnotationEdit:
|
|
99
|
+
annotation_type_key: identifier_t.IdentifierKey
|
|
100
|
+
lower_value: typing.Optional[Decimal] = None
|
|
101
|
+
upper_value: typing.Optional[Decimal] = None
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
105
|
+
@serial_class(
|
|
106
|
+
parse_require={"type"},
|
|
107
|
+
)
|
|
108
|
+
@dataclass(kw_only=True)
|
|
109
|
+
class RecipeInputEditUpdateAnnotations(RecipeInputEditInputBase):
|
|
110
|
+
type: typing.Literal[RecipeInputEditType.UPDATE_ANNOTATIONS] = RecipeInputEditType.UPDATE_ANNOTATIONS
|
|
111
|
+
ingredient_key: identifier_t.IdentifierKey
|
|
112
|
+
clear_first: bool
|
|
113
|
+
annotations: list[AnnotationEdit]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
117
|
+
RecipeInputEdit = typing.Union[RecipeInputEditClearInputs, RecipeInputEditUpsertInput, RecipeInputEditAddInput, RecipeInputEditUpdateAnnotations]
|
|
92
118
|
|
|
93
119
|
|
|
94
120
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
2
|
+
# flake8: noqa: F821
|
|
3
|
+
# ruff: noqa: E402
|
|
4
|
+
# fmt: off
|
|
5
|
+
# isort: skip_file
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
import typing # noqa: F401
|
|
8
|
+
import datetime # noqa: F401
|
|
9
|
+
from decimal import Decimal # noqa: F401
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from ... import identifier as identifier_t
|
|
12
|
+
|
|
13
|
+
__all__: list[str] = [
|
|
14
|
+
"Arguments",
|
|
15
|
+
"Data",
|
|
16
|
+
"ENDPOINT_METHOD",
|
|
17
|
+
"ENDPOINT_PATH",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
ENDPOINT_METHOD = "POST"
|
|
21
|
+
ENDPOINT_PATH = "api/external/recipes/remove_recipe_from_project"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
25
|
+
@dataclass(kw_only=True)
|
|
26
|
+
class Arguments:
|
|
27
|
+
recipe_key: identifier_t.IdentifierKey
|
|
28
|
+
project_key: identifier_t.IdentifierKey
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
32
|
+
@dataclass(kw_only=True)
|
|
33
|
+
class Data:
|
|
34
|
+
pass
|
|
35
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -10,6 +10,7 @@ from decimal import Decimal # noqa: F401
|
|
|
10
10
|
from dataclasses import dataclass
|
|
11
11
|
from pkgs.serialization import serial_class
|
|
12
12
|
from ... import base as base_t
|
|
13
|
+
from ... import recipes as recipes_t
|
|
13
14
|
from ... import response as response_t
|
|
14
15
|
|
|
15
16
|
__all__: list[str] = [
|
|
@@ -45,6 +46,7 @@ class RecipeOutputValue:
|
|
|
45
46
|
value_numeric: typing.Optional[Decimal] = None
|
|
46
47
|
value_str: typing.Optional[str] = None
|
|
47
48
|
value_curve: typing.Optional[CurveValues] = None
|
|
49
|
+
formatting: typing.Optional[recipes_t.RecipeAttributeFormatting] = None
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -19,7 +19,6 @@ from uncountable.types import recipe_workflow_steps as recipe_workflow_steps_t
|
|
|
19
19
|
import uncountable.types.api.recipes.set_recipe_metadata as set_recipe_metadata_t
|
|
20
20
|
import uuid
|
|
21
21
|
from abc import ABC, abstractmethod
|
|
22
|
-
from dataclasses import dataclass
|
|
23
22
|
from pkgs.serialization_util.serialization_helpers import serialize_for_api
|
|
24
23
|
|
|
25
24
|
|