sapiopycommons 2025.9.18a757__py3-none-any.whl → 2025.9.19a761__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/converter_service_base.py +163 -0
- sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.py +43 -0
- sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.pyi +31 -0
- sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2_grpc.py +24 -0
- sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2.py +123 -0
- sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2.pyi +598 -0
- sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2_grpc.py +24 -0
- sapiopycommons/ai/protoapi/plan/converter/converter_pb2.py +51 -0
- sapiopycommons/ai/protoapi/plan/converter/converter_pb2.pyi +63 -0
- sapiopycommons/ai/protoapi/plan/converter/converter_pb2_grpc.py +149 -0
- sapiopycommons/ai/protoapi/plan/item/item_container_pb2.py +55 -0
- sapiopycommons/ai/protoapi/plan/item/item_container_pb2.pyi +90 -0
- sapiopycommons/ai/protoapi/plan/item/item_container_pb2_grpc.py +24 -0
- sapiopycommons/ai/protoapi/plan/script/script_pb2.py +59 -0
- sapiopycommons/ai/protoapi/plan/script/script_pb2.pyi +102 -0
- sapiopycommons/ai/protoapi/plan/script/script_pb2_grpc.py +153 -0
- sapiopycommons/ai/protoapi/plan/step_output_pb2.py +45 -0
- sapiopycommons/ai/protoapi/plan/step_output_pb2.pyi +42 -0
- sapiopycommons/ai/protoapi/plan/step_output_pb2_grpc.py +24 -0
- sapiopycommons/ai/protoapi/plan/step_pb2.py +43 -0
- sapiopycommons/ai/protoapi/plan/step_pb2.pyi +43 -0
- sapiopycommons/ai/protoapi/plan/step_pb2_grpc.py +24 -0
- sapiopycommons/ai/protoapi/plan/tool/entry_pb2.py +41 -0
- sapiopycommons/ai/protoapi/plan/tool/entry_pb2.pyi +35 -0
- sapiopycommons/ai/protoapi/plan/tool/entry_pb2_grpc.py +24 -0
- sapiopycommons/ai/protoapi/plan/tool/tool_pb2.py +77 -0
- sapiopycommons/ai/protoapi/plan/tool/tool_pb2.pyi +253 -0
- sapiopycommons/ai/protoapi/plan/tool/tool_pb2_grpc.py +154 -0
- sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2.py +39 -0
- sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2.pyi +32 -0
- sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2_grpc.py +24 -0
- sapiopycommons/ai/protobuf_utils.py +504 -0
- sapiopycommons/ai/server.py +145 -0
- sapiopycommons/ai/test_client.py +367 -0
- sapiopycommons/ai/tool_service_base.py +1099 -0
- sapiopycommons/files/temp_files.py +79 -0
- sapiopycommons/webhook/webservice_handlers.py +1 -1
- {sapiopycommons-2025.9.18a757.dist-info → sapiopycommons-2025.9.19a761.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.9.18a757.dist-info → sapiopycommons-2025.9.19a761.dist-info}/RECORD +41 -5
- {sapiopycommons-2025.9.18a757.dist-info → sapiopycommons-2025.9.19a761.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.9.18a757.dist-info → sapiopycommons-2025.9.19a761.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
import tempfile
|
|
4
|
+
from typing import Callable
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# FR-47422: Created class.
|
|
8
|
+
class TempFileHandler:
|
|
9
|
+
"""
|
|
10
|
+
A utility class to manage temporary files and directories.
|
|
11
|
+
"""
|
|
12
|
+
directories: list[str]
|
|
13
|
+
files: list[str]
|
|
14
|
+
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
self.directories = []
|
|
17
|
+
self.files = []
|
|
18
|
+
|
|
19
|
+
def create_temp_directory(self) -> str:
|
|
20
|
+
"""
|
|
21
|
+
Create a temporary directory.
|
|
22
|
+
|
|
23
|
+
:return: The path to a newly created temporary directory.
|
|
24
|
+
"""
|
|
25
|
+
directory: str = tempfile.mkdtemp()
|
|
26
|
+
self.directories.append(directory)
|
|
27
|
+
return directory
|
|
28
|
+
|
|
29
|
+
def create_temp_file(self, data: str | bytes, suffix: str = "") -> str:
|
|
30
|
+
"""
|
|
31
|
+
Create a temporary file with the specified data and optional suffix.
|
|
32
|
+
|
|
33
|
+
:param data: The data to write to the temporary file.
|
|
34
|
+
:param suffix: An optional suffix for the temporary file.
|
|
35
|
+
:return: The path to a newly created temporary file containing the provided data.
|
|
36
|
+
"""
|
|
37
|
+
mode: str = 'w' if isinstance(data, str) else 'wb'
|
|
38
|
+
with tempfile.NamedTemporaryFile(mode=mode, suffix=suffix, delete=False) as tmp_file:
|
|
39
|
+
tmp_file.write(data)
|
|
40
|
+
file_path: str = tmp_file.name
|
|
41
|
+
self.files.append(file_path)
|
|
42
|
+
return file_path
|
|
43
|
+
|
|
44
|
+
def create_temp_file_from_func(self, func: Callable, is_binary: bool = True, suffix: str = "", **kwargs) -> str:
|
|
45
|
+
"""
|
|
46
|
+
Create a temporary file and populate it using the provided function. The function should accept parameters as
|
|
47
|
+
specified in the `params` dictionary. Any parameter in `params` with the value "<NEW_FILE>" will be replaced
|
|
48
|
+
with the path of the created temporary file.
|
|
49
|
+
|
|
50
|
+
:param func: The function to call with the temporary file path that will populate the file.
|
|
51
|
+
:param is_binary: Whether to open the temporary file in binary mode.
|
|
52
|
+
:param suffix: An optional suffix for the temporary file.
|
|
53
|
+
:param kwargs: Keyword arguments to pass to the function. Use "<NEW_FILE>" as a value to indicate where the
|
|
54
|
+
temporary file path should be inserted.
|
|
55
|
+
:return: The path to the newly created temporary file.
|
|
56
|
+
"""
|
|
57
|
+
mode: str = 'wb' if is_binary else 'w'
|
|
58
|
+
with tempfile.NamedTemporaryFile(mode, suffix=suffix, delete=False) as tmp_file:
|
|
59
|
+
file_path: str = tmp_file.name
|
|
60
|
+
for key, value in kwargs.items():
|
|
61
|
+
if value == "<NEW_FILE>":
|
|
62
|
+
kwargs[key] = file_path
|
|
63
|
+
func(**kwargs)
|
|
64
|
+
self.files.append(file_path)
|
|
65
|
+
return file_path
|
|
66
|
+
|
|
67
|
+
def cleanup(self) -> None:
|
|
68
|
+
"""
|
|
69
|
+
Delete all temporary files and directories created by this handler.
|
|
70
|
+
"""
|
|
71
|
+
for directory in self.directories:
|
|
72
|
+
if os.path.exists(directory):
|
|
73
|
+
shutil.rmtree(directory)
|
|
74
|
+
self.directories.clear()
|
|
75
|
+
|
|
76
|
+
for file_path in self.files:
|
|
77
|
+
if os.path.exists(file_path):
|
|
78
|
+
os.remove(file_path)
|
|
79
|
+
self.files.clear()
|
|
@@ -140,7 +140,7 @@ class AbstractWebserviceHandler(AbstractWebhookHandler):
|
|
|
140
140
|
# Get the login credentials from the headers.
|
|
141
141
|
auth: str = headers.get("Authorization")
|
|
142
142
|
if auth and auth.startswith("Basic "):
|
|
143
|
-
credentials: list[str] = b64decode(auth.split("Basic ")[1]).decode().split(":")
|
|
143
|
+
credentials: list[str] = b64decode(auth.split("Basic ")[1]).decode().split(":", 1)
|
|
144
144
|
user = self.basic_auth(url, credentials[0], credentials[1])
|
|
145
145
|
elif auth and auth.startswith("Bearer "):
|
|
146
146
|
user = self.bearer_token_auth(url, auth.split("Bearer ")[1])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.9.
|
|
3
|
+
Version: 2025.9.19a761
|
|
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,6 +1,41 @@
|
|
|
1
1
|
sapiopycommons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
sapiopycommons/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
sapiopycommons/ai/converter_service_base.py,sha256=HiUXmwqv1STgyQeF9_eTFXzjIFXp5-NJ7sEhMpV3aAU,6351
|
|
4
|
+
sapiopycommons/ai/protobuf_utils.py,sha256=cBjbxoFAwU02kNUxEce95WnMU2CMuDD-qFaeWgvQJMQ,24599
|
|
5
|
+
sapiopycommons/ai/server.py,sha256=GtkSKeHhahd40DXU6XIY3ZKpMl-MPMgPUYL8TakTj0w,5919
|
|
6
|
+
sapiopycommons/ai/test_client.py,sha256=Um93jXmIx0YaHf-YbV5NSamPTHveJ0kU_UaAfOApnZg,16342
|
|
3
7
|
sapiopycommons/ai/tool_of_tools.py,sha256=zYmQ4rNX-qYQnc-vNDnYZjtv9JgmQAmVVuHfVOdBF3w,46984
|
|
8
|
+
sapiopycommons/ai/tool_service_base.py,sha256=OmGUDsDj7sCNtjhJVohc1mUQ0PZsMhhgfG8BXAWujGs,53861
|
|
9
|
+
sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.py,sha256=8tKXwLXcqFGdQHHSEBSi6Fd7dcaCFoOqmhjzqhenb_M,2372
|
|
10
|
+
sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.pyi,sha256=FwtXmNAf7iYGEFm4kbqb04v77jNHbZg18ZmEDhle_bU,1444
|
|
11
|
+
sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2_grpc.py,sha256=uO25bcnfGqXpP4ggUur54Nr73Wj-DGWftExzLNcxdHI,931
|
|
12
|
+
sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2.py,sha256=in9iHiLPYcnLWoLeqy4nWSI0jZGHD_bMhEFRIRtJPuo,20864
|
|
13
|
+
sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2.pyi,sha256=U5zXrbBxsWilLTsRWJd1TqjdjLKFsr3enF9OJ8GfyWw,34028
|
|
14
|
+
sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2_grpc.py,sha256=Vj6qDKvsHgl25iBi3UjtTuGxihekgqCuufExvnJKzQI,940
|
|
15
|
+
sapiopycommons/ai/protoapi/plan/step_output_pb2.py,sha256=EBNCzLUDwwCqDCh35zSfFdfq0RP8WrmTMXEzEPu_1_E,2655
|
|
16
|
+
sapiopycommons/ai/protoapi/plan/step_output_pb2.pyi,sha256=yuxOYnDZ9DRuu-TLzaKOW_B4LUiYxTrNc2AbssXg4kE,2022
|
|
17
|
+
sapiopycommons/ai/protoapi/plan/step_output_pb2_grpc.py,sha256=ebWLIfOFeVE2WuUIThMBerVweH-1phviGX195UTwYyg,924
|
|
18
|
+
sapiopycommons/ai/protoapi/plan/step_pb2.py,sha256=mKTm_syaX99GzhWtGIPkxMTsfcsvW0QbRqjv06eHSM0,2433
|
|
19
|
+
sapiopycommons/ai/protoapi/plan/step_pb2.pyi,sha256=QPIcsjcUvEGQkdZMUMiVzFFNDl8yOUe_qJtf5XEp5Ck,2062
|
|
20
|
+
sapiopycommons/ai/protoapi/plan/step_pb2_grpc.py,sha256=1CBna5NBBxPwQhrkN8-Fim_j3FGmOfDo5C4c8sIBV8Q,917
|
|
21
|
+
sapiopycommons/ai/protoapi/plan/converter/converter_pb2.py,sha256=rZYBRfR0umwDYvBdYnzxR1VZSutRqunhd3QsdtQXiCM,3593
|
|
22
|
+
sapiopycommons/ai/protoapi/plan/converter/converter_pb2.pyi,sha256=_35yHfKTJH3SMdA5_c6qF6OZG6UwFWXpNh6dwRFDKkk,4250
|
|
23
|
+
sapiopycommons/ai/protoapi/plan/converter/converter_pb2_grpc.py,sha256=6T5FCmT_vEFSywUVlAlWWfBDPaILb0Dq8yCGuO_Q-BU,6448
|
|
24
|
+
sapiopycommons/ai/protoapi/plan/item/item_container_pb2.py,sha256=VIXmIw8-9jtH7peJZ16BEmGDfaVjjxTKhmlfcHWT82M,3863
|
|
25
|
+
sapiopycommons/ai/protoapi/plan/item/item_container_pb2.pyi,sha256=bbPNQDwfFDd7_S7yU99Co1O7sRhxjle-RM0_nK8jgjc,4246
|
|
26
|
+
sapiopycommons/ai/protoapi/plan/item/item_container_pb2_grpc.py,sha256=1NzBWBUINC0Rk-NGYZ-97BVKvVUxcn_I44IjQO2h-nQ,932
|
|
27
|
+
sapiopycommons/ai/protoapi/plan/script/script_pb2.py,sha256=swyahlxM7fKm-RqtgMd1Czqd1JrbXRw3sYqFTkjbbyM,5144
|
|
28
|
+
sapiopycommons/ai/protoapi/plan/script/script_pb2.pyi,sha256=GqlqLf9UX_B5vCR9cm-VoYLHFJNmZjJafcPJ6EDa8Qw,6192
|
|
29
|
+
sapiopycommons/ai/protoapi/plan/script/script_pb2_grpc.py,sha256=ginPYpsiI6U6dB6gfWHJM8LWjSHUgcqz_gR7Dmdsyck,6864
|
|
30
|
+
sapiopycommons/ai/protoapi/plan/tool/entry_pb2.py,sha256=yNyyyVvz94ewjGaHw3t0pUP-KH7ACg5hLC0QzrsFPis,2130
|
|
31
|
+
sapiopycommons/ai/protoapi/plan/tool/entry_pb2.pyi,sha256=2vI0WSy0KGFHDewMSRyX5rUkmmmSaMBLvFO7txqA6Ug,2354
|
|
32
|
+
sapiopycommons/ai/protoapi/plan/tool/entry_pb2_grpc.py,sha256=i24BfJEt7LtyROxHVEyS9RLYqLZKPvyJMKRFZj6NUTg,923
|
|
33
|
+
sapiopycommons/ai/protoapi/plan/tool/tool_pb2.py,sha256=4SqqRZAyxTnR86irNuuOVRvo3r8MFqgVkkqpHwu3uSY,8563
|
|
34
|
+
sapiopycommons/ai/protoapi/plan/tool/tool_pb2.pyi,sha256=fVx33ImMoZWVDSFLZWs6uukjRzLfY7OI9mUhDUS2-8g,17518
|
|
35
|
+
sapiopycommons/ai/protoapi/plan/tool/tool_pb2_grpc.py,sha256=CLSGEgSpN4D6wcE-P_5lzb2Nttjr4XjumxGUrZQSip0,6915
|
|
36
|
+
sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2.py,sha256=MhWzTyJz3xZgpdW8_LCVKuzKXT0cv6iHMRB-UNCUNzM,2094
|
|
37
|
+
sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2.pyi,sha256=vLYA8Tkzq2AwgVadoUp5vAg4HgGlgga0kzeS3e_XkCQ,1621
|
|
38
|
+
sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2_grpc.py,sha256=imcciy_kbmm7OV_W3jYZ53R6GQ6Yh-eUcVW0A9GkWdg,931
|
|
4
39
|
sapiopycommons/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
40
|
sapiopycommons/callbacks/callback_util.py,sha256=Z1LcXnRRjXyhmcSDUwh4NzcA6ICtcbFUMKcvAqQcS8E,153811
|
|
6
41
|
sapiopycommons/callbacks/field_builder.py,sha256=rnIP-RJafk3mZlAx1eJ8a0eSW9Ps_L6_WadCmusnENw,38772
|
|
@@ -34,6 +69,7 @@ sapiopycommons/files/file_text_converter.py,sha256=Gaj_divTiKXWd6flDOgrxNXpcn9fD
|
|
|
34
69
|
sapiopycommons/files/file_util.py,sha256=djouyGjsYgWzjz2OBRnSeMDgj6NrsJUm1a2J93J8Wco,31915
|
|
35
70
|
sapiopycommons/files/file_validator.py,sha256=ryg22-93csmRO_Pv0ZpWphNkB74xWZnHyJ23K56qLj0,28761
|
|
36
71
|
sapiopycommons/files/file_writer.py,sha256=hACVl0duCjP28gJ1NPljkjagNCLod0ygUlPbvUmRDNM,17605
|
|
72
|
+
sapiopycommons/files/temp_files.py,sha256=e1PV07wFN5At1Ob-TbfS9nsPiZ8u9_Fl22KnWxJMmac,3056
|
|
37
73
|
sapiopycommons/flowcyto/flow_cyto.py,sha256=B6DFquLi-gcWfJWyP4vYfwTXXJKl6O9W5-k8FzkM0Oo,2610
|
|
38
74
|
sapiopycommons/flowcyto/flowcyto_data.py,sha256=mYKFuLbtpJ-EsQxLGtu4tNHVlygTxKixgJxJqD68F58,2596
|
|
39
75
|
sapiopycommons/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -65,8 +101,8 @@ sapiopycommons/sftpconnect/sftp_builder.py,sha256=lFK3FeXk-sFLefW0hqY8WGUQDeYiGa
|
|
|
65
101
|
sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
66
102
|
sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
|
|
67
103
|
sapiopycommons/webhook/webhook_handlers.py,sha256=7o_wXOruhT9auNh8OfhJAh4WhhiPKij67FMBSpGPICc,39939
|
|
68
|
-
sapiopycommons/webhook/webservice_handlers.py,sha256=
|
|
69
|
-
sapiopycommons-2025.9.
|
|
70
|
-
sapiopycommons-2025.9.
|
|
71
|
-
sapiopycommons-2025.9.
|
|
72
|
-
sapiopycommons-2025.9.
|
|
104
|
+
sapiopycommons/webhook/webservice_handlers.py,sha256=cvW6Mk_110BzYqkbk63Kg7jWrltBCDALOlkJRu8h4VQ,14300
|
|
105
|
+
sapiopycommons-2025.9.19a761.dist-info/METADATA,sha256=As9JoZ85SMYRqYv83_ri1EKVYvMbU3dNWvkIVZ5RGA4,3142
|
|
106
|
+
sapiopycommons-2025.9.19a761.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
107
|
+
sapiopycommons-2025.9.19a761.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
108
|
+
sapiopycommons-2025.9.19a761.dist-info/RECORD,,
|
|
File without changes
|
{sapiopycommons-2025.9.18a757.dist-info → sapiopycommons-2025.9.19a761.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|