lamin_cli 0.19.0__py2.py3-none-any.whl → 0.20.0__py2.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.
- lamin_cli/__init__.py +1 -1
- lamin_cli/__main__.py +8 -2
- lamin_cli/_load.py +39 -14
- {lamin_cli-0.19.0.dist-info → lamin_cli-0.20.0.dist-info}/METADATA +1 -1
- lamin_cli-0.20.0.dist-info/RECORD +12 -0
- lamin_cli-0.19.0.dist-info/RECORD +0 -12
- {lamin_cli-0.19.0.dist-info → lamin_cli-0.20.0.dist-info}/LICENSE +0 -0
- {lamin_cli-0.19.0.dist-info → lamin_cli-0.20.0.dist-info}/WHEEL +0 -0
- {lamin_cli-0.19.0.dist-info → lamin_cli-0.20.0.dist-info}/entry_points.txt +0 -0
lamin_cli/__init__.py
CHANGED
lamin_cli/__main__.py
CHANGED
|
@@ -98,13 +98,13 @@ def main():
|
|
|
98
98
|
|
|
99
99
|
@main.command()
|
|
100
100
|
@click.argument("user", type=str, default=None, required=False)
|
|
101
|
-
@click.option("--key", type=str, default=None, help="The API key.")
|
|
101
|
+
@click.option("--key", type=str, default=None, help="The legacy API key.")
|
|
102
102
|
def login(user: str, key: Optional[str]):
|
|
103
103
|
"""Log into LaminHub.
|
|
104
104
|
|
|
105
105
|
`lamin login` prompts for your API key unless you set it via environment variable `LAMIN_API_KEY`.
|
|
106
106
|
|
|
107
|
-
You
|
|
107
|
+
You can create your API key in your account settings on LaminHub (top right corner).
|
|
108
108
|
|
|
109
109
|
After authenticating once, you can re-authenticate and switch between accounts via `lamin login myhandle`.
|
|
110
110
|
"""
|
|
@@ -118,6 +118,12 @@ def login(user: str, key: Optional[str]):
|
|
|
118
118
|
else:
|
|
119
119
|
api_key = None
|
|
120
120
|
|
|
121
|
+
if key is not None:
|
|
122
|
+
click.echo(
|
|
123
|
+
"--key is deprecated and will be removed in the future, "
|
|
124
|
+
"use `lamin login` and enter your API key."
|
|
125
|
+
)
|
|
126
|
+
|
|
121
127
|
return login_(user, key=key, api_key=api_key)
|
|
122
128
|
|
|
123
129
|
|
lamin_cli/_load.py
CHANGED
|
@@ -46,16 +46,32 @@ def load(entity: str, uid: str = None, key: str = None, with_env: bool = False):
|
|
|
46
46
|
notebook = jupytext.reads(py_content, fmt="py:percent")
|
|
47
47
|
jupytext.write(notebook, notebook_path)
|
|
48
48
|
|
|
49
|
+
query_by_uid = uid is not None
|
|
50
|
+
|
|
49
51
|
if entity == "transform":
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
if query_by_uid:
|
|
53
|
+
# we don't use .get here because DoesNotExist is hard to catch
|
|
54
|
+
# due to private django API
|
|
55
|
+
# here full uid is not expected anymore as before
|
|
56
|
+
# via ln.Transform.objects.get(uid=uid)
|
|
57
|
+
transforms = ln.Transform.objects.filter(uid__startswith=uid)
|
|
58
|
+
else:
|
|
53
59
|
# if below, we take is_latest=True as the criterion, we might get draft notebooks
|
|
54
60
|
# hence, we use source_code__isnull=False and order by created_at instead
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
transforms = ln.Transform.objects.filter(key=key, source_code__isnull=False)
|
|
62
|
+
|
|
63
|
+
if (n_transforms := len(transforms)) == 0:
|
|
64
|
+
err_msg = (
|
|
65
|
+
f"uid strating with {uid}"
|
|
66
|
+
if query_by_uid
|
|
67
|
+
else f"key={key} and source_code"
|
|
68
|
+
)
|
|
69
|
+
raise SystemExit(f"Transform with {err_msg} does not exist.")
|
|
70
|
+
|
|
71
|
+
if n_transforms > 1:
|
|
72
|
+
transforms = transforms.order_by("-created_at")
|
|
73
|
+
transform = transforms.first()
|
|
74
|
+
|
|
59
75
|
target_filename = transform.key
|
|
60
76
|
if Path(target_filename).exists():
|
|
61
77
|
response = input(f"! {target_filename} exists: replace? (y/n)")
|
|
@@ -99,13 +115,22 @@ def load(entity: str, uid: str = None, key: str = None, with_env: bool = False):
|
|
|
99
115
|
import lamindb as ln
|
|
100
116
|
|
|
101
117
|
ln.settings.track_run_inputs = False
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.
|
|
107
|
-
|
|
108
|
-
|
|
118
|
+
|
|
119
|
+
if query_by_uid:
|
|
120
|
+
# we don't use .get here because DoesNotExist is hard to catch
|
|
121
|
+
# due to private django API
|
|
122
|
+
artifacts = ln.Artifact.filter(uid__startswith=uid)
|
|
123
|
+
else:
|
|
124
|
+
artifacts = ln.Artifact.filter(key=key)
|
|
125
|
+
|
|
126
|
+
if (n_artifacts := len(artifacts)) == 0:
|
|
127
|
+
err_msg = f"uid strating with {uid}" if query_by_uid else f"key={key}"
|
|
128
|
+
raise SystemExit(f"Artifact with {err_msg} does not exist.")
|
|
129
|
+
|
|
130
|
+
if n_artifacts > 1:
|
|
131
|
+
artifacts = artifacts.order_by("-created_at")
|
|
132
|
+
artifact = artifacts.first()
|
|
133
|
+
|
|
109
134
|
cache_path = artifact.cache()
|
|
110
135
|
logger.important(f"artifact is here: {cache_path}")
|
|
111
136
|
return cache_path
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
lamin_cli/__init__.py,sha256=LLbtdktouioVHbc3LHIcHFkIqK6tGoeT0wiW37J2Rjk,41
|
|
2
|
+
lamin_cli/__main__.py,sha256=-QAfgrYKcPjl0qkiWr8Tfm5wRaaZ99rW2atjIBnBn9Y,9900
|
|
3
|
+
lamin_cli/_cache.py,sha256=kW8rqlMwQeOngm9uq2gjzPVl3EBrwh6W2F2AvyBFABY,799
|
|
4
|
+
lamin_cli/_load.py,sha256=n0_qHTCXsZQIUy87rVdPvT89fx60N-KZgn_dL8nsvEA,5523
|
|
5
|
+
lamin_cli/_migration.py,sha256=xTbad6aDUwuK0QvWCmDW3f8-xaqwisS-Cqf-LbD1WRI,1071
|
|
6
|
+
lamin_cli/_save.py,sha256=KpGB1ZeKyE0Of0PkCX8j2UPtj4FQPS5wwKIYUFkTeio,4962
|
|
7
|
+
lamin_cli/_settings.py,sha256=iS37mcQUHKRWxi2sHnAojEI6sWk3w232qwG-GeY2_Qc,1141
|
|
8
|
+
lamin_cli-0.20.0.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
|
|
9
|
+
lamin_cli-0.20.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
10
|
+
lamin_cli-0.20.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
|
11
|
+
lamin_cli-0.20.0.dist-info/METADATA,sha256=BmVqxVC-ZK09XH83pqa_Mr7MBnu56gqxGzh1SEnWKw8,375
|
|
12
|
+
lamin_cli-0.20.0.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
lamin_cli/__init__.py,sha256=lIL1Y076MI8xywLMtnXwDm2sbJ543xy8YeHZu83ZJWU,41
|
|
2
|
-
lamin_cli/__main__.py,sha256=-auo60kaPHZB-BuQbzGJNDl9ne3OZ4T_GhFweOAr-74,9706
|
|
3
|
-
lamin_cli/_cache.py,sha256=kW8rqlMwQeOngm9uq2gjzPVl3EBrwh6W2F2AvyBFABY,799
|
|
4
|
-
lamin_cli/_load.py,sha256=2TkNQviRrvsp5wFweMqD5je0t1-BQYiWrBN7ygyxmuQ,4508
|
|
5
|
-
lamin_cli/_migration.py,sha256=xTbad6aDUwuK0QvWCmDW3f8-xaqwisS-Cqf-LbD1WRI,1071
|
|
6
|
-
lamin_cli/_save.py,sha256=KpGB1ZeKyE0Of0PkCX8j2UPtj4FQPS5wwKIYUFkTeio,4962
|
|
7
|
-
lamin_cli/_settings.py,sha256=iS37mcQUHKRWxi2sHnAojEI6sWk3w232qwG-GeY2_Qc,1141
|
|
8
|
-
lamin_cli-0.19.0.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
|
|
9
|
-
lamin_cli-0.19.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
10
|
-
lamin_cli-0.19.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
|
11
|
-
lamin_cli-0.19.0.dist-info/METADATA,sha256=BlyOjcxJ2_nbB-0hjMkeIPFEkRKTZUy08JP1LE5-QBE,375
|
|
12
|
-
lamin_cli-0.19.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|