lamin_cli 1.7.0__tar.gz → 1.7.2__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.7.0 → lamin_cli-1.7.2}/PKG-INFO +1 -1
- lamin_cli-1.7.2/lamin_cli/__init__.py +12 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/__main__.py +2 -2
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/_save.py +5 -17
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_save_annotate_files.py +6 -6
- lamin_cli-1.7.0/lamin_cli/__init__.py +0 -3
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/.github/workflows/build.yml +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/.github/workflows/doc-changes.yml +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/.gitignore +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/.pre-commit-config.yaml +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/LICENSE +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/README.md +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/_annotate.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/_cache.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/_load.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/_migration.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/_settings.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/compute/__init__.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/compute/modal.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/lamin_cli/urls.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/noxfile.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/pyproject.toml +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/conftest.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_create_switch_delete_list.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_load.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_login.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_migrate.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_multi_process.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_parse_uid_from_code.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_save_annotate_scripts.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_save_notebooks.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/core/test_save_r_code.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/modal/test_modal.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/notebooks/not-initialized.ipynb +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/notebooks/with-title-and-initialized-consecutive.ipynb +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/notebooks/with-title-and-initialized-non-consecutive.ipynb +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/scripts/merely-import-lamindb.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/scripts/run-track-and-finish-sync-git.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/scripts/run-track-and-finish.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/scripts/run-track-with-params.py +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/scripts/run-track.R +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/scripts/run-track.qmd +0 -0
- {lamin_cli-1.7.0 → lamin_cli-1.7.2}/tests/scripts/testscript.py +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Lamin CLI.
|
|
2
|
+
|
|
3
|
+
This is the command line interface for interacting with LaminDB & LaminHub.
|
|
4
|
+
|
|
5
|
+
The interface is defined in `__main__.py`. The root API here is used by LaminR to replicate the CLI functionality.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "1.7.2"
|
|
9
|
+
|
|
10
|
+
from ._save import save
|
|
11
|
+
|
|
12
|
+
__all__ = ["save"]
|
|
@@ -449,9 +449,9 @@ def save(path: str, key: str, description: str, stem_uid: str, project: str, spa
|
|
|
449
449
|
other file types and folders as {class}`~lamindb.Artifact`. You can enforce saving a file as
|
|
450
450
|
an {class}`~lamindb.Artifact` by passing `--registry artifact`.
|
|
451
451
|
"""
|
|
452
|
-
from lamin_cli
|
|
452
|
+
from lamin_cli import save as save_
|
|
453
453
|
|
|
454
|
-
if
|
|
454
|
+
if save_(path=path, key=key, description=description, stem_uid=stem_uid, project=project, space=space, branch=branch, registry=registry) is not None:
|
|
455
455
|
sys.exit(1)
|
|
456
456
|
|
|
457
457
|
|
|
@@ -71,7 +71,7 @@ def parse_title_r_notebook(content: str) -> str | None:
|
|
|
71
71
|
return None
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
def
|
|
74
|
+
def save(
|
|
75
75
|
path: Path | str,
|
|
76
76
|
key: str | None,
|
|
77
77
|
description: str | None,
|
|
@@ -81,21 +81,9 @@ def save_from_path_cli(
|
|
|
81
81
|
branch: str | None,
|
|
82
82
|
registry: str | None,
|
|
83
83
|
) -> str | None:
|
|
84
|
-
import lamindb_setup as ln_setup
|
|
85
|
-
from lamindb_setup.core.upath import LocalPathClasses, UPath, create_path
|
|
86
|
-
|
|
87
|
-
# this will be gone once we get rid of lamin load or enable loading multiple
|
|
88
|
-
# instances sequentially
|
|
89
|
-
auto_connect_state = ln_setup.settings.auto_connect
|
|
90
|
-
ln_setup.settings.auto_connect = True
|
|
91
|
-
|
|
92
84
|
import lamindb as ln
|
|
93
|
-
|
|
94
|
-
if not ln.setup.core.django.IS_SETUP:
|
|
95
|
-
sys.exit(-1)
|
|
96
85
|
from lamindb._finish import save_context_core
|
|
97
|
-
|
|
98
|
-
ln_setup.settings.auto_connect = auto_connect_state
|
|
86
|
+
from lamindb_setup.core.upath import LocalPathClasses, UPath, create_path
|
|
99
87
|
|
|
100
88
|
# this allows to have the correct treatment of credentials in case of cloud paths
|
|
101
89
|
path = create_path(path)
|
|
@@ -166,8 +154,8 @@ def save_from_path_cli(
|
|
|
166
154
|
if project is not None:
|
|
167
155
|
artifact.projects.add(project_record)
|
|
168
156
|
logger.important(f"labeled with project: {project_record.name}")
|
|
169
|
-
if
|
|
170
|
-
slug =
|
|
157
|
+
if ln.setup.settings.instance.is_remote:
|
|
158
|
+
slug = ln.setup.settings.instance.slug
|
|
171
159
|
logger.important(f"go to: https://lamin.ai/{slug}/artifact/{artifact.uid}")
|
|
172
160
|
return None
|
|
173
161
|
|
|
@@ -280,7 +268,7 @@ def save_from_path_cli(
|
|
|
280
268
|
logger.important(f"labeled with project: {project_record.name}")
|
|
281
269
|
# latest run of this transform by user
|
|
282
270
|
run = ln.Run.filter(transform=transform).order_by("-started_at").first()
|
|
283
|
-
if run is not None and run.created_by.id !=
|
|
271
|
+
if run is not None and run.created_by.id != ln.setup.settings.user.id:
|
|
284
272
|
if os.getenv("LAMIN_TESTING") == "true":
|
|
285
273
|
response = "y"
|
|
286
274
|
else:
|
|
@@ -41,7 +41,7 @@ def test_save_and_annotate_local_file():
|
|
|
41
41
|
assert "labeled with project: test_project" in result.stdout.decode()
|
|
42
42
|
assert result.returncode == 0
|
|
43
43
|
|
|
44
|
-
artifact = ln.Artifact.get(key="mytest")
|
|
44
|
+
artifact = ln.Artifact.get(key="mytest", branch=branch)
|
|
45
45
|
assert artifact.branch == branch
|
|
46
46
|
assert project in artifact.projects.all()
|
|
47
47
|
|
|
@@ -90,9 +90,9 @@ def test_save_and_annotate_local_file():
|
|
|
90
90
|
ln.ULabel(name="DMSO", type=ml_split_type).save()
|
|
91
91
|
ln.ULabel(name="IFNG", type=ml_split_type).save()
|
|
92
92
|
ln.Feature(name="perturbation", dtype=ml_split_type).save()
|
|
93
|
-
|
|
93
|
+
# can't find by key here because the artifact is not in the main branch
|
|
94
94
|
result = subprocess.run(
|
|
95
|
-
"lamin annotate --
|
|
95
|
+
f"lamin annotate --uid {artifact.uid} --project test_project --features perturbation=DMSO,IFNG",
|
|
96
96
|
shell=True,
|
|
97
97
|
capture_output=True,
|
|
98
98
|
)
|
|
@@ -100,13 +100,13 @@ def test_save_and_annotate_local_file():
|
|
|
100
100
|
print(result.stderr.decode())
|
|
101
101
|
assert result.returncode == 0
|
|
102
102
|
|
|
103
|
-
artifact = ln.Artifact.get(key="mytest")
|
|
103
|
+
artifact = ln.Artifact.get(key="mytest", branch=branch)
|
|
104
104
|
features = artifact.features.get_values()
|
|
105
105
|
assert features["perturbation"] == {"DMSO", "IFNG"}
|
|
106
106
|
assert project in artifact.projects.all()
|
|
107
|
-
|
|
107
|
+
# can't find by key here because the artifact is not in the main branch
|
|
108
108
|
result = subprocess.run(
|
|
109
|
-
"lamin describe --
|
|
109
|
+
f"lamin describe --uid {artifact.uid}",
|
|
110
110
|
shell=True,
|
|
111
111
|
capture_output=True,
|
|
112
112
|
)
|
|
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.7.0 → lamin_cli-1.7.2}/tests/notebooks/with-title-and-initialized-consecutive.ipynb
RENAMED
|
File without changes
|
{lamin_cli-1.7.0 → lamin_cli-1.7.2}/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
|