Skip to content

Commit 218e4b6

Browse files
committed
fix: lumos-cli back to lumos, to realign the package name with the script name for ease of use
1 parent dc14464 commit 218e4b6

File tree

19 files changed

+106
-72
lines changed

19 files changed

+106
-72
lines changed

pyproject.toml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "lumos-cli"
2+
name = "lumos"
33
version = "2.3.0"
44
description = "Lumos command line interface."
55
readme = "README.md"
@@ -15,25 +15,12 @@ classifiers = [
1515
"Programming Language :: Python :: 3.12",
1616
]
1717
dependencies = [
18-
"annotated-types==0.6.0",
19-
"certifi==2024.2.2",
20-
"charset-normalizer==3.3.2",
2118
"click-extra>=7.4.0,<8",
22-
"idna==3.6",
23-
"pick==2.2.0",
24-
"pydantic==2.6.1",
25-
"pydantic_core==2.16.2",
26-
"pytz==2024.1",
27-
"requests>=2.31.0",
28-
"tabulate==0.9.0",
29-
"types-pytz==2024.1.0.20240203",
30-
"types-tabulate==0.9.0.20240106",
31-
"typing-extensions>=3.7.4.3",
32-
"typing_extensions==4.9.0",
33-
"urllib3==2.2.0",
34-
"pyinstaller>=6.5.0,<7",
35-
"types-requests==2.31.0.20240403",
36-
"pytest>=8.2.2,<9",
19+
"pick>=2.2.0,<3",
20+
"pydantic>=2.6.0,<3",
21+
"pytz>=2024.1",
22+
"requests>=2.31.0,<3",
23+
"tabulate>=0.9.0,<1",
3724
]
3825

