deriva-ml 1.14.44__py3-none-any.whl → 1.14.45__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.
deriva_ml/core/base.py CHANGED
@@ -120,6 +120,7 @@ class DerivaML(Dataset):
120
120
  logging_level=logging.WARNING,
121
121
  credential=None,
122
122
  use_minid: bool = True,
123
+ check_auth: bool = True,
123
124
  ):
124
125
  """Initializes a DerivaML instance.
125
126
 
@@ -139,6 +140,7 @@ class DerivaML(Dataset):
139
140
  working_dir: Directory path for storing data used by or generated by any computations. If no value is
140
141
  provided, will default to ${HOME}/deriva_ml
141
142
  use_minid: Use the MINID service when downloading dataset bags.
143
+ check_auth: Check if the user has access to the catalog.
142
144
  """
143
145
  # Get or use provided credentials for server access
144
146
  self.credential = credential or get_credential(hostname)
@@ -150,6 +152,16 @@ class DerivaML(Dataset):
150
152
  credentials=self.credential,
151
153
  session_config=self._get_session_config(),
152
154
  )
155
+
156
+ try:
157
+ if check_auth and server.get_authn_session():
158
+ pass
159
+ except Exception:
160
+ raise DerivaMLException(
161
+ "You are not authorized to access this catalog. "
162
+ "Please check your credentials and make sure you have logged in."
163
+ )
164
+
153
165
  self.catalog = server.connect_ermrest(catalog_id)
154
166
  self.model = DerivaModel(self.catalog.getCatalogModel(), domain_schema=domain_schema)
155
167
 
deriva_ml/run_notebook.py CHANGED
@@ -9,6 +9,7 @@ from pathlib import Path
9
9
  import nbformat
10
10
  import papermill as pm
11
11
  import regex as re
12
+ import yaml
12
13
  from deriva.core import BaseCLI
13
14
  from nbconvert import MarkdownExporter
14
15
 
@@ -28,7 +29,7 @@ class DerivaMLRunNotebookCLI(BaseCLI):
28
29
  "-f",
29
30
  type=Path,
30
31
  default=None,
31
- help="JSON file with parameter values to inject into the notebook.",
32
+ help="JSON or YAML file with parameter values to inject into the notebook.",
32
33
  )
33
34
 
