sapiopycommons 2025.6.30a570__tar.gz → 2025.6.30a572__tar.gz
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-2025.6.30a570 → sapiopycommons-2025.6.30a572}/PKG-INFO +1 -1
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/pyproject.toml +1 -1
- sapiopycommons-2025.6.30a572/src/sapiopycommons/ai/test_client.py +212 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/tool_service_base.py +6 -3
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/.gitignore +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/LICENSE +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/README.md +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/proto/step_output_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/proto/step_output_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/proto/step_output_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/proto/step_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/proto/step_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/proto/step_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/script/proto/script_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/script/proto/script_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/script/proto/script_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/tool/proto/entry_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/tool/proto/entry_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/tool/proto/entry_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/tool/proto/tool_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/tool/proto/tool_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/plan/tool/proto/tool_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.pyi +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2_grpc.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/protobuf_utils.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/callbacks/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/callbacks/callback_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/callbacks/field_builder.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/chem/IndigoMolecules.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/chem/Molecules.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/chem/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/customreport/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/customreport/auto_pagers.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/customreport/column_builder.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/customreport/custom_report_builder.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/customreport/term_builder.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/datatype/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/datatype/attachment_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/datatype/data_fields.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/datatype/pseudo_data_types.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/eln/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/eln/experiment_handler.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/eln/experiment_report_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/eln/experiment_tags.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/eln/plate_designer.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/complex_data_loader.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/file_bridge.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/file_bridge_handler.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/file_data_handler.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/file_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/file_validator.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/file_writer.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/flowcyto/flow_cyto.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/flowcyto/flowcyto_data.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/accession_service.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/aliases.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/audit_log.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/custom_report_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/directive_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/exceptions.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/html_formatter.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/popup_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/sapio_links.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/storage_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/time_util.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/multimodal/multimodal.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/multimodal/multimodal_data.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/processtracking/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/processtracking/custom_workflow_handler.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/processtracking/endpoints.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/recordmodel/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/recordmodel/record_handler.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/rules/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/rules/eln_rule_handler.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/rules/on_save_rule_handler.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/samples/aliquot.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/sftpconnect/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/sftpconnect/sftp_builder.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/webhook/__init__.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/webhook/webhook_context.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/webhook/webhook_handlers.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/webhook/webservice_handlers.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/AF-A0A009IHW8-F1-model_v4.cif +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/_do_not_add_init_py_here +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/accession_test.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/aliquot_test.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/bio_reg_test.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/chem_test.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/chem_test_curation_queue.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/curation_queue_test.sdf +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/data_type_models.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto/101_DEN084Y5_15_E01_008_clean.fcs +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto/101_DEN084Y5_15_E03_009_clean.fcs +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto/101_DEN084Y5_15_E05_010_clean.fcs +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto/8_color_ICS.wsp +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto/COVID19_W_001_O.fcs +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto_test.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/kappa.chains.fasta +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/mafft_test.py +0 -0
- {sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/test.gb +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.6.
|
|
3
|
+
Version: 2025.6.30a572
|
|
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>
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Mapping, Any
|
|
3
|
+
|
|
4
|
+
import grpc
|
|
5
|
+
|
|
6
|
+
from sapiopycommons.ai.api.fielddefinitions.proto.fields_pb2 import FieldValuePbo
|
|
7
|
+
from sapiopycommons.ai.api.plan.tool.proto.entry_pb2 import DataTypePbo, StepBinaryContainerPbo, StepCsvRowPbo, \
|
|
8
|
+
StepCsvHeaderRowPbo, StepCsvContainerPbo, StepJsonContainerPbo, StepImageContainerPbo, StepTextContainerPbo, \
|
|
9
|
+
StepItemContainerPbo, StepInputBatchPbo
|
|
10
|
+
from sapiopycommons.ai.api.plan.tool.proto.tool_pb2 import ProcessStepResponsePbo, ProcessStepRequestPbo, \
|
|
11
|
+
ToolDetailsRequestPbo, ToolDetailsResponsePbo
|
|
12
|
+
from sapiopycommons.ai.api.plan.tool.proto.tool_pb2_grpc import ToolServiceStub
|
|
13
|
+
from sapiopycommons.ai.api.session.proto.sapio_conn_info_pb2 import SapioConnectionInfoPbo, SapioUserSecretTypePbo
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ToolOutput:
|
|
17
|
+
"""
|
|
18
|
+
A class for holding the output of a TestClient that calls a ToolService. ToolOutput objects an be
|
|
19
|
+
printed to show the output of the tool in a human-readable format.
|
|
20
|
+
"""
|
|
21
|
+
binary_output: list[bytes]
|
|
22
|
+
csv_output: list[dict[str, Any]]
|
|
23
|
+
json_output: list[Any]
|
|
24
|
+
image_output: list[bytes]
|
|
25
|
+
text_output: list[str]
|
|
26
|
+
|
|
27
|
+
new_records: list[Mapping[str, FieldValuePbo]]
|
|
28
|
+
|
|
29
|
+
logs: list[str]
|
|
30
|
+
|
|
31
|
+
def __init__(self):
|
|
32
|
+
self.binary_output = []
|
|
33
|
+
self.csv_output = []
|
|
34
|
+
self.json_output = []
|
|
35
|
+
self.image_output = []
|
|
36
|
+
self.text_output = []
|
|
37
|
+
self.new_records = []
|
|
38
|
+
self.logs = []
|
|
39
|
+
|
|
40
|
+
def __str__(self):
|
|
41
|
+
ret_val: str = ""
|
|
42
|
+
ret_val += f"Binary Output: {len(self.binary_output)} item(s)\n"
|
|
43
|
+
for binary in self.binary_output:
|
|
44
|
+
ret_val += f"\t{len(binary)} byte(s)\n"
|
|
45
|
+
ret_val += f"\t{binary[:50]}...\n"
|
|
46
|
+
ret_val += f"CSV Output: {len(self.csv_output)} item(s)\n"
|
|
47
|
+
if self.csv_output:
|
|
48
|
+
ret_val += f"\tHeaders: {', '.join(self.csv_output[0].keys())}\n"
|
|
49
|
+
for i, csv_row in enumerate(self.csv_output):
|
|
50
|
+
ret_val += f"\t{i}: {', '.join(f'{v}' for k, v in csv_row.items())}\n"
|
|
51
|
+
ret_val += f"JSON Output: {len(self.json_output)} item(s)\n"
|
|
52
|
+
if self.json_output:
|
|
53
|
+
ret_val += f"\t{json.dumps(self.json_output, indent=2)}\n"
|
|
54
|
+
ret_val += f"Image Output: {len(self.image_output)} item(s)\n"
|
|
55
|
+
for image in self.image_output:
|
|
56
|
+
ret_val += f"\t{len(image)} bytes\n"
|
|
57
|
+
ret_val += f"\t{image[:50]}...\n"
|
|
58
|
+
ret_val += f"Text Output: {len(self.text_output)} item(s)\n"
|
|
59
|
+
for text in self.text_output:
|
|
60
|
+
ret_val += f"\t{text}...\n"
|
|
61
|
+
ret_val += f"New Records: {len(self.new_records)} item(s)\n"
|
|
62
|
+
for record in self.new_records:
|
|
63
|
+
ret_val += f"\t{json.dumps(record, indent=2)}\n"
|
|
64
|
+
ret_val += f"Logs: {len(self.logs)} item(s)\n"
|
|
65
|
+
for log in self.logs:
|
|
66
|
+
ret_val += f"\t{log}\n"
|
|
67
|
+
return ret_val
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class TestClient:
|
|
71
|
+
"""
|
|
72
|
+
A client for testing a ToolService. This client can be used to send requests to a tool and receive
|
|
73
|
+
responses.
|
|
74
|
+
"""
|
|
75
|
+
server_url: str
|
|
76
|
+
connection: SapioConnectionInfoPbo
|
|
77
|
+
_request_inputs: list[Any]
|
|
78
|
+
|
|
79
|
+
def __init__(self, server_url: str):
|
|
80
|
+
"""
|
|
81
|
+
:param server_url: The URL of the gRPC server to connect to.
|
|
82
|
+
"""
|
|
83
|
+
self.create_user()
|
|
84
|
+
self.server_url = server_url
|
|
85
|
+
self._request_inputs = []
|
|
86
|
+
|
|
87
|
+
def create_user(self):
|
|
88
|
+
"""
|
|
89
|
+
Create a SapioConnectionInfoPbo object with test credentials. This method can be overridden to
|
|
90
|
+
create a user with specific credentials for testing.
|
|
91
|
+
"""
|
|
92
|
+
self.connection = SapioConnectionInfoPbo()
|
|
93
|
+
self.connection.username = "Testing"
|
|
94
|
+
self.connection.webservice_url = "https://localhost:8080/webservice/api"
|
|
95
|
+
self.connection.app_guid = "1234567890"
|
|
96
|
+
self.connection.secret_type = SapioUserSecretTypePbo.PASSWORD
|
|
97
|
+
self.connection.rmi_host.append("Testing")
|
|
98
|
+
self.connection.rmi_port = 9001
|
|
99
|
+
self.connection.secret = "password"
|
|
100
|
+
|
|
101
|
+
def add_input_input(self, input_data: list[bytes]) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Add a binary input to the the next request.
|
|
104
|
+
"""
|
|
105
|
+
self._add_input(DataTypePbo.BINARY, StepBinaryContainerPbo(items=input_data))
|
|
106
|
+
|
|
107
|
+
def add_csv_input(self, input_data: list[dict[str, Any]]) -> None:
|
|
108
|
+
"""
|
|
109
|
+
Add a CSV input to the next request.
|
|
110
|
+
"""
|
|
111
|
+
csv_items = []
|
|
112
|
+
for row in input_data:
|
|
113
|
+
csv_items.append(StepCsvRowPbo(cells=[str(value) for value in row.values()]))
|
|
114
|
+
header = StepCsvHeaderRowPbo(cells=list(input_data[0].keys()))
|
|
115
|
+
self._add_input(DataTypePbo.CSV, StepCsvContainerPbo(header=header, items=csv_items))
|
|
116
|
+
|
|
117
|
+
def add_json_input(self, input_data: list[dict[str, Any]]) -> None:
|
|
118
|
+
"""
|
|
119
|
+
Add a JSON input to the next request.
|
|
120
|
+
"""
|
|
121
|
+
self._add_input(DataTypePbo.JSON, StepJsonContainerPbo(items=[json.dumps(x) for x in input_data]))
|
|
122
|
+
|
|
123
|
+
def add_image_input(self, input_data: list[bytes], image_format: str = "png") -> None:
|
|
124
|
+
"""
|
|
125
|
+
Add an image input to the next request.
|
|
126
|
+
"""
|
|
127
|
+
self._add_input(DataTypePbo.IMAGE, StepImageContainerPbo(items=input_data, image_format=image_format))
|
|
128
|
+
|
|
129
|
+
def add_text_input(self, input_data: list[str]) -> None:
|
|
130
|
+
"""
|
|
131
|
+
Add a text input to the next request.
|
|
132
|
+
"""
|
|
133
|
+
self._add_input(DataTypePbo.TEXT, StepTextContainerPbo(items=input_data))
|
|
134
|
+
|
|
135
|
+
def clear_inputs(self) -> None:
|
|
136
|
+
"""
|
|
137
|
+
Clear all inputs that have been added to the next request.
|
|
138
|
+
This is useful if you want to start a new request without the previous inputs.
|
|
139
|
+
"""
|
|
140
|
+
self._request_inputs.clear()
|
|
141
|
+
|
|
142
|
+
def _add_input(self, data_type: DataTypePbo, items: Any) -> None:
|
|
143
|
+
"""
|
|
144
|
+
Helper method for adding inputs to the next request.
|
|
145
|
+
"""
|
|
146
|
+
match data_type:
|
|
147
|
+
case DataTypePbo.BINARY:
|
|
148
|
+
container = StepItemContainerPbo(dataType=data_type, binary_container=items)
|
|
149
|
+
case DataTypePbo.CSV:
|
|
150
|
+
container = StepItemContainerPbo(dataType=data_type, csv_container=items)
|
|
151
|
+
case DataTypePbo.JSON:
|
|
152
|
+
container = StepItemContainerPbo(dataType=data_type, json_container=items)
|
|
153
|
+
case DataTypePbo.IMAGE:
|
|
154
|
+
container = StepItemContainerPbo(dataType=data_type, image_container=items)
|
|
155
|
+
case DataTypePbo.TEXT:
|
|
156
|
+
container = StepItemContainerPbo(dataType=data_type, text_container=items)
|
|
157
|
+
case _:
|
|
158
|
+
raise ValueError(f"Unsupported data type: {data_type}")
|
|
159
|
+
self._request_inputs.append(container)
|
|
160
|
+
|
|
161
|
+
def get_service_details(self) -> ToolDetailsResponsePbo:
|
|
162
|
+
"""
|
|
163
|
+
Get the details of the tools from the server.
|
|
164
|
+
|
|
165
|
+
:return: A ToolDetailsResponsePbo object containing the details of the tool service.
|
|
166
|
+
"""
|
|
167
|
+
with grpc.insecure_channel(self.server_url) as channel:
|
|
168
|
+
stub = ToolServiceStub(channel)
|
|
169
|
+
return stub.GetToolDetails(ToolDetailsRequestPbo(sapio_conn_info=self.connection))
|
|
170
|
+
|
|
171
|
+
def call_tool(self, tool_name: str) -> ToolOutput:
|
|
172
|
+
"""
|
|
173
|
+
Send the request to the tool service for a particular tool name. This will send all the inputs that have been
|
|
174
|
+
added using the add_X_input functions.
|
|
175
|
+
|
|
176
|
+
:param tool_name: The name of the tool to call on the server.
|
|
177
|
+
:return: A ToolOutput object containing the results of the tool service call.
|
|
178
|
+
"""
|
|
179
|
+
with grpc.insecure_channel(self.server_url) as channel:
|
|
180
|
+
stub = ToolServiceStub(channel)
|
|
181
|
+
|
|
182
|
+
response: ProcessStepResponsePbo = stub.ProcessData(
|
|
183
|
+
ProcessStepRequestPbo(
|
|
184
|
+
sapio_user=self.connection,
|
|
185
|
+
tool_name=tool_name,
|
|
186
|
+
input=[
|
|
187
|
+
StepInputBatchPbo(is_partial=False, item_container=item)
|
|
188
|
+
for item in self._request_inputs
|
|
189
|
+
]
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
results = ToolOutput()
|
|
194
|
+
for item in response.output:
|
|
195
|
+
container = item.item_container
|
|
196
|
+
|
|
197
|
+
results.binary_output.extend(container.binary_container.items)
|
|
198
|
+
for header in container.csv_container.header.cells:
|
|
199
|
+
output_row: dict[str, Any] = {}
|
|
200
|
+
for i, row in enumerate(container.csv_container.items):
|
|
201
|
+
output_row[header] = row.cells[i]
|
|
202
|
+
results.csv_output.append(output_row)
|
|
203
|
+
results.json_output.extend([json.loads(x) for x in container.json_container.items])
|
|
204
|
+
results.image_output.extend(container.image_container.items)
|
|
205
|
+
results.text_output.extend(container.text_container.items)
|
|
206
|
+
|
|
207
|
+
for record in response.new_records:
|
|
208
|
+
results.new_records.append(record.fields)
|
|
209
|
+
|
|
210
|
+
results.logs.extend(response.log)
|
|
211
|
+
|
|
212
|
+
return results
|
|
@@ -643,8 +643,7 @@ class ToolBase(ABC):
|
|
|
643
643
|
def log_info(self, message: str) -> None:
|
|
644
644
|
"""
|
|
645
645
|
Log an info message for this tool. If verbose logging is enabled, this message will be included in the logs
|
|
646
|
-
returned to the caller.
|
|
647
|
-
.
|
|
646
|
+
returned to the caller. Empty/None inputs will not be logged.
|
|
648
647
|
|
|
649
648
|
:param message: The message to log.
|
|
650
649
|
"""
|
|
@@ -657,6 +656,7 @@ class ToolBase(ABC):
|
|
|
657
656
|
def log_warning(self, message: str) -> None:
|
|
658
657
|
"""
|
|
659
658
|
Log a warning message for this tool. This message will be included in the logs returned to the caller.
|
|
659
|
+
Empty/None inputs will not be logged.
|
|
660
660
|
|
|
661
661
|
:param message: The message to log.
|
|
662
662
|
"""
|
|
@@ -668,6 +668,7 @@ class ToolBase(ABC):
|
|
|
668
668
|
def log_error(self, message: str) -> None:
|
|
669
669
|
"""
|
|
670
670
|
Log an error message for this tool. This message will be included in the logs returned to the caller.
|
|
671
|
+
Empty/None inputs will not be logged.
|
|
671
672
|
|
|
672
673
|
:param message: The message to log.
|
|
673
674
|
"""
|
|
@@ -679,6 +680,7 @@ class ToolBase(ABC):
|
|
|
679
680
|
def log_exception(self, message: str, e: Exception) -> None:
|
|
680
681
|
"""
|
|
681
682
|
Log an exception for this tool. This message will be included in the logs returned to the caller.
|
|
683
|
+
Empty/None inputs will not be logged.
|
|
682
684
|
|
|
683
685
|
:param message: The message to log.
|
|
684
686
|
:param e: The exception to log.
|
|
@@ -761,7 +763,8 @@ class ToolBase(ABC):
|
|
|
761
763
|
|
|
762
764
|
def get_config_fields(self) -> dict[str, FieldValue]:
|
|
763
765
|
"""
|
|
764
|
-
Get the configuration
|
|
766
|
+
Get the configuration field values from the request object. If a field is not present in the request,
|
|
767
|
+
the default value from the config definition will be returned.
|
|
765
768
|
|
|
766
769
|
:return: A dictionary of configuration field names and their values.
|
|
767
770
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/__init__.py
RENAMED
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/ai/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/chem/Molecules.py
RENAMED
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/chem/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/eln/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/files/file_util.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/general/aliases.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/rules/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/samples/aliquot.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/src/sapiopycommons/webhook/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/AF-A0A009IHW8-F1-model_v4.cif
RENAMED
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/_do_not_add_init_py_here
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/chem_test_curation_queue.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto/8_color_ICS.wsp
RENAMED
|
File without changes
|
{sapiopycommons-2025.6.30a570 → sapiopycommons-2025.6.30a572}/tests/flowcyto/COVID19_W_001_O.fcs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|