3926
[project.urls]
@@ -47,6 +34,13 @@ dev = [
4734
"ruff>=0.8.0,<1",
4835
"basedpyright>=1.21.0,<2",
4936
"pre-commit>=4.0.0,<5",
37+
"pytest>=8.2.2,<9",
38+
"types-pytz>=2024.1",
39+
"types-tabulate>=0.9.0",
40+
"types-requests>=2.31.0",
41+
]
42+
build = [
43+
"pyinstaller>=6.5.0,<7",
5044
]
5145
docs = [
5246
"sphinx>=7.0.0,<8",
@@ -61,7 +55,7 @@ requires = ["hatchling"]
6155
build-backend = "hatchling.build"
6256

6357
[project.scripts]
64-
lumos = "lumos_cli.cli:lumos"
58+
lumos = "lumos.cli:lumos"
6559

6660
[tool.ruff]
6761
# Set the target Python version

src/lumos/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import importlib.metadata
2+
3+
__app_name__ = "lumos"
4+
__version__ = importlib.metadata.version("lumos")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from lumos_cli.cli import lumos
1+
from lumos.cli import lumos
22

33

44
def main():
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
from click_extra import Context, echo, group, option, pass_context
44

5-
from lumos_cli.common.client import ApiClient
6-
from lumos_cli.common.helpers import authenticate
7-
from lumos_cli.common.helpers import login as _login
8-
from lumos_cli.common.helpers import logout as _logout
9-
from lumos_cli.common.helpers import setup as _setup
10-
from lumos_cli.common.logging import logdebug
5+
from lumos.common.client import ApiClient
6+
from lumos.common.helpers import authenticate
7+
from lumos.common.helpers import login as _login
8+
from lumos.common.helpers import logout as _logout
9+
from lumos.common.helpers import setup as _setup
10+
from lumos.common.logging import logdebug
1111

1212
client = ApiClient()
1313

@@ -80,8 +80,8 @@ def logout():
8080
# Import and register subcommands
8181
def register_subcommands():
8282
"""Register all subcommands after the main CLI group is defined"""
83-
from lumos_cli.list_collections.cli import list_group
84-
from lumos_cli.request.cli import request
83+
from lumos.list_collections.cli import list_group
84+
from lumos.request.cli import request
8585

8686
lumos.add_command(request)
8787
lumos.add_command(list_group, name="list")
Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@
88
import requests
99
from click_extra import confirm, echo
1010

11-
from lumos_cli import __version__
12-
from lumos_cli.common.client_helpers import check_version_header
13-
from lumos_cli.common.keyhelpers import write_key
14-
from lumos_cli.common.logging import logdebug_request, logdebug_response
15-
from lumos_cli.common.models import AccessRequest, App, AppSetting, Group, Permission, SupportRequestStatus, User
11+
from lumos import __version__
12+
from lumos.common.client_helpers import check_version_header
13+
from lumos.common.keyhelpers import write_key
14+
from lumos.common.logging import logdebug_request, logdebug_response
15+
from lumos.common.models import (
16+
AccessRequest,
17+
App,
18+
AppSetting,
19+
Group,
20+
Permission,
21+
SupportRequestStatus,
22+
User,
23+
)
1624

1725

1826
class BaseClient:
@@ -70,7 +78,8 @@ def get_all(
7078
page == 1
7179
and total > 5000
7280
and not confirm(
73-
f"Warning: {total} results found. This may take a while. Do you want to continue?", default=True
81+
f"Warning: {total} results found. This may take a while. Do you want to continue?",
82+
default=True,
7483
)
7584
):
7685
raise SystemExit(1)
@@ -137,9 +146,15 @@ def _send_request(
137146
return self._send_request(method, endpoint, body, params, retry)
138147
if response.status_code == 401:
139148
if retry > 1 or not (scope := os.environ.get("SCOPE")):
140-
echo("Something went wrong with authorization. Try logging in again.", err=True)
149+
echo(
150+
"Something went wrong with authorization. Try logging in again.",
151+
err=True,
152+
)
141153
raise SystemExit(1)
142-
echo("Something went wrong with authorization. Trying to log in again.", err=True)
154+
echo(
155+
"Something went wrong with authorization. Trying to log in again.",
156+
err=True,
157+
)
143158
AuthClient().authenticate(scope == "admin")
144159
return self._send_request(method, endpoint, body, params, retry + 1)
145160
if response.status_code == 403:
@@ -233,7 +248,10 @@ def authenticate(self, admin: bool = False):
233248

234249
wait = 0
235250
while True:
236-
print(" ⏰ Waiting" + ("." * (wait % 10)) + (" " * (10 - (wait % 10))), end="\r")
251+
print(
252+
" ⏰ Waiting" + ("." * (wait % 10)) + (" " * (10 - (wait % 10))),
253+
end="\r",
254+
)
237255
token_response = requests.post(token_url, headers=headers, data=token_data)
238256
if token_response.status_code == 400:
239257
echo(f"Bad request: {token_response.json()}")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import requests
44
from click_extra import secho
55

6-
from lumos_cli import __version__
6+
from lumos import __version__
77

88

99
def check_version_header(response: requests.Response) -> bool:
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from click_extra import confirm, echo, prompt
55
from pick import pick
66

7-
from lumos_cli.common.client import AuthClient
8-
from lumos_cli.common.keyhelpers import key_file_path, read_key, write_key
9-
from lumos_cli.common.models import App, Permission, SupportRequestStatus
7+
from lumos.common.client import AuthClient
8+
from lumos.common.keyhelpers import key_file_path, read_key, write_key
9+
from lumos.common.models import App, Permission, SupportRequestStatus
1010

1111

1212
def authenticate(func):
@@ -30,7 +30,8 @@ def setup(show_prompt: bool = False, show_overwrite_prompt: bool = False):
3030
):
3131
return
3232
if show_prompt and not confirm(
33-
" 🛠️ You need to authenticate to use this application. Do you want to do that now?", default=True
33+
" 🛠️ You need to authenticate to use this application. Do you want to do that now?",
34+
default=True,
3435
):
3536
raise SystemExit(1)
3637
selected, _ = pick(["OAuth 2.0", "API key"], "How do you want to authenticate?")
@@ -79,7 +80,10 @@ def check_current_apps(
7980
if len(app.requestable_permissions) > 0 and selected_permissions:
8081
for permission in [str(r.id) for r in app.requestable_permissions]:
8182
if permission in [str(r.id) for r in selected_permissions]:
82-
return app, "There's already a request for this app and permission"
83+
return (
84+
app,
85+
"There's already a request for this app and permission",
86+
)
8387
elif len(app.requestable_permissions) == 0 and not selected_permissions:
8488
return app, "There's already a request for this app"
8589

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from pathlib import Path
33

4-
from lumos_cli.common.logging import logdebug
4+
from lumos.common.logging import logdebug
55

66

77
def key_file_path() -> Path:

0 commit comments

Comments
 (0)