lamin_cli 0.13.1__tar.gz → 0.14.0__tar.gz
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-0.13.1 → lamin_cli-0.14.0}/PKG-INFO +1 -1
- lamin_cli-0.14.0/lamin_cli/__init__.py +3 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/lamin_cli/_get.py +11 -6
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/lamin_cli/_save.py +1 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/test_get.py +11 -1
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/test_save_notebooks.py +0 -2
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/test_save_scripts.py +14 -0
- lamin_cli-0.13.1/lamin_cli/__init__.py +0 -3
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/.gitignore +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/.pre-commit-config.yaml +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/README.md +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/lamin_cli/__main__.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/lamin_cli/_cache.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/lamin_cli/_migration.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/pyproject.toml +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/conftest.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/notebooks/not-initialized.ipynb +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/notebooks/with-title-and-initialized-consecutive.ipynb +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/notebooks/with-title-and-initialized-non-consecutive.ipynb +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/scripts/merely-import-lamindb.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/scripts/run-track-and-finish-sync-git.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/scripts/run-track-and-finish.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/test_cli.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/test_migrate.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/test_multi_process.py +0 -0
- {lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/test_save_files.py +0 -0
|
@@ -5,10 +5,13 @@ import lamindb_setup as ln_setup
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def decompose_url(url: str) -> Tuple[str, str, str]:
|
|
8
|
-
assert "transform" in url
|
|
9
|
-
|
|
8
|
+
assert "transform" in url or "artifact" in url
|
|
9
|
+
for entity in ["transform", "artifact"]:
|
|
10
|
+
if entity in url:
|
|
11
|
+
break
|
|
12
|
+
uid = url.split(f"{entity}/")[1]
|
|
10
13
|
instance_slug = "/".join(url.replace("https://lamin.ai/", "").split("/")[:2])
|
|
11
|
-
return instance_slug,
|
|
14
|
+
return instance_slug, entity, uid
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
def get(url: str):
|
|
@@ -28,12 +31,14 @@ def get(url: str):
|
|
|
28
31
|
ln.settings.verbosity = "success"
|
|
29
32
|
|
|
30
33
|
if entity == "transform":
|
|
31
|
-
transform = ln.Transform.
|
|
34
|
+
transform = ln.Transform.get(uid)
|
|
32
35
|
filepath_cache = transform.source_code.cache()
|
|
33
36
|
target_filename = transform.key
|
|
34
37
|
if not target_filename.endswith(transform.source_code.suffix):
|
|
35
38
|
target_filename += transform.source_code.suffix
|
|
36
39
|
filepath_cache.rename(target_filename)
|
|
37
40
|
logger.success(f"cached source code of transform {uid} as {target_filename}")
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
elif entity == "artifact":
|
|
42
|
+
artifact = ln.Artifact.get(uid)
|
|
43
|
+
cache_path = artifact.cache()
|
|
44
|
+
logger.success(f"cached artifact {artifact} here:\n{cache_path}")
|
|
@@ -11,7 +11,7 @@ def test_decompose_url():
|
|
|
11
11
|
assert uid == "1GCKs8zLtkc85zKv"
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def
|
|
14
|
+
def test_get_transform():
|
|
15
15
|
result = subprocess.run(
|
|
16
16
|
"lamin get"
|
|
17
17
|
" 'https://lamin.ai/laminlabs/arrayloader-benchmarks/transform/1GCKs8zLtkc85zKv'", # noqa
|
|
@@ -19,3 +19,13 @@ def test_get():
|
|
|
19
19
|
capture_output=True,
|
|
20
20
|
)
|
|
21
21
|
assert result.returncode == 0
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_get_artifact():
|
|
25
|
+
result = subprocess.run(
|
|
26
|
+
"lamin get"
|
|
27
|
+
" 'https://lamin.ai/laminlabs/lamin-site-assets/artifact/e2G7k9EVul4JbfsEYAy5'", # noqa
|
|
28
|
+
shell=True,
|
|
29
|
+
capture_output=True,
|
|
30
|
+
)
|
|
31
|
+
assert result.returncode == 0
|
|
@@ -93,7 +93,6 @@ def test_save_consecutive():
|
|
|
93
93
|
env=env,
|
|
94
94
|
)
|
|
95
95
|
assert result.returncode == 0
|
|
96
|
-
assert "saved transform" in result.stdout.decode()
|
|
97
96
|
|
|
98
97
|
# now, we have the associated artifacts
|
|
99
98
|
transform = ln.Transform.filter(uid="hlsFXswrJjtt5zKv").one_or_none()
|
|
@@ -127,7 +126,6 @@ def test_save_consecutive():
|
|
|
127
126
|
env=env,
|
|
128
127
|
)
|
|
129
128
|
assert result.returncode == 0
|
|
130
|
-
assert "saved transform" in result.stdout.decode()
|
|
131
129
|
# the source code is overwritten with the edits, reflected in a new hash
|
|
132
130
|
transform = ln.Transform.get("hlsFXswrJjtt5zKv")
|
|
133
131
|
assert transform.latest_report.path.exists()
|
|
@@ -54,6 +54,20 @@ def test_run_save_cache():
|
|
|
54
54
|
assert "loaded: Transform" in result.stdout.decode()
|
|
55
55
|
assert "m5uCHTTpJnjQ5zKv" in result.stdout.decode()
|
|
56
56
|
assert "loaded: Run" in result.stdout.decode()
|
|
57
|
+
assert "source code is already saved" in result.stdout.decode()
|
|
58
|
+
|
|
59
|
+
# you can re-save the script
|
|
60
|
+
result = subprocess.run(
|
|
61
|
+
f"lamin save {filepath}",
|
|
62
|
+
shell=True,
|
|
63
|
+
capture_output=True,
|
|
64
|
+
env=env,
|
|
65
|
+
)
|
|
66
|
+
print(result.stdout.decode())
|
|
67
|
+
print(result.stderr.decode())
|
|
68
|
+
assert result.returncode == 0
|
|
69
|
+
assert "source code is already saved" in result.stdout.decode()
|
|
70
|
+
assert "run.environment is already saved" in result.stdout.decode()
|
|
57
71
|
|
|
58
72
|
# edit the script
|
|
59
73
|
content = filepath.read_text() + "\n # edited"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lamin_cli-0.13.1 → lamin_cli-0.14.0}/tests/notebooks/with-title-and-initialized-consecutive.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|