34
35
  self.parser.add_argument(
@@ -86,11 +87,14 @@ class DerivaMLRunNotebookCLI(BaseCLI):
86
87
  parameters = {key: self._coerce_number(val) for key, val in args.parameter}
87
88
 
88
89
  if parameter_file:
89
- if not (parameter_file.is_file() and parameter_file.suffix == ".json"):
90
- print("Parameter file must be an json file.")
91
- exit(1)
92
- with Path(parameter_file).open("r") as f:
93
- parameters |= json.load(f)
90
+ with parameter_file.open("r") as f:
91
+ if parameter_file.suffix == ".json":
92
+ parameters |= json.load(f)
93
+ elif parameter_file.suffix == ".yaml":
94
+ parameters |= yaml.safe_load(f)
95
+ else:
96
+ print("Parameter file must be an json or YAML file.")
97
+ exit(1)
94
98
 
95
99
  if not (notebook_file.is_file() and notebook_file.suffix == ".ipynb"):
96
100
  print(f"Notebook file must be an ipynb file: {notebook_file.name}.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deriva-ml
3
- Version: 1.14.44
3
+ Version: 1.14.45
4
4
  Summary: Utilities to simplify use of Dervia and Pandas to create reproducable ML pipelines
5
5
  Author-email: ISRD <isrd-dev@isi.edu>
6
6
  Requires-Python: >=3.10
@@ -20,6 +20,7 @@ Requires-Dist: setuptools-scm>=8.0
20
20
  Requires-Dist: nbstripout
21
21
  Requires-Dist: papermill
22
22
  Requires-Dist: pandas-stubs==2.2.3.250527
23
+ Requires-Dist: pyyaml
23
24
  Dynamic: license-file
24
25
 
25
26
  # DerivaML
@@ -3,9 +3,9 @@ deriva_ml/bump_version.py,sha256=KpHmkpEztly2QHYL4dyaIGdEMyP4F0D89rawyh5EDTs,398
3
3
  deriva_ml/demo_catalog.py,sha256=JjPAIac_hKPh5krEhGJydjXquRnivi7kQoR8W4Khp-s,14928
4
4
  deriva_ml/feature.py,sha256=6-aphkxdKjWa9oPSGFWxHcwAc_8hmWj-7I4M178YG5Y,8470
5
5
  deriva_ml/install_kernel.py,sha256=b62XY0SLViYO_Zye5r1Pl9qhYZyu_fk4KAO8NS1pxgM,2165
6
- deriva_ml/run_notebook.py,sha256=U3Bz-PdYYMIo_KZwDwlyKJtnZEMKwJjLh5Jn-M8ChUI,8039
6
+ deriva_ml/run_notebook.py,sha256=QRO_CK9Q9qt_n-c0rxGdIRyTHjGOuZxt-wj0WQTnaAM,8171
7
7
  deriva_ml/core/__init__.py,sha256=V_i90pc5PB1F4UdOO6DZWzpEFaZDTaPRU-EzKXQ19eI,787
8
- deriva_ml/core/base.py,sha256=5H0GEMlKXUVRXBYXJQ25kxdscB6uX1wIKSUAM_CBOhI,61228
8
+ deriva_ml/core/base.py,sha256=LI_ZLpVJwWx4DW2Wo7luALQauQ3xhBxFYHSKDAfNsag,61649
9
9
  deriva_ml/core/constants.py,sha256=6wBJ8qMxe-dbCjRGrjUIX-RK0mTWrLDTeUpaVbLFoM8,888
10
10
  deriva_ml/core/definitions.py,sha256=uq_8uYFBVBVHS691Ri2kdQsN37z0GNYTaZskJIb_ocM,1385
11
11
  deriva_ml/core/enums.py,sha256=sSN4B4OynbB-AXwxRszoFr-KWIWIAfhVa06EzAEHwVc,7194
@@ -34,9 +34,9 @@ deriva_ml/schema/create_schema.py,sha256=9qK9_8SRQT-DwcEwTGSkhi3j2NaoH5EVgthvV2k
34
34
  deriva_ml/schema/deriva-ml-reference.json,sha256=AEOMIgwKO3dNMMWHb0lxaXyamvfAEbUPh8qw0aAtsUQ,242460
35
35
  deriva_ml/schema/policy.json,sha256=5ykB8nnZFl-oCHzlAwppCFKJHWJFIkYognUMVEanfY8,1826
36
36
  deriva_ml/schema/table_comments_utils.py,sha256=4flCqnZAaqg_uSZ9I18pNUWAZoLfmMCXbmI5uERY5vM,2007
37
- deriva_ml-1.14.44.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
38
- deriva_ml-1.14.44.dist-info/METADATA,sha256=Kq-OKAhKOm-JW2HbMoNsZIRWy8oT6v7-CYz4whIqCbo,1168
39
- deriva_ml-1.14.44.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- deriva_ml-1.14.44.dist-info/entry_points.txt,sha256=XsHSbfp7S1cKMjHoPUdFIaFcp9lHXHS6CV1zb_MEXkg,463
41
- deriva_ml-1.14.44.dist-info/top_level.txt,sha256=I1Q1dkH96cRghdsFRVqwpa2M7IqJpR2QPUNNc5-Bnpw,10
42
- deriva_ml-1.14.44.dist-info/RECORD,,
37
+ deriva_ml-1.14.45.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
38
+ deriva_ml-1.14.45.dist-info/METADATA,sha256=aenEvP2FswK7WS99aGlPhRKmDi7UZ1ejSBhyqpbfDQg,1190
39
+ deriva_ml-1.14.45.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ deriva_ml-1.14.45.dist-info/entry_points.txt,sha256=XsHSbfp7S1cKMjHoPUdFIaFcp9lHXHS6CV1zb_MEXkg,463
41
+ deriva_ml-1.14.45.dist-info/top_level.txt,sha256=I1Q1dkH96cRghdsFRVqwpa2M7IqJpR2QPUNNc5-Bnpw,10
42
+ deriva_ml-1.14.45.dist-info/RECORD,,