lamin_cli 0.16.2__py2.py3-none-any.whl → 0.17.0__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
@@ -1,3 +1,3 @@
1
1
  """Lamin CLI."""
2
2
 
3
- __version__ = "0.16.2"
3
+ __version__ = "0.17.0"
lamin_cli/__main__.py CHANGED
@@ -52,7 +52,7 @@ else:
52
52
  },
53
53
  {
54
54
  "name": "Configuration commands",
55
- "commands": ["register", "cache", "set"],
55
+ "commands": ["cache", "set"],
56
56
  },
57
57
  {
58
58
  "name": "Schema commands",
@@ -72,6 +72,7 @@ else:
72
72
  @wraps(f)
73
73
  def wrapper(*args, **kwargs):
74
74
  return f(*args, **kwargs)
75
+
75
76
  return wrapper
76
77
 
77
78
 
@@ -97,15 +98,22 @@ def main():
97
98
  @main.command()
98
99
  @click.argument("user", type=str)
99
100
  @click.option("--key", type=str, default=None, help="API key")
100
- @click.option("--password", type=str, default=None, help="legacy password")
101
- def login(user: str, key: Optional[str], password: Optional[str]):
102
- """Login using a user email address or handle.
101
+ def login(user: str, key: Optional[str]):
102
+ """Log into LaminHub.
103
+
104
+ Upon logging in the first time, you need to pass your API key via
105
+
106
+ ```
107
+ lamin login myemail@acme.com --key YOUR_API_KEY
108
+ ```
109
+
110
+ You'll find your API key in the top right corner under "Settings".
103
111
 
104
- Examples: `lamin login marge` or `lamin login marge@acme.com`
112
+ After this, you can either use `lamin login myhandle` or `lamin login myemail@acme.com`
105
113
  """
106
114
  from lamindb_setup._setup_user import login
107
115
 
108
- return login(user, key=key, password=password)
116
+ return login(user, key=key)
109
117
 
110
118
 
111
119
  # fmt: off
@@ -202,14 +210,6 @@ def save(filepath: str, key: str, description: str):
202
210
  sys.exit(1)
203
211
 
204
212
 
205
- @main.command()
206
- def register():
207
- """Register an instance on the hub."""
208
- from lamindb_setup._register_instance import register as register_
209
-
210
- return register_()
211
-
212
-
213
213
  main.add_command(cache)
214
214
 
215
215
 
lamin_cli/_cache.py CHANGED
@@ -37,4 +37,4 @@ def get_cache():
37
37
  """Get the cache directory."""
38
38
  from lamindb_setup._cache import get_cache_dir
39
39
 
40
- click.echo(f"The cache directory is {get_cache_dir()}.")
40
+ click.echo(f"The cache directory is {get_cache_dir()}")
lamin_cli/_get.py CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
  from typing import Tuple
3
3
  from lamin_utils import logger
4
4
  import lamindb_setup as ln_setup
5
+ from pathlib import Path
5
6
 
6
7
 
7
8
  def decompose_url(url: str) -> Tuple[str, str, str]:
@@ -25,6 +26,7 @@ def get(url: str):
25
26
  ln_setup.settings.auto_connect = False
26
27
 
27
28
  import lamindb as ln
29
+ from lamindb._finish import script_to_notebook
28
30
 
29
31
  ln_setup.settings.auto_connect = auto_connect
30
32
  ln.connect(instance_slug)
@@ -32,12 +34,23 @@ def get(url: str):
32
34
 
33
35
  if entity == "transform":
34
36
  transform = ln.Transform.get(uid)
35
- filepath_cache = transform._source_code_artifact.cache()
36
37
  target_filename = transform.key
37
- if not target_filename.endswith(transform._source_code_artifact.suffix):
38
- target_filename += transform._source_code_artifact.suffix
39
- filepath_cache.rename(target_filename)
40
- logger.success(f"cached source code of transform {uid} as {target_filename}")
38
+ if transform._source_code_artifact_id is not None:
39
+ # backward compat
40
+ filepath_cache = transform._source_code_artifact.cache()
41
+ if not target_filename.endswith(transform._source_code_artifact.suffix):
42
+ target_filename += transform._source_code_artifact.suffix
43
+ filepath_cache.rename(target_filename)
44
+ elif transform.source_code is not None:
45
+ if transform.key.endswith(".ipynb"):
46
+ script_to_notebook(transform, target_filename)
47
+ else:
48
+ Path(target_filename).write_text(transform.source_code)
49
+ else:
50
+ raise ValueError("No source code available for this transform.")
51
+ logger.success(
52
+ f"downloaded source code of transform {uid} as {target_filename}"
53
+ )
41
54
  elif entity == "artifact":
42
55
  artifact = ln.Artifact.get(uid)
43
56
  cache_path = artifact.cache()
lamin_cli/_save.py CHANGED
@@ -90,13 +90,10 @@ def save_from_filepath_cli(
90
90
  " in Transform registry. Did you run ln.context.track()?"
91
91
  )
92
92
  return "not-tracked-in-transform-registry"
93
- # refactor this, save_context_core should not depend on transform_family
94
- transform_family = transform.versions
95
93
  else:
96
- # the corresponding transform family in the transform table
97
- transform_family = ln.Transform.filter(uid__startswith=stem_uid).all()
98
- # the specific version
99
- transform = transform_family.filter(version=transform_version).one()
94
+ transform = ln.Transform.get(
95
+ uid__startswith=stem_uid, version=transform_version
96
+ )
100
97
  # latest run of this transform by user
101
98
  run = ln.Run.filter(transform=transform).order_by("-started_at").first()
102
99
  if run.created_by.id != ln_setup.settings.user.id:
@@ -110,6 +107,5 @@ def save_from_filepath_cli(
110
107
  run=run,
111
108
  transform=transform,
112
109
  filepath=filepath,
113
- transform_family=transform_family,
114
110
  from_cli=True,
115
111
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamin_cli
3
- Version: 0.16.2
3
+ Version: 0.17.0
4
4
  Summary: Lamin CLI.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Description-Content-Type: text/markdown
@@ -0,0 +1,10 @@
1
+ lamin_cli/__init__.py,sha256=SHogvZAuS3pbUCg081hRt71yhRcoNP8eSHt63fGBZP0,41
2
+ lamin_cli/__main__.py,sha256=7mUJe-6Vq8WNNR90t2j0Pa_XLMNaS9rdctj7OEfhum0,7898
3
+ lamin_cli/_cache.py,sha256=6LrrWNrdZzH_BrohQ2n24xLFhUQ5EFan1bnzqMX_mIg,812
4
+ lamin_cli/_get.py,sha256=wym5KQCsS02ttejFaVMlc2ZPK5SSnYNNbUqnj3nHSfg,2164
5
+ lamin_cli/_migration.py,sha256=dULOvbpJ4VBiXuxPAM8jFGnBkh7pQGqE5eP-UC6uxWc,1055
6
+ lamin_cli/_save.py,sha256=Wmio1l4QWpd2u_GIpmoeOukJujas2qtuB1BQfe7jyE4,4501
7
+ lamin_cli-0.17.0.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
8
+ lamin_cli-0.17.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
9
+ lamin_cli-0.17.0.dist-info/METADATA,sha256=x3-b49Ir0HiFQT-9G8N2unvmBPKJ42FasLPViwFQcvY,336
10
+ lamin_cli-0.17.0.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- lamin_cli/__init__.py,sha256=crsjcR_B06Sik0bsq8ZMipKFmOk_AehyoD__l5IV20c,41
2
- lamin_cli/__main__.py,sha256=B2zUf8d7vcoCN-SuEo7dtlJg-waJgYyd-Y--ZZatP2E,7988
3
- lamin_cli/_cache.py,sha256=WMDUkJyATVdN8pMqgqw1DZLVym-CaBjCHEoRimI69LQ,813
4
- lamin_cli/_get.py,sha256=MXcR9PTW0FzY3uIPa-50SLCrtuRElxgDB3Vkfo-TFT0,1616
5
- lamin_cli/_migration.py,sha256=dULOvbpJ4VBiXuxPAM8jFGnBkh7pQGqE5eP-UC6uxWc,1055
6
- lamin_cli/_save.py,sha256=LP-5ykImaWDad2walTTU9wiWUHt8LyNmrxr3qedKu7Y,4830
7
- lamin_cli-0.16.2.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
8
- lamin_cli-0.16.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
9
- lamin_cli-0.16.2.dist-info/METADATA,sha256=i76L8XLfj-w-LpBmrw5ThHqyQILIrIg_BFcP90j3rTM,336
10
- lamin_cli-0.16.2.dist-info/RECORD,,