sapiopycommons 2025.4.15a484__py3-none-any.whl → 2025.4.16a485__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.

@@ -63,7 +63,7 @@ class ExperimentCacheManager:
63
63
  self._predefined_fields = {}
64
64
 
65
65
  def get_experiment_template(self, name: str, active: bool = True, version: int | None = None,
66
- first_match: bool = False) -> ElnTemplate:
66
+ first_match: bool = False, public: bool | None = True) -> ElnTemplate:
67
67
  """
68
68
  Get the experiment template with the given information.
69
69
 
@@ -71,6 +71,10 @@ class ExperimentCacheManager:
71
71
  :param active: Whether the template is marked as active.
72
72
  :param version: The version of the template to get. If None, the latest version will be returned.
73
73
  :param first_match: If true, returns the first match found. If false, raises an exception.
74
+ :param public: Whether the template is public. If true, only pubic templates will be queried. If false, only
75
+ private templates will be queried. If None, both public and private templates will be queried. Non-public
76
+ templates do not have a version number, so this will always fail if public is false and a version number is
77
+ provided.
74
78
  :return: The experiment template with the given information.
75
79
  """
76
80
  if not hasattr(self, "_templates"):
@@ -78,11 +82,11 @@ class ExperimentCacheManager:
78
82
  query.active_templates_only = False
79
83
  query.latest_version_only = False
80
84
  self._templates = self.eln_man.get_template_experiment_list(query)
81
- return self._find_template(self._templates, name, active, version, first_match)
85
+ return self._find_template(self._templates, name, active, version, first_match, public)
82
86
 
83
87
 
84
88
  def get_protocol_template(self, name: str, active: bool = True, version: int | None = None,
85
- first_match: bool = False) -> ProtocolTemplateInfo:
89
+ first_match: bool = False, public: bool | None = True) -> ProtocolTemplateInfo:
86
90
  """
87
91
  Get the protocol template with the given information. Will throw an exception if multiple templates match
88
92
  the given information.
@@ -91,6 +95,10 @@ class ExperimentCacheManager:
91
95
  :param active: Whether the template is marked as active.
92
96
  :param version: The version of the template to get. If None, the latest version will be returned.
93
97
  :param first_match: If true, returns the first match found. If false, raises an exception.
98
+ :param public: Whether the template is public. If true, only pubic templates will be queried. If false, only
99
+ private templates will be queried. If None, both public and private templates will be queried. Non-public
100
+ templates do not have a version number, so this will always fail if public is false and a version number is
101
+ provided.
94
102
  :return: The protocol template with the given information.
95
103
  """
96
104
  if not hasattr(self, "_protocols"):
@@ -98,11 +106,11 @@ class ExperimentCacheManager:
98
106
  query.active_templates_only = False
99
107
  query.latest_version_only = False
100
108
  self._protocols = self.eln_man.get_protocol_template_info_list(query)
101
- return self._find_template(self._protocols, name, active, version, first_match)
109
+ return self._find_template(self._protocols, name, active, version, first_match, public)
102
110
 
103
111
  @staticmethod
104
112
  def _find_template(templates: list[ElnTemplate] | list[ProtocolTemplateInfo], name: str, active: bool,
105
- version: int, first_match: bool) -> ElnTemplate | ProtocolTemplateInfo:
113
+ version: int, first_match: bool, public: bool | None) -> ElnTemplate | ProtocolTemplateInfo:
106
114
  """
107
115
  Find the experiment or protocol template with the given information.
108
116
  """
@@ -114,15 +122,22 @@ class ExperimentCacheManager:
114
122
  continue
115
123
  if version is not None and template.template_version != version:
116
124
  continue
125
+ if public is True and template.template_version is None:
126
+ continue
127
+ if public is False and template.template_version is not None:
128
+ continue
117
129
  matches.append(template)
118
130
  if not matches:
119
131
  raise SapioException(f"No template with the name \"{name}\"" +
120
132
  ("" if version is None else f" and the version {version}") +
121
133
  f" found.")
122
- if not version:
123
- return max(matches, key=lambda x: x.template_version)
134
+ # Only filter for the max version number if any of the matches actually have a version number.
135
+ versioned_matches = [x for x in matches if x.template_version is not None]
136
+ if version is None and versioned_matches:
137
+ return max(versioned_matches, key=lambda x: x.template_version)
124
138
  if len(matches) > 1 and not first_match:
125
- raise SapioException(f"Multiple templates with the name \"{name}\" found.")
139
+ raise SapioException(f"Multiple templates with the name \"{name}\" found. Consider setting first_match to "
140
+ f"true, or restrict your search criteria further.")
126
141
  return matches[0]
