lamin_cli 0.14.0__py2.py3-none-any.whl → 0.15.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.14.0"
3
+ __version__ = "0.15.0"
lamin_cli/__main__.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
  import os
3
3
  import sys
4
+ import inspect
4
5
  from importlib.metadata import PackageNotFoundError, version
5
6
  from typing import Optional
6
7
 
@@ -32,7 +33,7 @@ def main():
32
33
 
33
34
  @main.command()
34
35
  def info():
35
- """Show user & instance info."""
36
+ """Show user, settings & instance info."""
36
37
  import lamindb_setup
37
38
 
38
39
  print(lamindb_setup.settings)
@@ -57,7 +58,10 @@ def init(storage: str, db: Optional[str], schema: Optional[str], name: Optional[
57
58
  @click.option("--key", type=str, default=None, help="API key")
58
59
  @click.option("--password", type=str, default=None, help="legacy password")
59
60
  def login(user: str, key: Optional[str], password: Optional[str]):
60
- """Login using an email or user handle."""
61
+ """Login using a user email address or handle.
62
+
63
+ Examples: `lamin login marge` or `lamin login marge@acme.com`
64
+ """
61
65
  from lamindb_setup._setup_user import login
62
66
 
63
67
  return login(user, key=key, password=password)
@@ -78,12 +82,10 @@ def logout():
78
82
  @click.option("--storage", type=str, default=None, help="Update storage while loading.")
79
83
  # fmt: on
80
84
  def load(identifier: str, db: Optional[str], storage: Optional[str]):
81
- """Auto-connect to a lamindb instance.
82
-
83
- Identifier can be slug (account_handle/instance_name) or url
84
- (https://lamin.ai/account_handle/instance_name).
85
+ """Load an instance for auto-connection.
85
86
 
86
- If the owner is the current user the instance_name suffices.
87
+ `IDENTIFIER` is either a slug (`account/instance`) or a `URL`
88
+ (`https://lamin.ai/account/instance`).
87
89
  """
88
90
  from lamindb_setup import settings, connect
89
91
 
@@ -97,26 +99,38 @@ def load(identifier: str, db: Optional[str], storage: Optional[str]):
97
99
  @click.option("--force", is_flag=True, default=False, help="Do not ask for confirmation.") # noqa: E501
98
100
  # fmt: on
99
101
  def delete(instance: str, force: bool = False):
100
- """Delete instance."""
102
+ """Delete an instance."""
101
103
  from lamindb_setup._delete import delete
102
104
 
103
105
  return delete(instance, force=force)
104
106
 
105
107
 
106
108
  @main.command(name="set")
107
- @click.argument("setting", type=click.Choice(["auto-connect"], case_sensitive=False))
109
+ @click.argument(
110
+ "setting",
111
+ type=click.Choice(["auto-connect", "private-django-api"], case_sensitive=False),
112
+ )
108
113
  @click.argument("value", type=click.BOOL)
109
114
  def set_(setting: str, value: bool):
110
- """Update settings."""
115
+ """Update settings.
116
+
117
+ - `auto-connect` → {attr}`~lamindb.setup.core.SetupSettings.auto_connect`
118
+ - `private-django-api` → {attr}`~lamindb.setup.core.SetupSettings.private_django_api`
119
+ """
111
120
  from lamindb_setup import settings
112
121
 
113
122
  if setting == "auto-connect":
114
123
  settings.auto_connect = value
124
+ if setting == "private-django-api":
125
+ settings.private_django_api = value
115
126
 
116
127
 
117
128
  @main.command()
118
129
  def close():
119
- """Close existing instance."""
130
+ """Close an existing instance.
131
+
132
+ Is the opposite of loading an instance.
133
+ """
120
134
  from lamindb_setup._close import close as close_
121
135
 
122
136
  return close_()
@@ -168,8 +182,9 @@ main.add_command(migrate)
168
182
 
169
183
 
170
184
  # https://stackoverflow.com/questions/57810659/automatically-generate-all-help-documentation-for-click-commands
185
+ # https://claude.ai/chat/73c28487-bec3-4073-8110-50d1a2dd6b84
171
186
  def _generate_help():
172
- out: dict[str, str] = {}
187
+ out: dict[str, dict[str, str | None]] = {}
173
188
 
174
189
  def recursive_help(
175
190
  cmd: Command, parent: Optional[Context] = None, name: tuple[str, ...] = ()
@@ -177,7 +192,16 @@ def _generate_help():
177
192
  ctx = click.Context(cmd, info_name=cmd.name, parent=parent)
178
193
  assert cmd.name
179
194
  name = (*name, cmd.name)
180
- out[" ".join(name)] = cmd.get_help(ctx)
195
+ command_name = " ".join(name)
196
+
197
+ docstring = inspect.getdoc(cmd.callback)
198
+ usage = cmd.get_help(ctx).split("\n")[0]
199
+ options = cmd.get_help(ctx).split("Options:")[1]
200
+ out[command_name] = {
201
+ "help": usage + "\n\nOptions:" + options,
202
+ "docstring": docstring,
203
+ }
204
+
181
205
  for sub in getattr(cmd, "commands", {}).values():
182
206
  recursive_help(sub, ctx, name=name)
183
207
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamin_cli
3
- Version: 0.14.0
3
+ Version: 0.15.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=rCah4PWSwkQ8EKMAnlmgxM63T5nRmMKn3IY2w7jL7_Y,41
2
+ lamin_cli/__main__.py,sha256=uRqKMavTidci8Ld-Xbd1PyiRWPulNvNxJAWxy-8rFvU,6150
3
+ lamin_cli/_cache.py,sha256=WMDUkJyATVdN8pMqgqw1DZLVym-CaBjCHEoRimI69LQ,813
4
+ lamin_cli/_get.py,sha256=6a4KzHWlCgL_LW2XFCbOmH9julzTkSuUcsTKTHczqTA,1586
5
+ lamin_cli/_migration.py,sha256=dULOvbpJ4VBiXuxPAM8jFGnBkh7pQGqE5eP-UC6uxWc,1055
6
+ lamin_cli/_save.py,sha256=6mu6sAVcXsq4-XW-tzcVxUVh-Gv7e9EFkTyMmdrCGNw,4291
7
+ lamin_cli-0.15.0.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
8
+ lamin_cli-0.15.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
9
+ lamin_cli-0.15.0.dist-info/METADATA,sha256=lEDqqkixCPI_KMn2kwMgDv_kGKaqXsCgljSvAhOcKns,336
10
+ lamin_cli-0.15.0.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- lamin_cli/__init__.py,sha256=AWDIw2GP7pFnmHRm-ClnRl2PYc9j3sJfzYTQ9DLndHY,41
2
- lamin_cli/__main__.py,sha256=6HsLIqCQzsqG7UKTx3_5IlTYG9pkDpMjeeKLtA8Z57g,5411
3
- lamin_cli/_cache.py,sha256=WMDUkJyATVdN8pMqgqw1DZLVym-CaBjCHEoRimI69LQ,813
4
- lamin_cli/_get.py,sha256=6a4KzHWlCgL_LW2XFCbOmH9julzTkSuUcsTKTHczqTA,1586
5
- lamin_cli/_migration.py,sha256=dULOvbpJ4VBiXuxPAM8jFGnBkh7pQGqE5eP-UC6uxWc,1055
6
- lamin_cli/_save.py,sha256=6mu6sAVcXsq4-XW-tzcVxUVh-Gv7e9EFkTyMmdrCGNw,4291
7
- lamin_cli-0.14.0.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
8
- lamin_cli-0.14.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
9
- lamin_cli-0.14.0.dist-info/METADATA,sha256=4kklJ3bV8Kq3d5C7xlYOXMFAh7vnkj8Y3lJ9gFD-Pb4,336
10
- lamin_cli-0.14.0.dist-info/RECORD,,