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

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.53
3
+ Version: 0.0.55
4
4
  Summary: Uncountable SDK
5
5
  Project-URL: Homepage, https://github.com/uncountableinc/uncountable-python-sdk
6
6
  Project-URL: Repository, https://github.com/uncountableinc/uncountable-python-sdk.git
@@ -16,8 +16,8 @@ docs/static/favicons/mstile-150x150.png,sha256=eAK4QdEofhdLtfmjuPTpnX3MJqYnvGXsH
16
16
  docs/static/favicons/safari-pinned-tab.svg,sha256=S84fRnz0ZxLnQrKtmmFZytiRyu1xLtMR_RVy5jmwU7k,1926
17
17
  examples/async_batch.py,sha256=CffQ8O9drJ-Mdd6S5DnMIOBsHv5aVkTZrD3l3xBnB4s,1094
18
18
  examples/create_entity.py,sha256=noZdtJ5f9Wfiob3zUH-8bDVbrCPJnFtXFk_W9pSjvUA,664
19
- examples/edit_recipe_inputs.py,sha256=SFHhccktlpWlz4ujh30KZ-hZTFneRWuEp9b3nJSbNn8,1647
20
- examples/invoke_uploader.py,sha256=Rn5sSZowW6_0yX6843q2HOSIECfK4cOCB1Hmco3iWVo,625
19
+ examples/edit_recipe_inputs.py,sha256=9ZtpdeMSO5HGsVBQtftc_PI7-qpafY-YMWoYbtcUXvo,1649
20
+ examples/invoke_uploader.py,sha256=rEvmVY5TjigN_-4PTQdkjY-bC5DrYMcJgquyZ4Tt5FM,748
21
21
  examples/upload_files.py,sha256=tUfKFqiqwnw08OL5Y8_e4j5pSRhp94cFex8XTuVa_ig,487
22
22
  pkgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  pkgs/argument_parser/__init__.py,sha256=CsQ6QoPKSLLRVl-z6URAmPkiUL9ZPZoV4rJHgy_-RjA,385
@@ -28,7 +28,7 @@ pkgs/argument_parser/case_convert.py,sha256=NuJLJUJRbyVb6_Slen4uqaStEHbcOS1d-hBB
28
28
  pkgs/filesystem_utils/__init__.py,sha256=NSsQrUCoGISBCqCCyq6_583sYHTVEQeDjDO8hvZn3ag,1261
29
29
  pkgs/filesystem_utils/_gdrive_session.py,sha256=OZudNoP2HikolnpurVJhJdh5fgzqbaZQvn53ReGGXx4,11015
30
30
  pkgs/filesystem_utils/_local_session.py,sha256=xFEYhAvNqrOYqwt4jrEYOuYkjJn0zclZhTelW_Q1-rw,2325
31
- pkgs/filesystem_utils/_s3_session.py,sha256=LtFGCs6nhIY6z8wWCC5mQYDg54qFIo4iFIBwCeXMcZU,3909
31
+ pkgs/filesystem_utils/_s3_session.py,sha256=UbVTUM5olc2Kq_1TX7e5rI3UD5w49ko7CWjsMnSJVmg,3946
32
32
  pkgs/filesystem_utils/_sftp_session.py,sha256=gNoUD_b4MuVqWj31nU-FpfpXZlyWkwdEHtX1S8W6gpQ,4727
33
33
  pkgs/filesystem_utils/file_type_utils.py,sha256=Xd-mg35mAENUgNJVz5uK8nEfrUp-NQld_gnXFEq3K-8,1487
34
34
  pkgs/filesystem_utils/filesystem_session.py,sha256=BQ2Go8Mu9-GcnaWh2Pm4x7ugLVsres6XrOQ8RoiEpcE,1045
@@ -89,13 +89,13 @@ uncountable/integration/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
89
89
  uncountable/integration/db/connect.py,sha256=YtQHJ1DBGPhxKFRCfiXqohOYUceKSxMVOJ88aPI48Ug,181
90
90
  uncountable/integration/executors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
91
  uncountable/integration/executors/executors.py,sha256=v5ClGVUlvrZcMdmGQa8Ll668G_HGTnKpGOnTM7UMZCQ,956
92
- uncountable/integration/executors/generic_upload_executor.py,sha256=wafNY_gpbUiQhvkFPDw-GGiJLmDVtTRgH_5jwMLy2Z4,10283
92
+ uncountable/integration/executors/generic_upload_executor.py,sha256=Tl7Aw908CJzH3Sv-mXRAvDVHbVgghMd2WGJH-JXmQ10,10251
93
93
  uncountable/integration/executors/script_executor.py,sha256=OmSBOtU48G3mqza9c2lCm84pGGyaDk-ZBJCx3RsdJXc,846
