deriva-ml 1.14.26__py3-none-any.whl → 1.14.28__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.
@@ -211,6 +211,7 @@ class Dataset:
211
211
  dataset_path.update([{"RID": dataset, "Version": version["RID"]} for dataset, version in versions.items()])
212
212
 
213
213
  def _set_version_snapshot(self):
214
+ """Update the Snapshot column of the Dataset_Version table to the correct time."""
214
215
  dataset_version_path = self._model.catalog.getPathBuilder().schemas[self._ml_schema].tables["Dataset_Version"]
215
216
  versions = dataset_version_path.entities().fetch()
216
217
  dataset_version_path.update(
@@ -1023,7 +1024,7 @@ class Dataset:
1023
1024
  self._logger.info(
1024
1025
  "Downloading dataset %s for catalog: %s@%s"
1025
1026
  % (
1026
- 'minid' if self._use_minid else 'bag',
1027
+ "minid" if self._use_minid else "bag",
1027
1028
  dataset.rid,
1028
1029
  str(dataset.version),
1029
1030
  )
@@ -2,6 +2,7 @@ import inspect
2
2
  import logging
3
3
  import os
4
4
  import subprocess
5
+ import sys
5
6
  from pathlib import Path
6
7
  from typing import Any
7
8
 
@@ -297,22 +298,46 @@ class Workflow(BaseModel):
297
298
  pass
298
299
  return None, None
299
300
 
301
+ @staticmethod
302
+ def _in_repl():
303
+ # Standard Python interactive mode
304
+ if hasattr(sys, "ps1"):
305
+ return True
306
+
307
+ # Interactive mode forced by -i
308
+ if sys.flags.interactive:
309
+ return True
310
+
311
+ # IPython / Jupyter detection
312
+ try:
313
+ from IPython import get_ipython
314
+
315
+ if get_ipython() is not None:
316
+ return True
317
+ except ImportError:
318
+ pass
319
+
320
+ return False
321
+
300
322
  @staticmethod
301
323
  def _get_python_script() -> tuple[Path, bool]:
302
324
  """Return the path to the currently executing script"""
303
325
  is_notebook = True
304
326
  if not (filename := Workflow._get_notebook_path()):
305
327
  is_notebook = False
306
- stack = inspect.stack()
328
+ stack = [
329
+ s.filename
330
+ for s in inspect.stack()
331
+ if ("pycharm" not in s.filename) and ("site-packages" not in s.filename)
332
+ ]
333
+ # Get the caller's filename, which is two up the stack from here.
334
+ filename = Path(stack[-1])
335
+ if not filename.exists() or Workflow._in_repl():
336
+ # Being called from the command line interpreter.
337
+ filename = Path.cwd() / Path("REPL")
307
338
  # Get the caller's filename, which is two up the stack from here.
308
- if len(stack) > 1:
309
- filename = Path(stack[2].filename)
310
- if not filename.exists():
311
- # Being called from the command line interpreter.
312
- filename = Path("REPL")
313
- # Get the caller's filename, which is two up the stack from here.
314
- else:
315
- raise DerivaMLException("Looking for caller failed") # Stack is too shallow
339
+ else:
340
+ raise DerivaMLException("Looking for caller failed") # Stack is too shallow
316
341
  return filename, is_notebook
317
342
 
318
343
  @staticmethod
@@ -352,19 +377,20 @@ class Workflow(BaseModel):
352
377
  cwd=executable_path.parent,
353
378
  capture_output=True,
354
379
  text=True,
355
- check=True,
380
+ check=False,
356
381
  )
357
382
  is_dirty = bool("M " in result.stdout.strip()) # Returns True if the output indicates a modified file
358
383
  except subprocess.CalledProcessError:
359
384
  is_dirty = False # If the Git command fails, assume no changes
360
385
 
361
386
  """Get SHA-1 hash of latest commit of the file in the repository"""
387
+
362
388
  result = subprocess.run(
363
389
  ["git", "log", "-n", "1", "--pretty=format:%H--", executable_path],
364
- cwd=executable_path.parent,
390
+ cwd=repo_root,
365
391
  capture_output=True,
366
392
  text=True,
367
- check=True,
393
+ check=False,
368
394
  )
369
395
  sha = result.stdout.strip()
370
396
  url = f"{github_url}/blob/{sha}/{executable_path.relative_to(repo_root)}"
@@ -126,8 +126,8 @@ class DatabaseModel(DerivaModel, metaclass=DatabaseModelMeta):
126
126
  dataset_versions = [
127
127
  t for t in self.dbase.execute(f'SELECT "Dataset", "Version" FROM "{sql_dataset}"').fetchall()
128
128
  ]
129
- dataset_versions = [(v[0], DatasetVersion.parse(v[1])) for v in dataset_versions]
130
129
 
130
+ dataset_versions = [(v[0], DatasetVersion.parse(v[1])) for v in dataset_versions]
131
131
  # Get most current version of each rid
132
132
  self.bag_rids = {}
133
133
  for rid, version in dataset_versions:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deriva-ml
3
- Version: 1.14.26
3
+ Version: 1.14.28
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
@@ -12,7 +12,7 @@ deriva_ml/core/exceptions.py,sha256=4MZNPOyN-UMaGeY9sqJDVwh_iOmz1ntp4usSyCNqVMg,
12
12
  deriva_ml/core/filespec.py,sha256=BQAAcRXfXq1lDcsKlokLOOXCBtEZpPgXxrFOIZYAgLg,4229
13
13
  deriva_ml/dataset/__init__.py,sha256=ukl2laJqa9J2AVqb4zlpIYc-3RaAlfRR33NMIQaoNrQ,104
14
14
  deriva_ml/dataset/aux_classes.py,sha256=9mZAln7_rrzaRbKhKA6dJOp3xeD6dHOC9NXOtJKROo4,6933
15
- deriva_ml/dataset/dataset.py,sha256=FnQG98eEr7mnUmo1ySgVRxRoyhbP5u_ZxuexdAcYxJY,64305
15
+ deriva_ml/dataset/dataset.py,sha256=drL0YZovPpQC9G_eYe-fWuFQFysK2X-ad0vL4ZsYkf0,64396
16
16
  deriva_ml/dataset/dataset_bag.py,sha256=mPIZRX5aTbVRcJbCFtdkmlnexquF8NE-onbVK_8IxVk,14224
17
17
  deriva_ml/dataset/history.py,sha256=FK5AYYz11p4E4FWMVg4r7UPWOD4eobrq3b3xMjWF59g,3197
18
18
  deriva_ml/dataset/upload.py,sha256=Ad5JDfGvkIvefE-plP8SN9pNAxHzYrBoid5isz_bnNs,16411
@@ -20,10 +20,10 @@ deriva_ml/execution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
20
20
  deriva_ml/execution/environment.py,sha256=B7nywqxFTRUWgyu8n7rFoKcVC9on422kjeFG2FPQfvg,9302
21
21
  deriva_ml/execution/execution.py,sha256=tXWkFLDoSre836x6MMkcmhtmr3zP5_VoSioQ72-XmvE,44298
22
22
  deriva_ml/execution/execution_configuration.py,sha256=Rw4VWkBCZN9yatvSKdTqEWTfu470lpcVKfHFR0uN0jI,6248
23
- deriva_ml/execution/workflow.py,sha256=fd8dwCyDSpW_BOD_d0-zFs9yTNrbddwqD-xG3rKdvyU,13215
23
+ deriva_ml/execution/workflow.py,sha256=E3npefABfJthlphH6QXHBjHGgDdRcoXzd7YowQOeUHg,13813
24
24
  deriva_ml/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  deriva_ml/model/catalog.py,sha256=dzTBcRlqgEVkPY32AUax_iu75RgFiT4Pu5au7rmrv8k,14068
26
- deriva_ml/model/database.py,sha256=cTe9rJHMCDo89_dmAT5aJGhzzLiK2DkXvCvZE6fczcM,14805
26
+ deriva_ml/model/database.py,sha256=MlXQQFgFmGxZbRx-unRFoRttXwpJspV4v2AIgppttCU,14805
27
27
  deriva_ml/model/sql_mapper.py,sha256=_0QsJEVSgSPtxrWKSgjfPZCQ1aMVcjR_Tk2OxLhWEvY,1696
28
28
  deriva_ml/schema/__init__.py,sha256=yV-MfzCF3FA4OOz7mZwMM2q6-x1vgOJ057kUvikFF6E,130
29
29
  deriva_ml/schema/annotations.py,sha256=TuQ3vWFnK0160fRmtvsCkHx9qAcRa63MSyERB4x5a98,18197
@@ -32,9 +32,9 @@ deriva_ml/schema/create_schema.py,sha256=0ydJSZEg3C3-m8hWPN6k2MoUvm-RWxAlKFzVChx
32
32
  deriva_ml/schema/deriva-ml-reference.json,sha256=AEOMIgwKO3dNMMWHb0lxaXyamvfAEbUPh8qw0aAtsUQ,242460
33
33
  deriva_ml/schema/policy.json,sha256=5ykB8nnZFl-oCHzlAwppCFKJHWJFIkYognUMVEanfY8,1826
34
34
  deriva_ml/schema/table_comments_utils.py,sha256=4flCqnZAaqg_uSZ9I18pNUWAZoLfmMCXbmI5uERY5vM,2007
35
- deriva_ml-1.14.26.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
36
- deriva_ml-1.14.26.dist-info/METADATA,sha256=nhgVSz2mmn24u8xsLlAQRu6wYa37-z4DJZNy3Fi8odM,1034
37
- deriva_ml-1.14.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- deriva_ml-1.14.26.dist-info/entry_points.txt,sha256=dkf_z7E4V6_3_5Xjsm0hcixNg6ASHDw6NfYQuBvF1Wc,363
39
- deriva_ml-1.14.26.dist-info/top_level.txt,sha256=I1Q1dkH96cRghdsFRVqwpa2M7IqJpR2QPUNNc5-Bnpw,10
40
- deriva_ml-1.14.26.dist-info/RECORD,,
35
+ deriva_ml-1.14.28.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
36
+ deriva_ml-1.14.28.dist-info/METADATA,sha256=4OlbcNCpEy3cjuU_nekQ14A_feGdqhQinktMv3IwIMw,1034
37
+ deriva_ml-1.14.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ deriva_ml-1.14.28.dist-info/entry_points.txt,sha256=dkf_z7E4V6_3_5Xjsm0hcixNg6ASHDw6NfYQuBvF1Wc,363
39
+ deriva_ml-1.14.28.dist-info/top_level.txt,sha256=I1Q1dkH96cRghdsFRVqwpa2M7IqJpR2QPUNNc5-Bnpw,10
40
+ deriva_ml-1.14.28.dist-info/RECORD,,