lamin_cli 1.8.0__py2.py3-none-any.whl → 1.8.1__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.1"
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
@@ -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
- @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.
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
- if registry is None:
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
 
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":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamin_cli
3
- Version: 1.8.0
3
+ Version: 1.8.1
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=4B9Apq4lWC216t-9IPkVf5khYyACn27JfUtlRahDXpg,563
2
+ lamin_cli/__main__.py,sha256=OKlIhmvdf5InYTEfh9bO4pT7nYA1vYqB44MFw_Rz_uA,19093
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=IM0iKOhINIaoX_lGJ9QeUOI56idyB1nN4Et8XBGP-u8,11508
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.1.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
14
+ lamin_cli-1.8.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
+ lamin_cli-1.8.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
16
+ lamin_cli-1.8.1.dist-info/METADATA,sha256=0PwK3EvQkEQGWQnYogB_1EQBraLSvIKbNNkN9A0gtz4,337
17
+ lamin_cli-1.8.1.dist-info/RECORD,,