lamin_cli 1.5.2__tar.gz → 1.5.4__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-1.5.2 → lamin_cli-1.5.4}/PKG-INFO +1 -1
- lamin_cli-1.5.4/lamin_cli/__init__.py +3 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/__main__.py +2 -1
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/_save.py +17 -1
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_save_scripts.py +21 -0
- lamin_cli-1.5.4/tests/scripts/testscript.py +2 -0
- lamin_cli-1.5.2/lamin_cli/__init__.py +0 -3
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/.github/workflows/build.yml +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/.github/workflows/doc-changes.yml +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/.gitignore +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/.pre-commit-config.yaml +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/LICENSE +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/README.md +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/_cache.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/_load.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/_migration.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/_settings.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/compute/__init__.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/lamin_cli/compute/modal.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/noxfile.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/pyproject.toml +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/conftest.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_create_switch_delete_list.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_load.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_login.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_migrate.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_multi_process.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_parse_uid_from_code.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_save_files.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_save_notebooks.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/core/test_save_r_code.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/modal/test_modal.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/notebooks/not-initialized.ipynb +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/notebooks/with-title-and-initialized-consecutive.ipynb +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/notebooks/with-title-and-initialized-non-consecutive.ipynb +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/scripts/merely-import-lamindb.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/scripts/run-track-and-finish-sync-git.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/scripts/run-track-and-finish.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/scripts/run-track-with-params.py +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/scripts/run-track.R +0 -0
- {lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/scripts/run-track.qmd +0 -0
|
@@ -302,10 +302,11 @@ def delete(entity: str, name: str | None = None, slug: str | None = None, force:
|
|
|
302
302
|
lamin delete branch --name my_branch
|
|
303
303
|
```
|
|
304
304
|
"""
|
|
305
|
-
from lamindb import Branch
|
|
306
305
|
from lamindb_setup._delete import delete
|
|
307
306
|
|
|
308
307
|
if entity == "branch":
|
|
308
|
+
from lamindb import Branch
|
|
309
|
+
|
|
309
310
|
Branch.get(name=name).delete()
|
|
310
311
|
elif entity == "instance":
|
|
311
312
|
return delete(slug, force=force)
|
|
@@ -6,6 +6,7 @@ from typing import TYPE_CHECKING
|
|
|
6
6
|
|
|
7
7
|
import click
|
|
8
8
|
from lamin_utils import logger
|
|
9
|
+
from lamindb_setup.core.hashing import hash_file
|
|
9
10
|
|
|
10
11
|
if TYPE_CHECKING:
|
|
11
12
|
from pathlib import Path
|
|
@@ -155,6 +156,10 @@ def save_from_path_cli(
|
|
|
155
156
|
return None
|
|
156
157
|
|
|
157
158
|
if registry == "transform":
|
|
159
|
+
if key is not None:
|
|
160
|
+
logger.warning(
|
|
161
|
+
"key is ignored for transforms, the transform key is determined by the filename"
|
|
162
|
+
)
|
|
158
163
|
if is_cloud_path:
|
|
159
164
|
logger.error("Can not register a transform from a cloud path")
|
|
160
165
|
return "transform-with-cloud-path"
|
|
@@ -201,8 +206,19 @@ def save_from_path_cli(
|
|
|
201
206
|
if transform is None:
|
|
202
207
|
uid = f"{stem_uid}0000"
|
|
203
208
|
else:
|
|
204
|
-
# TODO: account for folders
|
|
209
|
+
# TODO: account for folders as we do in ln.track()
|
|
210
|
+
transform_hash, _ = hash_file(path)
|
|
205
211
|
transform = ln.Transform.filter(key=path.name, is_latest=True).one_or_none()
|
|
212
|
+
if transform is not None and transform.hash is not None:
|
|
213
|
+
if transform.hash == transform_hash:
|
|
214
|
+
logger.important(
|
|
215
|
+
f"found existing Transform('{uid}') with matching hash"
|
|
216
|
+
)
|
|
217
|
+
return None
|
|
218
|
+
else:
|
|
219
|
+
# we need to create a new version
|
|
220
|
+
stem_uid = transform.uid[:12]
|
|
221
|
+
transform = None
|
|
206
222
|
revises = None
|
|
207
223
|
if stem_uid is not None:
|
|
208
224
|
revises = (
|
|
@@ -8,6 +8,27 @@ from lamindb_setup import settings
|
|
|
8
8
|
scripts_dir = Path(__file__).parent.parent.resolve() / "scripts"
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
def test_save_resave_script_no_uids():
|
|
12
|
+
filepath = scripts_dir / "testscript.py"
|
|
13
|
+
filepath.write_text("print('hello')")
|
|
14
|
+
result = subprocess.run(
|
|
15
|
+
f"lamin save {filepath}",
|
|
16
|
+
shell=True,
|
|
17
|
+
capture_output=True,
|
|
18
|
+
)
|
|
19
|
+
assert result.returncode == 0
|
|
20
|
+
assert "created Transform" in result.stdout.decode()
|
|
21
|
+
filepath.write_text("print('hello')\nprint('world')\n")
|
|
22
|
+
result = subprocess.run(
|
|
23
|
+
f"lamin save {filepath}",
|
|
24
|
+
shell=True,
|
|
25
|
+
capture_output=True,
|
|
26
|
+
)
|
|
27
|
+
assert result.returncode == 0
|
|
28
|
+
assert "created Transform" in result.stdout.decode()
|
|
29
|
+
assert ln.Transform.filter(key=filepath.name).count() == 2
|
|
30
|
+
|
|
31
|
+
|
|
11
32
|
def test_save_without_uid():
|
|
12
33
|
env = os.environ
|
|
13
34
|
env["LAMIN_TESTING"] = "true"
|
|
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
|
|
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
|
|
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-1.5.2 → lamin_cli-1.5.4}/tests/notebooks/with-title-and-initialized-consecutive.ipynb
RENAMED
|
File without changes
|
{lamin_cli-1.5.2 → lamin_cli-1.5.4}/tests/notebooks/with-title-and-initialized-non-consecutive.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|