94
94
  uncountable/integration/secret_retrieval/__init__.py,sha256=3QXVj35w8rRMxVvmmsViFYDi3lcb3g70incfalOEm6o,87
95
95
  uncountable/integration/secret_retrieval/retrieve_secret.py,sha256=BS1dXVaChgpgBDKWkcLrl9hBDQIASRQMr3l41ytfbEc,3036
96
96
  uncountable/types/__init__.py,sha256=UuLBpo8Uxv9k-UZS8DINg3y-LPrs2dC7Qg83BB8p2_k,8222
97
97
  uncountable/types/async_batch.py,sha256=ihCv5XWSTTPmuO-GMPn1EACGI2CBUIJTATZ3aPgsNBA,523
98
- uncountable/types/async_batch_processor.py,sha256=R--exgi4Gw0HWCnh8M-3_2PqG2ByTBtdyuSQ2eYtYn8,8671
98
+ uncountable/types/async_batch_processor.py,sha256=rU9s_EiaoHFp0dEL0f2tmNM0bMa01Loqv4px5SKnhj4,8595
99
99
  uncountable/types/async_batch_t.py,sha256=9jp9rOyetRdD5aQVyijzQggTyYU4021PBVGXk0ooBCQ,1911
100
100
  uncountable/types/base.py,sha256=xVSjWvA_fUUnkCg83EjoYEFvAfmskinKFMeYFOxNc9E,359
101
101
  uncountable/types/base_t.py,sha256=XXjZXexx0xWFUxMMhW8i9nIL6n8dsZVsHwdgnhZ0zJ4,2714
@@ -103,7 +103,7 @@ uncountable/types/calculations.py,sha256=FFO_D3BbKoGDZnqWvTKpW4KF359i2vrKjpdFCLY
103
103
  uncountable/types/calculations_t.py,sha256=7GTSi2L8NYjzjUJJx3cmtVkK9uD-uhfYvIFK-ffQj-8,556
104
104
  uncountable/types/chemical_structure.py,sha256=E-LnikTFDoVQ1b2zKaVUIO_PAKm-7aZZYJi8I8SDSic,302
105
105
  uncountable/types/chemical_structure_t.py,sha256=aFsTkkbzy6Gvyde3qrrEYD95gcYhxkgKMiDRaRE0o-Y,760
106
- uncountable/types/client_base.py,sha256=db6V-Jea8iWT4kz2hXc5c_doLJKLZTd5T-F4ehobWMs,65431
106
+ uncountable/types/client_base.py,sha256=qu1g7K5eLirZbAXRLJ_QDaVAbotC4tDW5-HZ_mkSHwE,65355
107
107
  uncountable/types/client_config.py,sha256=4h5Liko9uKCo9_0gdbPhoK6Jr2Kv7tioLiQ8iKeq-_4,301
108
108
  uncountable/types/client_config_t.py,sha256=_HdS37gMSTIiD4qLnW9dIgt8_Rt5A6xhwMGGga7vnLg,625
109
109
  uncountable/types/curves.py,sha256=W6uMpG5SyW1MS82szNpxkFEn1MnxNpBFyFbQb2Ysfng,366
@@ -116,8 +116,8 @@ uncountable/types/field_values.py,sha256=uuIWX-xmfvcinYPdfkWJeb56zzQY01mc9rmotMP
116
116
  uncountable/types/field_values_t.py,sha256=_JYzmHlPczEnROz_tUbY0r3mZWffCB8m2_a9ktZLgP0,1700
117
117
  uncountable/types/fields.py,sha256=GUY5ne8Zp2_Lalikr0zcbdJrin8dG81eyS8fKWJ9yf8,266
118
118
  uncountable/types/fields_t.py,sha256=9pDroeNvj4hQQ4QB4-2ioTAFR30YTuW_364Q-Ka9SoQ,564
119
- uncountable/types/generic_upload.py,sha256=hbtuOVMJhCRfPQM_BwtLMV509--iv8NXjtlTfCeRqdU,395
120
- uncountable/types/generic_upload_t.py,sha256=euOF_oFwT62a---oBjZeGVvU67TpXh8da9njrhlg46w,1202
119
+ uncountable/types/generic_upload.py,sha256=n6hue9BX_rLSXeEt_DcGwL2ckxfNXg1wEPR9JNEGQxQ,879
120
+ uncountable/types/generic_upload_t.py,sha256=Hv4cVyllV1BMW2HDOlA6XuF3lQOA8DTAMblgAsu0AIU,3314
121
121
  uncountable/types/id_source.py,sha256=wGLA0fMl-5IqBG_fg2UDC7fY-8CWRBNFJOokejOoN_w,567
