lamin_cli 1.8.0__py2.py3-none-any.whl → 1.8.2__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 CHANGED
@@ -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.0"
8
+ __version__ = "1.8.2"
9
9
 
10
10
  from lamindb_setup import disconnect, logout
11
11
  from lamindb_setup._connect_instance import _connect_cli as connect
lamin_cli/__main__.py CHANGED
@@ -180,8 +180,9 @@ def init(
180
180
  # fmt: off
181
181
  @main.command()
182
182
  @click.argument("instance", type=str)
183
+ @click.option("--use_proxy_db", is_flag=True, help="Use proxy database connection.")
183
184
  # fmt: on
184
- def connect(instance: str):
185
+ def connect(instance: str, use_proxy_db: bool):
185
186
  """Configure default instance for connections.
186
187
 
187
188
  Python/R sessions and CLI commands will then auto-connect to the configured instance.
@@ -190,7 +191,7 @@ def connect(instance: str):
190
191
 
191
192
  See also: Connect in a Python session via {func}`~lamindb.connect`.
192
193
  """
193
- return connect_(instance)
194
+ return connect_(instance, use_proxy_db=use_proxy_db)
194
195
 
195
196
 
196
197
  @main.command()
@@ -424,13 +425,15 @@ def save(path: str, key: str, description: str, stem_uid: str, project: str, spa
424
425
 
425
426
 
426
427
  @main.command()
428
+ @click.argument("entity", type=str, default=None, required=False)
427
429
  @click.option("--key", type=str, default=None, help="The key of an artifact or transform.")
428
430
  @click.option("--uid", type=str, default=None, help="The uid of an artifact or transform.")
429
431
  @click.option("--project", type=str, default=None, help="A valid project name or uid.")
430
432
  @click.option("--features", multiple=True, help="Feature annotations. Supports: feature=value, feature=val1,val2, or feature=\"val1\",\"val2\"")
431
- @click.option("--registry", type=str, default=None, help="Either 'artifact' or 'transform'. If not passed, chooses based on key suffix.")
432
- def annotate(key: str, uid: str, project: str, registry: str, features: tuple):
433
- """Annotate an artifact or a transform.
433
+ def annotate(entity: str | None, key: str, uid: str, project: str, features: tuple):
434
+ """Annotate an artifact or transform.
435
+
436
+ Entity is either 'artifact' or 'transform'. If not passed, chooses based on key suffix.
434
437
 
435
438
  You can annotate with projects and valid features & values. For example,
436
439
 
@@ -445,11 +448,17 @@ def annotate(key: str, uid: str, project: str, registry: str, features: tuple):
445
448
  from lamin_cli._annotate import _parse_features_list
446
449
  from lamin_cli._save import infer_registry_from_path
447
450
 
448
- if registry is None:
451
+ # once we enable passing the URL as entity, then we don't need to throw this error
452
+ if not ln.setup.settings._instance_exists:
453
+ raise click.ClickException("Not connected to an instance. Please run: lamin connect account/name")
454
+
455
+ if entity is None:
449
456
  if key is not None:
450
457
  registry = infer_registry_from_path(key)
451
458
  else:
452
459
  registry = "artifact"
460
+ else:
461
+ registry = entity
453
462
  if registry == "artifact":
454
463
  model = ln.Artifact
455
464
  else:
@@ -459,7 +468,7 @@ def annotate(key: str, uid: str, project: str, registry: str, features: tuple):
459
468
  if key is not None:
460
469
  artifact = model.get(key=key)
461
470
  elif uid is not None:
462
- artifact = model.get(uid=uid)
471
+ artifact = model.get(uid) # do not use uid=uid, because then no truncated uids would work
463
472
  else:
464
473
  raise ln.errors.InvalidArgument("Either --key or --uid must be provided")
465
474
 
lamin_cli/_save.py CHANGED
@@ -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(path, key=key, description=description, revises=revises)
145
- if space is not None:
146
- artifact.space = space_record
147
- if branch is not None:
148
- artifact.branch = branch_record
149
- artifact.save()
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":
@@ -156,7 +160,8 @@ def save(
156
160
  logger.important(f"labeled with project: {project_record.name}")
157
161
  if ln.setup.settings.instance.is_remote:
158
162
  slug = ln.setup.settings.instance.slug
159
- logger.important(f"go to: https://lamin.ai/{slug}/artifact/{artifact.uid}")
163
+ ui_url = ln.setup.settings.instance.ui_url
164
+ logger.important(f"go to: {ui_url}/{slug}/artifact/{artifact.uid}")
160
165
  return None
161
166
 
162
167
  if registry == "transform":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamin_cli
3
- Version: 1.8.0
3
+ Version: 1.8.2
4
4
  Summary: Lamin CLI.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Description-Content-Type: text/markdown
@@ -1,17 +1,17 @@
1
- lamin_cli/__init__.py,sha256=QIcp3UIsllYnrOYOy9UKJ5cXdfJ8bmQ8LVUdODwUg80,563
2
- lamin_cli/__main__.py,sha256=TjUJFtQAoBop9WnMLDKsXdEiQsfDBhOLxXRKBbu8j6k,18732
1
+ lamin_cli/__init__.py,sha256=UE_o2BSyhfXL0PkGbgUKzFvRh9nw9oZf7sdX1gNf0G0,563
2
+ lamin_cli/__main__.py,sha256=zuzvpfWDvrLxvcLNwAyGQHIGXiFvAra4dnPe7Nygu6M,19225
3
3
  lamin_cli/_annotate.py,sha256=ZD76__K-mQt7UpYqyM1I2lKCs-DraTmnkjsByIHmD-g,1839
4
4
  lamin_cli/_cache.py,sha256=oplwE8AcS_9PYptQUZxff2qTIdNFS81clGPkJNWk098,800
5
5
  lamin_cli/_delete.py,sha256=dxItUgf7At247iYGLagmJ2Ccp5nAWgodPL7c7zfZQ_0,1420
6
6
  lamin_cli/_load.py,sha256=OgTGqZQtoJ0GYOhuJihz-izt0F4jM4U_nSX_vhPoukg,7698
7
7
  lamin_cli/_migration.py,sha256=XUl_L9_3pTTk5jJoBiqbzf0Bd2LdKKtHa1zPZ4Rla5c,1267
8
- lamin_cli/_save.py,sha256=PE0UCGw2DxzSjEv6ckZIaO2BQK6JWQN4ih6fLY64JIk,11498
8
+ lamin_cli/_save.py,sha256=EPYsRpl0vD_Q52ksqVyP56ZOvPXBjgTFPeJWyGokN8I,11555
9
9
  lamin_cli/_settings.py,sha256=mTnwU5zfBGwt9x6RrhFpi4f0DeyEfI02YWs96x_JYWw,2672
10
10
  lamin_cli/urls.py,sha256=gc72s4SpaAQA8J50CtCIWlr49DWOSL_a6OM9lXfPouM,367
11
11
  lamin_cli/compute/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  lamin_cli/compute/modal.py,sha256=QnR7GyyvWWWkLnou95HxS9xxSQfw1k-SiefM_qRVnU0,6010
13
- lamin_cli-1.8.0.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
14
- lamin_cli-1.8.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
- lamin_cli-1.8.0.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
16
- lamin_cli-1.8.0.dist-info/METADATA,sha256=iBekqxAT65m34wU51Cl7XzNp6LrIZJR3f_jRlcJRClA,337
17
- lamin_cli-1.8.0.dist-info/RECORD,,
13
+ lamin_cli-1.8.2.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
14
+ lamin_cli-1.8.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
+ lamin_cli-1.8.2.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
16
+ lamin_cli-1.8.2.dist-info/METADATA,sha256=ISh-SL8AGEvoOOSIkaUREwzYdLVk4U01NVAgySnzA20,337
17
+ lamin_cli-1.8.2.dist-info/RECORD,,