UncountablePythonSDK 0.0.17__py3-none-any.whl → 0.0.18__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.

Files changed (42) hide show
  1. {UncountablePythonSDK-0.0.17.dist-info → UncountablePythonSDK-0.0.18.dist-info}/METADATA +1 -1
  2. {UncountablePythonSDK-0.0.17.dist-info → UncountablePythonSDK-0.0.18.dist-info}/RECORD +42 -31
  3. pkgs/argument_parser/_is_enum.py +1 -1
  4. pkgs/argument_parser/argument_parser.py +13 -13
  5. pkgs/serialization/serial_class.py +3 -3
  6. pkgs/serialization_util/_get_type_for_serialization.py +1 -3
  7. pkgs/serialization_util/serialization_helpers.py +1 -3
  8. pkgs/strenum_compat/strenum_compat.py +1 -9
  9. pkgs/type_spec/actions_registry/__main__.py +9 -3
  10. pkgs/type_spec/actions_registry/emit_typescript.py +20 -6
  11. pkgs/type_spec/builder.py +10 -10
  12. pkgs/type_spec/config.py +3 -2
  13. pkgs/type_spec/emit_python.py +19 -16
  14. pkgs/type_spec/emit_typescript.py +2 -2
  15. pkgs/type_spec/emit_typescript_util.py +1 -2
  16. pkgs/type_spec/load_types.py +2 -1
  17. pkgs/type_spec/open_api_util.py +2 -2
  18. pkgs/type_spec/parts/base.py.prepart +2 -1
  19. pkgs/type_spec/util.py +9 -9
  20. pkgs/type_spec/value_spec/__main__.py +2 -2
  21. type_spec/external/api/batch/execute_batch_load_async.yaml +18 -0
  22. type_spec/external/api/id_source/list_id_source.yaml +35 -0
  23. type_spec/external/api/id_source/match_id_source.yaml +32 -0
  24. type_spec/external/api/recipes/create_recipe.yaml +3 -0
  25. type_spec/external/api/recipes/get_recipes_data.yaml +21 -21
  26. type_spec/external/api/recipes/set_recipe_inputs.yaml +3 -0
  27. type_spec/external/api/triggers/run_trigger.yaml +18 -0
  28. uncountable/types/__init__.py +10 -0
  29. uncountable/types/api/batch/execute_batch_load_async.py +35 -0
  30. uncountable/types/api/id_source/__init__.py +1 -0
  31. uncountable/types/api/id_source/list_id_source.py +46 -0
  32. uncountable/types/api/id_source/match_id_source.py +48 -0
  33. uncountable/types/api/recipes/create_recipe.py +2 -0
  34. uncountable/types/api/recipes/set_recipe_inputs.py +1 -0
  35. uncountable/types/api/triggers/__init__.py +1 -0
  36. uncountable/types/api/triggers/run_trigger.py +36 -0
  37. uncountable/types/async_batch.py +22 -0
  38. uncountable/types/base.py +2 -1
  39. uncountable/types/client_base.py +102 -1
  40. uncountable/types/id_source.py +49 -0
  41. {UncountablePythonSDK-0.0.17.dist-info → UncountablePythonSDK-0.0.18.dist-info}/WHEEL +0 -0
  42. {UncountablePythonSDK-0.0.17.dist-info → UncountablePythonSDK-0.0.18.dist-info}/top_level.txt +0 -0
@@ -7,14 +7,36 @@ from __future__ import annotations
7
7
  import typing # noqa: F401
8
8
  import datetime # noqa: F401
9
9
  from decimal import Decimal # noqa: F401
10
+ from pkgs.strenum_compat import StrEnum
10
11
  from dataclasses import dataclass
12
+ from pkgs.serialization import serial_class
11
13
  from . import base as base_t
12
14
 
13
15
  __all__: list[str] = [
14
16
  "AsyncBatchActionReturn",
17
+ "AsyncBatchRequest",
18
+ "AsyncBatchRequestPath",
15
19
  ]
16
20
 
17
21
 