122
122
  uncountable/types/id_source_t.py,sha256=ReOuIHIuFbkE2mQ58x6UP4jCV4_JUxMCvAU9bxUxG84,1369
123
123
  uncountable/types/identifier.py,sha256=6ziONd__L07ijhVwpIehUUDvxgKTtHbunk-6CivJqxQ,503
@@ -241,8 +241,8 @@ uncountable/types/api/recipes/unlock_recipes.py,sha256=AvzQeZCLs9i7CuhMs3Xltdi4n
241
241
  uncountable/types/api/triggers/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
242
242
  uncountable/types/api/triggers/run_trigger.py,sha256=_Rpha9nxXI3Xr17CrGDtofg4HZ81x2lt0rMZ6As0qfE,893
243
243
  uncountable/types/api/uploader/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
244
- uncountable/types/api/uploader/invoke_uploader.py,sha256=4zOcB_38uT73Jm3-XqkG40fBM1R5vpvPpGAg-U4lzxY,1059
245
- UncountablePythonSDK-0.0.53.dist-info/METADATA,sha256=grgR1LMtYrZy0VXQH5w99anOyuZr7qC26fCjfRJk7BE,1934
246
- UncountablePythonSDK-0.0.53.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
247
- UncountablePythonSDK-0.0.53.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
248
- UncountablePythonSDK-0.0.53.dist-info/RECORD,,
244
+ uncountable/types/api/uploader/invoke_uploader.py,sha256=Rc77y5q-3R9-SNQgm8P35zKaW2D1Hbtm7PDixnOn1G0,1025
245
+ UncountablePythonSDK-0.0.55.dist-info/METADATA,sha256=yp10_5j-eNLvAsecV4ydazDBKLEnYB0N8-62LPziMDE,1934
246
+ UncountablePythonSDK-0.0.55.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
247
+ UncountablePythonSDK-0.0.55.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
248
+ UncountablePythonSDK-0.0.55.dist-info/RECORD,,
@@ -29,7 +29,7 @@ edits.append(
29
29
  edit_recipe_inputs_t.RecipeInputEditAddInput(
30
30
  quantity_basis=QuantityBasis.MASS,
31
31
  ingredient_key=IdentifierKeyId(id=1),
32
- value_numeric=Decimal(56.7),
32
+ value_numeric=Decimal("56.7"),
33
33
  )
34
34
  )