127
142
 
128
143
  def get_predefined_field(self, field_name: str, data_type: ElnBaseDataType) -> AbstractVeloxFieldDefinition:
@@ -185,6 +185,7 @@ class GlobalDtTableStepCreation(StepCreation):
185
185
  self.layout_name = None
186
186
  self.extension_types = None
187
187
  self.table_columns = None
188
+ self.field_names = None
188
189
  self.show_key_fields = None
189
190
 
190
191
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sapiopycommons
3
- Version: 2025.4.15a484
3
+ Version: 2025.4.16a485
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>
@@ -15,13 +15,13 @@ sapiopycommons/datatype/attachment_util.py,sha256=N-nhsJ0oxa_Ft6Y6VWeNFYLzfuQqsj
15
15
  sapiopycommons/datatype/data_fields.py,sha256=pczUlEcE0TeHEDU0Gkvu7voacSLPXCB7l9UbI1Tb6V0,5656
16
16
  sapiopycommons/datatype/pseudo_data_types.py,sha256=lAJDnFuStrUP0mK5AuYlFvLerwjEB-ABd6Z4qlCrwJA,40637
17
17
  sapiopycommons/eln/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- sapiopycommons/eln/experiment_cache.py,sha256=kiYZBZEAuQpv-rFviv8_6g7uvXdzH9BMUEprvAHT0Ds,8181
18
+ sapiopycommons/eln/experiment_cache.py,sha256=Zv4IcsAl95ftO2ul3DRc_Hyno0AfC3OvFV7RYb72ITo,9560
19
19
  sapiopycommons/eln/experiment_handler.py,sha256=7vYRlYAW_xT5LcZ5nLqL9dxEHGRAPEuUxX8d8TElWV8,105742
20
20
  sapiopycommons/eln/experiment_report_util.py,sha256=NNNNPVD3_2ZAjoOqCMOnlnmPD0SCjDcgYi453ATSJBs,37027
21
21
  sapiopycommons/eln/experiment_step_factory.py,sha256=qw9UfLslVzB6dEIZPOZ85XHKpld81RhD4-csM6TgQNg,26099
22
22
  sapiopycommons/eln/experiment_tags.py,sha256=7-fpOiSqrjbXmWIJhEhaxMgLsVCPAtKqH8xRzpDVKoE,356
23
23
  sapiopycommons/eln/plate_designer.py,sha256=XFazSvhTbSy47t80-jc2tyx_-fQ_IUjKd18JQKEFcsY,13939
24
- sapiopycommons/eln/step_creation.py,sha256=d_2fEpGDMyas4nx2W_WviFaMsfw95epTT7sJoDuE94g,10139
24
+ sapiopycommons/eln/step_creation.py,sha256=CFkGC-SxwAQpQlcs_obqLAVgmsNxKSGMqMtO_E6IVmw,10171
25
25
  sapiopycommons/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  sapiopycommons/files/complex_data_loader.py,sha256=T39veNhvYl6j_uZjIIJ8Mk5Aa7otR5RB-g8XlAdkksA,1421
27
27
  sapiopycommons/files/file_bridge.py,sha256=vKbqxPexi15epr_-_qLrEfYoxNxB031mXN92iVtOMqE,9511
@@ -61,7 +61,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
61
61
  sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
62
62
  sapiopycommons/webhook/webhook_handlers.py,sha256=tUVNCw05CDGu1gFDm2g558hX_O203WVm_n__ojjoRRM,39841
63
63
  sapiopycommons/webhook/webservice_handlers.py,sha256=tyaYGG1-v_JJrJHZ6cy5mGCxX9z1foLw7pM4MDJlFxs,14297
64
- sapiopycommons-2025.4.15a484.dist-info/METADATA,sha256=qeCjsb8bTmQM3qISPoKn2kHnYVGRY5Kr_4OiLOzETZ8,3143
65
- sapiopycommons-2025.4.15a484.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
66
- sapiopycommons-2025.4.15a484.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
67
- sapiopycommons-2025.4.15a484.dist-info/RECORD,,
64
+ sapiopycommons-2025.4.16a485.dist-info/METADATA,sha256=0fBY9ysTmQxnwGRANJWN96fA5VtNSqBEtE81Uabzsdg,3143
65
+ sapiopycommons-2025.4.16a485.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
66
+ sapiopycommons-2025.4.16a485.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
67
+ sapiopycommons-2025.4.16a485.dist-info/RECORD,,