sapiopycommons 2025.6.30a572__py3-none-any.whl → 2025.7.1a576__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 sapiopycommons might be problematic. Click here for more details.
- sapiopycommons/ai/protobuf_utils.py +57 -3
- sapiopycommons/ai/test_client.py +7 -3
- sapiopycommons/ai/tool_service_base.py +1 -2
- {sapiopycommons-2025.6.30a572.dist-info → sapiopycommons-2025.7.1a576.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.6.30a572.dist-info → sapiopycommons-2025.7.1a576.dist-info}/RECORD +7 -7
- {sapiopycommons-2025.6.30a572.dist-info → sapiopycommons-2025.7.1a576.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.6.30a572.dist-info → sapiopycommons-2025.7.1a576.dist-info}/licenses/LICENSE +0 -0
|
@@ -276,7 +276,7 @@ class ProtobufUtils:
|
|
|
276
276
|
double_format=ProtobufUtils.double_format_to_pbo(field.double_format),
|
|
277
277
|
# color_ranges # Missing in FieldDefinition.py
|
|
278
278
|
)
|
|
279
|
-
# elif isinstance(field, VeloxFileBlobFieldDefinition):
|
|
279
|
+
# elif isinstance(field, VeloxFileBlobFieldDefinition):
|
|
280
280
|
# file_blob_properties = FileBlobPropertiesPbo()
|
|
281
281
|
elif isinstance(field, VeloxEnumFieldDefinition):
|
|
282
282
|
enum_properties = EnumPropertiesPbo(
|
|
@@ -379,8 +379,8 @@ class ProtobufUtils:
|
|
|
379
379
|
field_validator=ProtobufUtils.field_validator_to_pbo(field.field_validator),
|
|
380
380
|
# preserve_padding # Missing in FieldDefinition.py
|
|
381
381
|
)
|
|
382
|
-
|
|
383
|
-
|
|
382
|
+
else:
|
|
383
|
+
print(f"Warning: Unhandled field type for properties mapping: {type(field)}")
|
|
384
384
|
|
|
385
385
|
return VeloxFieldDefPbo(
|
|
386
386
|
data_field_type=ProtobufUtils.field_type_to_pbo(field.data_field_type),
|
|
@@ -452,3 +452,57 @@ class ProtobufUtils:
|
|
|
452
452
|
return value.int_value
|
|
453
453
|
case _:
|
|
454
454
|
return value.string_value
|
|
455
|
+
|
|
456
|
+
@staticmethod
|
|
457
|
+
def field_def_pbo_to_default_value(field_def: VeloxFieldDefPbo) -> FieldValue:
|
|
458
|
+
"""
|
|
459
|
+
Get the default value of a VeloxFieldDefPbo.
|
|
460
|
+
|
|
461
|
+
:param field_def: The VeloxFieldDefPbo object.
|
|
462
|
+
:return: The default value for the field definition.
|
|
463
|
+
"""
|
|
464
|
+
match field_def.data_field_type:
|
|
465
|
+
case FieldTypePbo.ACTION:
|
|
466
|
+
return None
|
|
467
|
+
case FieldTypePbo.ACTION_STRING:
|
|
468
|
+
return field_def.action_string_properties.default_value
|
|
469
|
+
case FieldTypePbo.AUTO_ACCESSION:
|
|
470
|
+
return None
|
|
471
|
+
case FieldTypePbo.BOOLEAN:
|
|
472
|
+
return field_def.boolean_properties.default_value
|
|
473
|
+
case FieldTypePbo.CHILDLINK:
|
|
474
|
+
return None
|
|
475
|
+
case FieldTypePbo.DATE:
|
|
476
|
+
return field_def.date_properties.default_value
|
|
477
|
+
case FieldTypePbo.DATE_RANGE:
|
|
478
|
+
return field_def.date_range_properties.default_value
|
|
479
|
+
case FieldTypePbo.DOUBLE:
|
|
480
|
+
return field_def.double_properties.default_value
|
|
481
|
+
case FieldTypePbo.ENUM:
|
|
482
|
+
return field_def.enum_properties.default_value
|
|
483
|
+
# case FieldTypePbo.FILE_BLOB:
|
|
484
|
+
# return None
|
|
485
|
+
case FieldTypePbo.IDENTIFIER:
|
|
486
|
+
return None
|
|
487
|
+
case FieldTypePbo.INTEGER:
|
|
488
|
+
return field_def.integer_properties.default_value
|
|
489
|
+
case FieldTypePbo.LINK:
|
|
490
|
+
return None
|
|
491
|
+
case FieldTypePbo.LONG:
|
|
492
|
+
return field_def.long_properties.default_value
|
|
493
|
+
case FieldTypePbo.MULTIPARENTLINK:
|
|
494
|
+
return None
|
|
495
|
+
case FieldTypePbo.PARENTLINK:
|
|
496
|
+
return None
|
|
497
|
+
case FieldTypePbo.PICKLIST:
|
|
498
|
+
return field_def.picklist_properties.default_value
|
|
499
|
+
case FieldTypePbo.SELECTION:
|
|
500
|
+
return field_def.selection_properties.default_value
|
|
501
|
+
case FieldTypePbo.SHORT:
|
|
502
|
+
return field_def.short_properties.default_value
|
|
503
|
+
case FieldTypePbo.SIDE_LINK:
|
|
504
|
+
return field_def.side_link_properties.default_value
|
|
505
|
+
case FieldTypePbo.STRING:
|
|
506
|
+
return field_def.string_properties.default_value
|
|
507
|
+
case _:
|
|
508
|
+
raise Exception(f"Unexpected field type: {field_def.data_field_type}")
|
sapiopycommons/ai/test_client.py
CHANGED
|
@@ -18,6 +18,8 @@ class ToolOutput:
|
|
|
18
18
|
A class for holding the output of a TestClient that calls a ToolService. ToolOutput objects an be
|
|
19
19
|
printed to show the output of the tool in a human-readable format.
|
|
20
20
|
"""
|
|
21
|
+
tool_name: str
|
|
22
|
+
|
|
21
23
|
binary_output: list[bytes]
|
|
22
24
|
csv_output: list[dict[str, Any]]
|
|
23
25
|
json_output: list[Any]
|
|
@@ -28,7 +30,8 @@ class ToolOutput:
|
|
|
28
30
|
|
|
29
31
|
logs: list[str]
|
|
30
32
|
|
|
31
|
-
def __init__(self):
|
|
33
|
+
def __init__(self, tool_name: str):
|
|
34
|
+
self.tool_name = tool_name
|
|
32
35
|
self.binary_output = []
|
|
33
36
|
self.csv_output = []
|
|
34
37
|
self.json_output = []
|
|
@@ -38,7 +41,8 @@ class ToolOutput:
|
|
|
38
41
|
self.logs = []
|
|
39
42
|
|
|
40
43
|
def __str__(self):
|
|
41
|
-
ret_val: str = ""
|
|
44
|
+
ret_val: str = f"{self.tool_name} Output:\n"
|
|
45
|
+
ret_val += "-" * 25 + "\n"
|
|
42
46
|
ret_val += f"Binary Output: {len(self.binary_output)} item(s)\n"
|
|
43
47
|
for binary in self.binary_output:
|
|
44
48
|
ret_val += f"\t{len(binary)} byte(s)\n"
|
|
@@ -190,7 +194,7 @@ class TestClient:
|
|
|
190
194
|
)
|
|
191
195
|
)
|
|
192
196
|
|
|
193
|
-
results = ToolOutput()
|
|
197
|
+
results = ToolOutput(tool_name)
|
|
194
198
|
for item in response.output:
|
|
195
199
|
container = item.item_container
|
|
196
200
|
|
|
@@ -773,8 +773,7 @@ class ToolBase(ABC):
|
|
|
773
773
|
for field_name, field_def in self.get_config_defs().items():
|
|
774
774
|
# Use the default value if the field is not present in the request.
|
|
775
775
|
if field_name not in raw_configs:
|
|
776
|
-
|
|
777
|
-
config_fields[field_name] = field_def.default_value
|
|
776
|
+
config_fields[field_name] = ProtobufUtils.field_def_pbo_to_default_value(field_def)
|
|
778
777
|
else:
|
|
779
778
|
config_fields[field_name] = ProtobufUtils.field_pbo_to_value(field_def, raw_configs[field_name])
|
|
780
779
|
return config_fields
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.
|
|
3
|
+
Version: 2025.7.1a576
|
|
4
4
|
Summary: Official Sapio Python API Utilities Package
|
|
5
5
|
Project-URL: Homepage, https://github.com/sapiosciences
|
|
6
6
|
Author-email: Jonathan Steck <jsteck@sapiosciences.com>, Yechen Qiao <yqiao@sapiosciences.com>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
sapiopycommons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
sapiopycommons/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sapiopycommons/ai/protobuf_utils.py,sha256=
|
|
4
|
-
sapiopycommons/ai/test_client.py,sha256=
|
|
5
|
-
sapiopycommons/ai/tool_service_base.py,sha256=
|
|
3
|
+
sapiopycommons/ai/protobuf_utils.py,sha256=5Y0z_lRVipbHPJcHJf9GosK-ZjAh_I2JI3QwV8iyfKg,24884
|
|
4
|
+
sapiopycommons/ai/test_client.py,sha256=fq19na87AGww4ZRMC23_uqLerE5h2AWTaVPLkLTFIco,9047
|
|
5
|
+
sapiopycommons/ai/tool_service_base.py,sha256=8it0853p-kw3Y1SdEyEfmxCbxM3_poUTJKFUaZ5MrCQ,35366
|
|
6
6
|
sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.py,sha256=YcZjb_YM-XeLErM8hEC_S7vGMVGvcXAMGs2b-u5zvOE,2377
|
|
7
7
|
sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.pyi,sha256=FwtXmNAf7iYGEFm4kbqb04v77jNHbZg18ZmEDhle_bU,1444
|
|
8
8
|
sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2_grpc.py,sha256=wPImJPdCUZNVEVoUWzsba9kGIXjEKPdUkawP5SnVyiU,932
|
|
@@ -86,7 +86,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
86
86
|
sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
|
|
87
87
|
sapiopycommons/webhook/webhook_handlers.py,sha256=L0HetSm43NvA5KyW3xbLpGFh2DbAaeZJVtXIEl2fvV8,39689
|
|
88
88
|
sapiopycommons/webhook/webservice_handlers.py,sha256=Y5dHx_UFWFuSqaoPL6Re-fsKYRuxvCWZ8bj6KSZ3jfM,14285
|
|
89
|
-
sapiopycommons-2025.
|
|
90
|
-
sapiopycommons-2025.
|
|
91
|
-
sapiopycommons-2025.
|
|
92
|
-
sapiopycommons-2025.
|
|
89
|
+
sapiopycommons-2025.7.1a576.dist-info/METADATA,sha256=ANStYlVstAjYeIBdMu1C4XHUkd55zKUS0ole9ZxxxNI,3142
|
|
90
|
+
sapiopycommons-2025.7.1a576.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
91
|
+
sapiopycommons-2025.7.1a576.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
92
|
+
sapiopycommons-2025.7.1a576.dist-info/RECORD,,
|
|
File without changes
|
{sapiopycommons-2025.6.30a572.dist-info → sapiopycommons-2025.7.1a576.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|