deriva-ml 1.14.27__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.
@@ -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,19 +298,43 @@ 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
+ ]
307
333
  # Get the caller's filename, which is two up the stack from here.
308
-
309
- filename = Path(stack[-1].filename)
310
- if not filename.exists():
334
+ filename = Path(stack[-1])
335
+ if not filename.exists() or Workflow._in_repl():
311
336
  # Being called from the command line interpreter.
312
- filename = Path("REPL")
337
+ filename = Path.cwd() / Path("REPL")
313
338
  # Get the caller's filename, which is two up the stack from here.
314
339
  else:
315
340
  raise DerivaMLException("Looking for caller failed") # Stack is too shallow
@@ -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.27
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
@@ -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=k_VC0w9kQcg6qbP62DzZTEkuCIYQ6mdiyQ_rdZug7PY,13158
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.27.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
36
- deriva_ml-1.14.27.dist-info/METADATA,sha256=_eaEMFf5odtaX7cqWgJS37zg_ZhKk8msSmLFJo_QCJ8,1034
37
- deriva_ml-1.14.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- deriva_ml-1.14.27.dist-info/entry_points.txt,sha256=dkf_z7E4V6_3_5Xjsm0hcixNg6ASHDw6NfYQuBvF1Wc,363
39
- deriva_ml-1.14.27.dist-info/top_level.txt,sha256=I1Q1dkH96cRghdsFRVqwpa2M7IqJpR2QPUNNc5-Bnpw,10
40
- deriva_ml-1.14.27.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,,