22
+ # DO NOT MODIFY -- This file is generated by type_spec
23
+ class AsyncBatchRequestPath(StrEnum):
24
+ CREATE_RECIPE = "recipes/create_recipe"
25
+ SET_RECIPE_METADATA = "recipes/set_recipe_metadata"
26
+
27
+
28
+ # DO NOT MODIFY -- This file is generated by type_spec
29
+ @serial_class(
30
+ unconverted_values={"data"},
31
+ )
32
+ @dataclass(kw_only=True)
33
+ class AsyncBatchRequest:
34
+ path: AsyncBatchRequestPath
35
+ data: base_t.JsonValue
36
+ batch_reference: str
37
+ depends_on: typing.Optional[list[str]] = None
38
+
39
+
18
40
  # DO NOT MODIFY -- This file is generated by type_spec
19
41
  @dataclass(kw_only=True)
20
42
  class AsyncBatchActionReturn:
uncountable/types/base.py CHANGED
@@ -18,7 +18,8 @@ __all__: list[str] = [
18
18
  """
19
19
  Types that type_spec will use in the emitted files.
20
20
  """
21
- from typing import Union, Mapping, Sequence, Any, TYPE_CHECKING
21
+ from typing import Union, Any, TYPE_CHECKING
22
+ from collections.abc import Mapping, Sequence
22
23
 
23
24
  # These two are part of the core output, thus don't duplicate here
24
25
  # from decimal import Decimal
@@ -11,6 +11,7 @@ from decimal import Decimal # noqa: F401
11
11
  from pkgs.serialization import OpaqueKey
12
12
  import uncountable.types.api.recipes.associate_recipe_as_input as associate_recipe_as_input_t
13
13
  import uncountable.types.api.recipes.associate_recipe_as_lot as associate_recipe_as_lot_t
14
+ from . import async_batch as async_batch_t
14
15
  from . import base as base_t
15
16
  import uncountable.types.api.chemical.convert_chemical_formats as convert_chemical_formats_t
16
17
  import uncountable.types.api.entity.create_entities as create_entities_t
@@ -21,6 +22,7 @@ import uncountable.types.api.recipe_links.create_recipe_link as create_recipe_li
21
22
  import uncountable.types.api.recipes.create_recipes as create_recipes_t
22
23
  from . import entity as entity_t
23
24
  import uncountable.types.api.batch.execute_batch as execute_batch_t
25
+ import uncountable.types.api.batch.execute_batch_load_async as execute_batch_load_async_t
24
26
  from . import field_values as field_values_t
25
27
  import uncountable.types.api.recipes.get_curve as get_curve_t
26
28
  import uncountable.types.api.entity.get_entities_data as get_entities_data_t
@@ -38,13 +40,17 @@ import uncountable.types.api.recipe_metadata.get_recipe_metadata_data as get_rec
38
40
  import uncountable.types.api.recipes.get_recipe_names as get_recipe_names_t
39
41
  import uncountable.types.api.recipes.get_recipe_output_metadata as get_recipe_output_metadata_t
40
42
  import uncountable.types.api.recipes.get_recipes_data as get_recipes_data_t
43
+ from . import id_source as id_source_t
41
44
  from . import identifier as identifier_t
42
45
  import uncountable.types.api.entity.list_entities as list_entities_t
46
+ import uncountable.types.api.id_source.list_id_source as list_id_source_t
47
+ import uncountable.types.api.id_source.match_id_source as match_id_source_t
43
48
  from . import recipe_identifiers as recipe_identifiers_t
44
49
  from . import recipe_links as recipe_links_t
45
50
  from . import recipe_metadata as recipe_metadata_t
46
51
  import uncountable.types.api.entity.resolve_entity_ids as resolve_entity_ids_t
47
52
  import uncountable.types.api.outputs.resolve_output_conditions as resolve_output_conditions_t
53
+ import uncountable.types.api.triggers.run_trigger as run_trigger_t
48
54
  import uncountable.types.api.inputs.set_input_attribute_values as set_input_attribute_values_t
49
55
  import uncountable.types.api.recipes.set_recipe_inputs as set_recipe_inputs_t
50
56
  import uncountable.types.api.recipes.set_recipe_metadata as set_recipe_metadata_t
@@ -212,6 +218,7 @@ class ClientMethods(ABC):
212
218
  name: typing.Optional[str] = None,
213
219
  workflow_variant_id: typing.Optional[typing.Optional[base_t.ObjectId]] = None,
214
220
  recipe_metadata: typing.Optional[list[recipe_metadata_t.MetadataValue]] = None,
221
+ definition_key: typing.Optional[identifier_t.IdentifierKey] = None,
215
222
  ) -> create_recipe_t.Data:
216
223
  """Returns the id of the recipe being created.
217
224
 
@@ -221,6 +228,7 @@ class ClientMethods(ABC):
221
228
  :param workflow_variant_id: The identifier of the workflow variant to create the recipe with
222
229
  :param recipe_metadata: Metadata values to populate the recipe with
223
230
  :param identifiers: A recipe won't be created if it matches the identifier. An identifier must be unique in the schema
231
+ :param definition_key: The entity definition identifier, default is used if not supplied
224
232
  """
225
233
  args = create_recipe_t.Arguments(
226
234
  name=name,
@@ -229,6 +237,7 @@ class ClientMethods(ABC):
229
237
  workflow_variant_id=workflow_variant_id,
230
238
  recipe_metadata=recipe_metadata,
231
239
  identifiers=identifiers,
240
+ definition_key=definition_key,
232
241
  )
233
242
  api_request = APIRequest(
234
243
  method=create_recipe_t.ENDPOINT_METHOD,
@@ -311,6 +320,25 @@ class ClientMethods(ABC):
311
320
  return self.do_request(api_request=api_request, return_type=execute_batch_t.Data)
312
321
 
313
322
 
323
+ def execute_batch_load_async(
324
+ self,
325
+ *,
326
+ requests: list[async_batch_t.AsyncBatchRequest],
327
+ ) -> execute_batch_load_async_t.Data:
328
+ """Run multiple API calls via one request
329
+
330
+ """
331
+ args = execute_batch_load_async_t.Arguments(
332
+ requests=requests,
333
+ )
334
+ api_request = APIRequest(
335
+ method=execute_batch_load_async_t.ENDPOINT_METHOD,
336
+ endpoint=execute_batch_load_async_t.ENDPOINT_PATH,
337
+ args=args,
338
+ )
339
+ return self.do_request(api_request=api_request, return_type=execute_batch_load_async_t.Data)
340
+
341
+
314
342
  def get_curve(
315
343
  self,
316
344
  *,
@@ -685,7 +713,7 @@ class ClientMethods(ABC):
685
713
  offset: typing.Optional[typing.Optional[int]] = None,
686
714
  limit: typing.Optional[typing.Optional[int]] = None,
687
715
  ) -> get_recipes_data_t.Data:
688
- """Gets all data associated with a set of recipes / experiments. Because Uncountables recipe structure is complex, various data values are exploded out to increase efficiency in parsing, and this page is paginated to prevent too large of return values
716
+ """Gets all data associated with a set of recipes. Because Uncountables recipe structure is complex, various data values are exploded out to increase efficiency in parsing, and this page is paginated to prevent too large of return values
689
717
 
690
718
  :param recipe_ids: The recipes to get the data from. Either these or project_id must be filled in
691
719
  :param project_id: The projects to get the data from. Either these or recipe_ids must be filled in
@@ -738,6 +766,58 @@ class ClientMethods(ABC):
738
766
  return self.do_request(api_request=api_request, return_type=list_entities_t.Data)
739
767
 
740
768
 
769
+ def list_id_source(
770
+ self,
771
+ *,
772
+ spec: id_source_t.IdSourceSpec,
773
+ search_label: str,
774
+ offset: typing.Optional[typing.Optional[int]] = None,
775
+ limit: typing.Optional[typing.Optional[int]] = None,
776
+ ) -> list_id_source_t.Data:
777
+ """Lists id and label pairs
778
+
779
+ :param spec: The id source spec to use
780
+ :param search_label: Text to search within the labels to search matches
781
+ :param offset: Used for pagination. Pagination is done based on the sorting of the config
782
+ :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100
783
+ """
784
+ args = list_id_source_t.Arguments(
785
+ spec=spec,
786
+ search_label=search_label,
787
+ offset=offset,
788
+ limit=limit,
789
+ )
790
+ api_request = APIRequest(
791
+ method=list_id_source_t.ENDPOINT_METHOD,
792
+ endpoint=list_id_source_t.ENDPOINT_PATH,
793
+ args=args,
794
+ )
795
+ return self.do_request(api_request=api_request, return_type=list_id_source_t.Data)
796
+
797
+
798
+ def match_id_source(
799
+ self,
800
+ *,
801
+ spec: id_source_t.IdSourceSpec,
802
+ names: list[str],
803
+ ) -> match_id_source_t.Data:
804
+ """Lists id and label pairs
805
+
806
+ :param spec: The id source spec to use
807
+ :param names: The names to match with the id source. At most 10 are allowed at a time
808
+ """
809
+ args = match_id_source_t.Arguments(
810
+ spec=spec,
811
+ names=names,
812
+ )
813
+ api_request = APIRequest(
814
+ method=match_id_source_t.ENDPOINT_METHOD,
815
+ endpoint=match_id_source_t.ENDPOINT_PATH,
816
+ args=args,
817
+ )
818
+ return self.do_request(api_request=api_request, return_type=match_id_source_t.Data)
819
+
820
+
741
821
  def resolve_entity_ids(
742
822
  self,
743
823
  *,
@@ -780,6 +860,27 @@ class ClientMethods(ABC):
780
860
  return self.do_request(api_request=api_request, return_type=resolve_output_conditions_t.Data)
781
861
 
782
862
 
863
+ def run_trigger(
864
+ self,
865
+ *,
866
+ trigger_ref_name: str,
867
+ entity: typing.Optional[entity_t.Entity] = None,
868
+ ) -> run_trigger_t.Data:
869
+ """Runs a trigger. Requires admin access
870
+
871
+ """
872
+ args = run_trigger_t.Arguments(
873
+ entity=entity,
874
+ trigger_ref_name=trigger_ref_name,
875
+ )
876
+ api_request = APIRequest(
877
+ method=run_trigger_t.ENDPOINT_METHOD,
878
+ endpoint=run_trigger_t.ENDPOINT_PATH,
879
+ args=args,
880
+ )
881
+ return self.do_request(api_request=api_request, return_type=run_trigger_t.Data)
882
+
883
+
783
884
  def set_input_attribute_values(
784
885
  self,
785
886
  *,
@@ -0,0 +1,49 @@
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 entity as entity_t
12
+
13
+ __all__: list[str] = [
14
+ "IdSourceSpec",
15
+ "IdSourceSpecBase",
16
+ "IdSourceSpecCustomEntity",
17
+ "IdSourceSpecEntity",
18
+ "IdSourceSpecFieldOptions",
19
+ ]
20
+
21
+
22
+ # DO NOT MODIFY -- This file is generated by type_spec
23
+ @dataclass(kw_only=True)
24
+ class IdSourceSpecBase:
25
+ pass
26
+
27
+
28
+ # DO NOT MODIFY -- This file is generated by type_spec
29
+ @dataclass(kw_only=True)
30
+ class IdSourceSpecEntity(IdSourceSpecBase):
31
+ entity_type: entity_t.EntityType
32
+
33
+
34
+ # DO NOT MODIFY -- This file is generated by type_spec
35
+ @dataclass(kw_only=True)
36
+ class IdSourceSpecCustomEntity(IdSourceSpecBase):
37
+ definition_ref_name: str
38
+
39
+
40
+ # DO NOT MODIFY -- This file is generated by type_spec
41
+ @dataclass(kw_only=True)
42
+ class IdSourceSpecFieldOptions(IdSourceSpecBase):
43
+ set_ref_name: str
44
+ subset_ref_name: typing.Optional[str] = None
45
+
46
+
47
+ # DO NOT MODIFY -- This file is generated by type_spec
48
+ IdSourceSpec = typing.Union[IdSourceSpecEntity, IdSourceSpecCustomEntity, IdSourceSpecFieldOptions]
49
+ # DO NOT MODIFY -- This file is generated by type_spec