lamin_cli 1.8.0__tar.gz → 1.8.1__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.8.0 → lamin_cli-1.8.1}/PKG-INFO +1 -1
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/__init__.py +1 -1
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/__main__.py +13 -5
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/_save.py +10 -6
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_save_annotate_files.py +2 -1
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_save_notebooks.py +4 -8
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/.github/workflows/build.yml +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/.github/workflows/doc-changes.yml +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/.gitignore +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/.pre-commit-config.yaml +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/LICENSE +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/README.md +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/_annotate.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/_cache.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/_delete.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/_load.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/_migration.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/_settings.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/compute/__init__.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/compute/modal.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/lamin_cli/urls.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/noxfile.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/pyproject.toml +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/conftest.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_create_switch_delete_list_settings.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_load.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_login.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_migrate.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_multi_process.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_parse_uid_from_code.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_save_annotate_scripts.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/core/test_save_r_code.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/modal/test_modal.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/notebooks/not-initialized.ipynb +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/notebooks/with-title-and-initialized-consecutive.ipynb +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/notebooks/with-title-and-initialized-non-consecutive.ipynb +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/scripts/merely-import-lamindb.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/scripts/run-track-and-finish-sync-git.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/scripts/run-track-and-finish.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/scripts/run-track-with-params.py +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/scripts/run-track.R +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/scripts/run-track.qmd +0 -0
- {lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/scripts/testscript.py +0 -0
|
@@ -5,7 +5,7 @@ This is the command line interface for interacting with LaminDB & LaminHub.
|
|
|
5
5
|
The interface is defined in `__main__.py`. The root API here is used by LaminR to replicate the CLI functionality.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = "1.8.
|
|
8
|
+
__version__ = "1.8.1"
|
|
9
9
|
|
|
10
10
|
from lamindb_setup import disconnect, logout
|
|
11
11
|
from lamindb_setup._connect_instance import _connect_cli as connect
|
|
@@ -424,13 +424,15 @@ def save(path: str, key: str, description: str, stem_uid: str, project: str, spa
|
|
|
424
424
|
|
|
425
425
|
|
|
426
426
|
@main.command()
|
|
427
|
+
@click.argument("entity", type=str, default=None, required=False)
|
|
427
428
|
@click.option("--key", type=str, default=None, help="The key of an artifact or transform.")
|
|
428
429
|
@click.option("--uid", type=str, default=None, help="The uid of an artifact or transform.")
|
|
429
430
|
@click.option("--project", type=str, default=None, help="A valid project name or uid.")
|
|
430
431
|
@click.option("--features", multiple=True, help="Feature annotations. Supports: feature=value, feature=val1,val2, or feature=\"val1\",\"val2\"")
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
432
|
+
def annotate(entity: str | None, key: str, uid: str, project: str, features: tuple):
|
|
433
|
+
"""Annotate an artifact or transform.
|
|
434
|
+
|
|
435
|
+
Entity is either 'artifact' or 'transform'. If not passed, chooses based on key suffix.
|
|
434
436
|
|
|
435
437
|
You can annotate with projects and valid features & values. For example,
|
|
436
438
|
|
|
@@ -445,11 +447,17 @@ def annotate(key: str, uid: str, project: str, registry: str, features: tuple):
|
|
|
445
447
|
from lamin_cli._annotate import _parse_features_list
|
|
446
448
|
from lamin_cli._save import infer_registry_from_path
|
|
447
449
|
|
|
448
|
-
|
|
450
|
+
# once we enable passing the URL as entity, then we don't need to throw this error
|
|
451
|
+
if not ln.setup.settings._instance_exists:
|
|
452
|
+
raise click.ClickException("Not connected to an instance. Please run: lamin connect account/name")
|
|
453
|
+
|
|
454
|
+
if entity is None:
|
|
449
455
|
if key is not None:
|
|
450
456
|
registry = infer_registry_from_path(key)
|
|
451
457
|
else:
|
|
452
458
|
registry = "artifact"
|
|
459
|
+
else:
|
|
460
|
+
registry = entity
|
|
453
461
|
if registry == "artifact":
|
|
454
462
|
model = ln.Artifact
|
|
455
463
|
else:
|
|
@@ -459,7 +467,7 @@ def annotate(key: str, uid: str, project: str, registry: str, features: tuple):
|
|
|
459
467
|
if key is not None:
|
|
460
468
|
artifact = model.get(key=key)
|
|
461
469
|
elif uid is not None:
|
|
462
|
-
artifact = model.get(uid=uid
|
|
470
|
+
artifact = model.get(uid) # do not use uid=uid, because then no truncated uids would work
|
|
463
471
|
else:
|
|
464
472
|
raise ln.errors.InvalidArgument("Either --key or --uid must be provided")
|
|
465
473
|
|
|
@@ -104,12 +104,14 @@ def save(
|
|
|
104
104
|
raise ln.errors.InvalidArgument(
|
|
105
105
|
f"Project '{project}' not found, either create it with `ln.Project(name='...').save()` or fix typos."
|
|
106
106
|
)
|
|
107
|
+
space_record = None
|
|
107
108
|
if space is not None:
|
|
108
109
|
space_record = ln.Space.filter(ln.Q(name=space) | ln.Q(uid=space)).one_or_none()
|
|
109
110
|
if space_record is None:
|
|
110
111
|
raise ln.errors.InvalidArgument(
|
|
111
112
|
f"Space '{space}' not found, either create it on LaminHub or fix typos."
|
|
112
113
|
)
|
|
114
|
+
branch_record = None
|
|
113
115
|
if branch is not None:
|
|
114
116
|
branch_record = ln.Branch.filter(
|
|
115
117
|
ln.Q(name=branch) | ln.Q(uid=branch)
|
|
@@ -141,12 +143,14 @@ def save(
|
|
|
141
143
|
logger.error("Please pass a key or description via --key or --description")
|
|
142
144
|
return "missing-key-or-description"
|
|
143
145
|
|
|
144
|
-
artifact = ln.Artifact(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
artifact = ln.Artifact(
|
|
147
|
+
path,
|
|
148
|
+
key=key,
|
|
149
|
+
description=description,
|
|
150
|
+
revises=revises,
|
|
151
|
+
branch=branch_record,
|
|
152
|
+
space=space_record,
|
|
153
|
+
).save()
|
|
150
154
|
logger.important(f"saved: {artifact}")
|
|
151
155
|
logger.important(f"storage path: {artifact.path}")
|
|
152
156
|
if artifact.storage.type == "s3":
|
|
@@ -45,7 +45,8 @@ def test_save_and_annotate_local_file():
|
|
|
45
45
|
assert artifact.branch == branch
|
|
46
46
|
assert project in artifact.projects.all()
|
|
47
47
|
|
|
48
|
-
# test passing the registry and saving the same file
|
|
48
|
+
# test passing the registry and saving the same file on the main branch
|
|
49
|
+
# it should recognize the file on the contrib1 branch
|
|
49
50
|
result = subprocess.run(
|
|
50
51
|
f"lamin save {filepath} --key mytest --registry artifact",
|
|
51
52
|
shell=True,
|
|
@@ -94,10 +94,8 @@ def test_save_consecutive_user_passes_uid():
|
|
|
94
94
|
env=env,
|
|
95
95
|
)
|
|
96
96
|
assert result.returncode == 0
|
|
97
|
-
assert (
|
|
98
|
-
|
|
99
|
-
in notebook_path.read_text()
|
|
100
|
-
)
|
|
97
|
+
assert "loaded Transform('hlsFXswrJjtt0000'" in notebook_path.read_text()
|
|
98
|
+
assert "started new Run" in notebook_path.read_text()
|
|
101
99
|
|
|
102
100
|
# now let's simulate the interactive use case and use nbproject_test again
|
|
103
101
|
# use the stem uid instead and it will bump the version
|
|
@@ -107,10 +105,8 @@ def test_save_consecutive_user_passes_uid():
|
|
|
107
105
|
assert r"ln.track(\"hlsFXswrJjtt\")" in notebook_path.read_text()
|
|
108
106
|
|
|
109
107
|
nbproject_test.execute_notebooks(notebook_path, print_outputs=True)
|
|
110
|
-
assert (
|
|
111
|
-
|
|
112
|
-
in notebook_path.read_text()
|
|
113
|
-
)
|
|
108
|
+
assert "created Transform('hlsFXswrJjtt0001'" in notebook_path.read_text()
|
|
109
|
+
assert "started new Run" in notebook_path.read_text()
|
|
114
110
|
|
|
115
111
|
# now, there is a transform record, but we're missing all artifacts because ln.finish() wasn't called
|
|
116
112
|
transform = ln.Transform.filter(uid="hlsFXswrJjtt0001").one_or_none()
|
|
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
|
|
File without changes
|
|
File without changes
|
{lamin_cli-1.8.0 → lamin_cli-1.8.1}/tests/notebooks/with-title-and-initialized-consecutive.ipynb
RENAMED
|
File without changes
|
{lamin_cli-1.8.0 → lamin_cli-1.8.1}/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
|
|
File without changes
|