35
35
  edits.append(
@@ -1,6 +1,7 @@
1
1
  import os
2
2
 
3
3
  from uncountable.core import AuthDetailsApiKey, Client, MediaFileUpload
4
+ from uncountable.types import generic_upload_t
4
5
  from uncountable.types.identifier_t import IdentifierKeyId
5
6
 
6
7
  client = Client(
@@ -19,5 +20,7 @@ uploaded_file = client.upload_files(
19
20
  client.invoke_uploader(
20
21
  file_id=uploaded_file.file_id,
21
22
  uploader_key=IdentifierKeyId(id=48),
22
- material_family_key=IdentifierKeyId(id=1),
23
+ destination=generic_upload_t.UploadDestinationMaterialFamily(
24
+ material_family_key=IdentifierKeyId(id=7)
25
+ ),
23
26
  )
@@ -53,16 +53,16 @@ class S3Session(FileSystemSession):
53
53
  recursive: bool = False,
54
54
  valid_extensions: list[str] | None = None,
55
55
  ) -> list[FileSystemObject]:
56
- if recursive:
57
- raise NotImplementedError("recursive file listings not implemented for s3")
58
-
59
56
  if not isinstance(dir_path, FileSystemFileReference):
60
57
  raise IncompatibleFileReference()
61
58
 
62
59
  assert self.bucket is not None, "call to list_files on uninitialized s3 session"
63
60
 
64
61
  filesystem_references: list[FileSystemObject] = []
65
- for obj in self.bucket.objects.filter(Prefix=dir_path.filepath):
62
+ prefix = _add_slash(dir_path.filepath)
63
+ for obj in self.bucket.objects.filter(Prefix=prefix):
64
+ if not recursive and (obj.key == prefix or "/" in obj.key[len(prefix) :]):
65
+ continue
66
66
  if valid_extensions is None or any(
67
67
  obj.key.endswith(valid_extension) for valid_extension in valid_extensions
68
68
  ):
@@ -267,12 +267,12 @@ class GenericUploadJob(Job):
267
267
 
268
268
  file_ids = [file.file_id for file in uploaded_files]
269
269
 
270
- for material_family_key in self.upload_strategy.material_family_keys:
270
+ for destination in self.upload_strategy.destinations:
271
271
  for file_id in file_ids:
272
272
  batch_processor.invoke_uploader(
273
273
  file_id=file_id,
274
274
  uploader_key=self.upload_strategy.uploader_key,
275
- material_family_key=material_family_key,
275
+ destination=destination,
276
276
  )
277
277
 
278
278
  return JobResult(success=True)
@@ -10,6 +10,7 @@ from decimal import Decimal # noqa: F401
10
10
  import dataclasses
11
11
  from ... import async_batch_t
12
12
  from ... import base_t
13
+ from ... import generic_upload_t
13
14
  from ... import identifier_t
14
15
 
15
16
  __all__: list[str] = [
@@ -28,8 +29,7 @@ ENDPOINT_PATH = "api/external/uploader/invoke_uploader"
28
29
  class Arguments:
29
30
  file_id: base_t.ObjectId
30
31
  uploader_key: identifier_t.IdentifierKey
31
- material_family_key: identifier_t.IdentifierKey
32
- recipe_key: typing.Optional[identifier_t.IdentifierKey] = None
32
+ destination: generic_upload_t.UploadDestination
33
33
 
34
34
 
35
35
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -13,6 +13,7 @@ from uncountable.types import async_batch_t
13
13
  from uncountable.types import base_t
14
14
  import uncountable.types.api.recipes.create_recipe as create_recipe_t
15
15
  import uncountable.types.api.recipes.edit_recipe_inputs as edit_recipe_inputs_t
16
+ from uncountable.types import generic_upload_t
16
17
  from uncountable.types import identifier_t
17
18
  import uncountable.types.api.uploader.invoke_uploader as invoke_uploader_t
18
19
  from uncountable.types import recipe_identifiers_t
@@ -162,8 +163,7 @@ class AsyncBatchProcessorBase(ABC):
162
163
  *,
163
164
  file_id: base_t.ObjectId,
164
165
  uploader_key: identifier_t.IdentifierKey,
165
- material_family_key: identifier_t.IdentifierKey,
166
- recipe_key: typing.Optional[identifier_t.IdentifierKey] = None,
166
+ destination: generic_upload_t.UploadDestination,
167
167
  depends_on: typing.Optional[list[str]] = None,
168
168
  ) -> async_batch_t.QueuedAsyncBatchRequest:
169
169
  """Runs a file through an uploader.
@@ -173,8 +173,7 @@ class AsyncBatchProcessorBase(ABC):
173
173
  args = invoke_uploader_t.Arguments(
174
174
  file_id=file_id,
175
175
  uploader_key=uploader_key,
176
- material_family_key=material_family_key,
177
- recipe_key=recipe_key,
176
+ destination=destination,
178
177
  )
179
178
  json_data = serialize_for_api(args)
180
179
 
@@ -29,6 +29,7 @@ from uncountable.types import entity_t
29
29
  import uncountable.types.api.batch.execute_batch as execute_batch_t
30
30
  import uncountable.types.api.batch.execute_batch_load_async as execute_batch_load_async_t
31
31
  from uncountable.types import field_values_t
32
+ from uncountable.types import generic_upload_t
32
33
  import uncountable.types.api.recipes.get_curve as get_curve_t
33
34
  import uncountable.types.api.entity.get_entities_data as get_entities_data_t
34
35
  import uncountable.types.api.inputs.get_input_data as get_input_data_t
@@ -856,8 +857,7 @@ class ClientMethods(ABC):
856
857
  *,
857
858
  file_id: base_t.ObjectId,
858
859
  uploader_key: identifier_t.IdentifierKey,
859
- material_family_key: identifier_t.IdentifierKey,
860
- recipe_key: typing.Optional[identifier_t.IdentifierKey] = None,
860
+ destination: generic_upload_t.UploadDestination,
861
861
  ) -> invoke_uploader_t.Data:
862
862
  """Runs a file through an uploader.
863
863
 
@@ -865,8 +865,7 @@ class ClientMethods(ABC):
865
865
  args = invoke_uploader_t.Arguments(
866
866
  file_id=file_id,
867
867
  uploader_key=uploader_key,
868
- material_family_key=material_family_key,
869
- recipe_key=recipe_key,
868
+ destination=destination,
870
869
  )
871
870
  api_request = APIRequest(
872
871
  method=invoke_uploader_t.ENDPOINT_METHOD,
@@ -5,5 +5,11 @@
5
5
  # DO NOT MODIFY -- This file is generated by type_spec
6
6
  # Kept only for SDK backwards compatibility
7
7
  from .generic_upload_t import GenericRemoteDirectoryScope as GenericRemoteDirectoryScope
8
+ from .generic_upload_t import UploadDestinationType as UploadDestinationType
9
+ from .generic_upload_t import UploadDestinationBase as UploadDestinationBase
10
+ from .generic_upload_t import UploadDestinationProject as UploadDestinationProject
11
+ from .generic_upload_t import UploadDestinationMaterialFamily as UploadDestinationMaterialFamily
12
+ from .generic_upload_t import UploadDestinationRecipe as UploadDestinationRecipe
13
+ from .generic_upload_t import UploadDestination as UploadDestination
8
14
  from .generic_upload_t import GenericUploadStrategy as GenericUploadStrategy
9
15
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -7,12 +7,21 @@ 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
  import dataclasses
12
+ from pkgs.serialization import serial_class
13
+ from pkgs.serialization import serial_union_annotation
11
14
  from . import identifier_t
12
15
 
13
16
  __all__: list[str] = [
14
17
  "GenericRemoteDirectoryScope",
15
18
  "GenericUploadStrategy",
19
+ "UploadDestination",
20
+ "UploadDestinationBase",
21
+ "UploadDestinationMaterialFamily",
22
+ "UploadDestinationProject",
23
+ "UploadDestinationRecipe",
24
+ "UploadDestinationType",
16
25
  ]
17
26
 
18
27
 
@@ -31,10 +40,67 @@ class GenericRemoteDirectoryScope:
31
40
  delimiter: typing.Optional[str] = None
32
41
 
33
42
 
43
+ # DO NOT MODIFY -- This file is generated by type_spec
44
+ class UploadDestinationType(StrEnum):
45
+ PROJECT = "project"
46
+ MATERIAL_FAMILY = "material_family"
47
+ RECIPE = "recipe"
48
+
49
+
50
+ # DO NOT MODIFY -- This file is generated by type_spec
51
+ @dataclasses.dataclass(kw_only=True)
52
+ class UploadDestinationBase:
53
+ type: UploadDestinationType
54
+
55
+
56
+ # DO NOT MODIFY -- This file is generated by type_spec
57
+ @serial_class(
58
+ parse_require={"type"},
59
+ )
60
+ @dataclasses.dataclass(kw_only=True)
61
+ class UploadDestinationProject(UploadDestinationBase):
62
+ type: typing.Literal[UploadDestinationType.PROJECT] = UploadDestinationType.PROJECT
63
+ project_key: identifier_t.IdentifierKey
64
+
65
+
66
+ # DO NOT MODIFY -- This file is generated by type_spec
67
+ @serial_class(
68
+ parse_require={"type"},
69
+ )
70
+ @dataclasses.dataclass(kw_only=True)
71
+ class UploadDestinationMaterialFamily(UploadDestinationBase):
72
+ type: typing.Literal[UploadDestinationType.MATERIAL_FAMILY] = UploadDestinationType.MATERIAL_FAMILY
73
+ material_family_key: identifier_t.IdentifierKey
74
+
75
+
76
+ # DO NOT MODIFY -- This file is generated by type_spec
77
+ @serial_class(
78
+ parse_require={"type"},
79
+ )
80
+ @dataclasses.dataclass(kw_only=True)
81
+ class UploadDestinationRecipe(UploadDestinationBase):
82
+ type: typing.Literal[UploadDestinationType.RECIPE] = UploadDestinationType.RECIPE
83
+ recipe_key: identifier_t.IdentifierKey
84
+
85
+
86
+ # DO NOT MODIFY -- This file is generated by type_spec
87
+ UploadDestination = typing.Annotated[
88
+ typing.Union[UploadDestinationProject, UploadDestinationMaterialFamily, UploadDestinationRecipe],
89
+ serial_union_annotation(
90
+ discriminator="type",
91
+ discriminator_map={
92
+ "project": UploadDestinationProject,
93
+ "material_family": UploadDestinationMaterialFamily,
94
+ "recipe": UploadDestinationRecipe,
95
+ },
96
+ ),
97
+ ]
98
+
99
+
34
100
  # DO NOT MODIFY -- This file is generated by type_spec
35
101
  @dataclasses.dataclass(kw_only=True)
36
102
  class GenericUploadStrategy:
37
103
  uploader_key: identifier_t.IdentifierKey
38
- material_family_keys: list[identifier_t.IdentifierKey]
104
+ destinations: list[UploadDestination]
39
105
  skip_moving_files: bool = False
40
106
  # DO NOT MODIFY -- This file is generated by type_spec