qbraid-cli 0.8.7__py3-none-any.whl → 0.9.0__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.
Potentially problematic release.
This version of qbraid-cli might be problematic. Click here for more details.
- qbraid_cli/_version.py +2 -2
- qbraid_cli/account/__init__.py +11 -0
- qbraid_cli/account/app.py +65 -0
- qbraid_cli/devices/app.py +1 -1
- qbraid_cli/envs/app.py +3 -3
- qbraid_cli/handlers.py +4 -0
- qbraid_cli/jobs/app.py +1 -1
- qbraid_cli/jobs/toggle_braket.py +1 -1
- qbraid_cli/main.py +18 -9
- {qbraid_cli-0.8.7.dist-info → qbraid_cli-0.9.0.dist-info}/METADATA +5 -4
- {qbraid_cli-0.8.7.dist-info → qbraid_cli-0.9.0.dist-info}/RECORD +15 -15
- {qbraid_cli-0.8.7.dist-info → qbraid_cli-0.9.0.dist-info}/WHEEL +1 -1
- qbraid_cli/credits/__init__.py +0 -11
- qbraid_cli/credits/app.py +0 -35
- {qbraid_cli-0.8.7.dist-info → qbraid_cli-0.9.0.dist-info}/LICENSE +0 -0
- {qbraid_cli-0.8.7.dist-info → qbraid_cli-0.9.0.dist-info}/entry_points.txt +0 -0
- {qbraid_cli-0.8.7.dist-info → qbraid_cli-0.9.0.dist-info}/top_level.txt +0 -0
qbraid_cli/_version.py
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Copyright (c) 2024, qBraid Development Team
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Module defining commands in the 'qbraid user' namespace.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
import rich
|
|
12
|
+
import typer
|
|
13
|
+
|
|
14
|
+
from qbraid_cli.handlers import run_progress_task
|
|
15
|
+
|
|
16
|
+
account_app = typer.Typer(help="Manage qBraid account.")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@account_app.command(name="credits")
|
|
20
|
+
def account_credits():
|
|
21
|
+
"""Get number of qBraid credits remaining."""
|
|
22
|
+
|
|
23
|
+
def get_credits() -> float:
|
|
24
|
+
from qbraid_core import QbraidClient
|
|
25
|
+
|
|
26
|
+
client = QbraidClient()
|
|
27
|
+
return client.user_credits_value()
|
|
28
|
+
|
|
29
|
+
qbraid_credits: float = run_progress_task(get_credits)
|
|
30
|
+
typer.secho(
|
|
31
|
+
f"{typer.style('qBraid credits remaining:')} "
|
|
32
|
+
f"{typer.style(f'{qbraid_credits:.4f}', fg=typer.colors.MAGENTA, bold=True)}",
|
|
33
|
+
nl=True, # Ensure a newline after output (default is True)
|
|
34
|
+
)
|
|
35
|
+
rich.print("\nFor more information, visit: https://docs.qbraid.com/home/pricing#credits")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@account_app.command(name="info")
|
|
39
|
+
def account_info():
|
|
40
|
+
"""Get qBraid account (user) metadata."""
|
|
41
|
+
|
|
42
|
+
def get_user() -> dict[str, Any]:
|
|
43
|
+
from qbraid_core import QbraidSession
|
|
44
|
+
|
|
45
|
+
session = QbraidSession()
|
|
46
|
+
user = session.get_user()
|
|
47
|
+
personal_info: dict = user.get("personalInformation", {})
|
|
48
|
+
metadata = {
|
|
49
|
+
"_id": user.get("_id"),
|
|
50
|
+
"userName": user.get("userName"),
|
|
51
|
+
"email": user.get("email"),
|
|
52
|
+
"joinedDate": user.get("createdAt", "Unknown"),
|
|
53
|
+
"activePlan": user.get("activePlan", "") or "Free",
|
|
54
|
+
"organization": personal_info.get("organization", "") or "qbraid",
|
|
55
|
+
"role": personal_info.get("role", "") or "guest",
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return metadata
|
|
59
|
+
|
|
60
|
+
info = run_progress_task(get_user)
|
|
61
|
+
rich.print(info)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
account_app()
|
qbraid_cli/devices/app.py
CHANGED
|
@@ -60,7 +60,7 @@ def devices_list( # pylint: disable=too-many-branches
|
|
|
60
60
|
header_3 = "ID"
|
|
61
61
|
header_4 = "Status"
|
|
62
62
|
console.print(
|
|
63
|
-
f"
|
|
63
|
+
f"[bold]{header_1.ljust(12)}{header_2.ljust(35)}{header_3.ljust(41)}{header_4}[/bold]"
|
|
64
64
|
)
|
|
65
65
|
for device_provider, device_name, device_id, device_status in device_data:
|
|
66
66
|
if device_status == "ONLINE":
|
qbraid_cli/envs/app.py
CHANGED
|
@@ -88,7 +88,7 @@ def envs_create( # pylint: disable=too-many-statements
|
|
|
88
88
|
slug_path = env_path / slug
|
|
89
89
|
description = "None" if description == "" else description
|
|
90
90
|
|
|
91
|
-
typer.echo("
|
|
91
|
+
typer.echo("## qBraid Metadata ##\n")
|
|
92
92
|
typer.echo(f" name: {display_name}")
|
|
93
93
|
typer.echo(f" description: {description}")
|
|
94
94
|
typer.echo(f" tags: {tags}")
|
|
@@ -127,7 +127,7 @@ def envs_create( # pylint: disable=too-many-statements
|
|
|
127
127
|
|
|
128
128
|
console = Console()
|
|
129
129
|
console.print(
|
|
130
|
-
f"
|
|
130
|
+
f"[bold green]Successfully created qBraid environment: "
|
|
131
131
|
f"[/bold green][bold magenta]{name}[/bold magenta]\n"
|
|
132
132
|
)
|
|
133
133
|
typer.echo("# To activate this environment, use")
|
|
@@ -192,7 +192,7 @@ def envs_remove(
|
|
|
192
192
|
description="Deleting local environment...",
|
|
193
193
|
error_message="Failed to delete qBraid environment",
|
|
194
194
|
)
|
|
195
|
-
typer.echo(f"
|
|
195
|
+
typer.echo(f"Environment '{name}' successfully removed.")
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
@envs_app.command(name="list")
|
qbraid_cli/handlers.py
CHANGED
|
@@ -10,6 +10,7 @@ and executing operations with progress tracking within the qBraid CLI.
|
|
|
10
10
|
import os
|
|
11
11
|
import traceback
|
|
12
12
|
from pathlib import Path
|
|
13
|
+
from time import sleep
|
|
13
14
|
from typing import Any, Callable, Optional, Union
|
|
14
15
|
|
|
15
16
|
import typer
|
|
@@ -129,11 +130,14 @@ def run_progress_task(
|
|
|
129
130
|
try:
|
|
130
131
|
result = operation(*args, **kwargs)
|
|
131
132
|
progress.update(task, completed=100, status="Done")
|
|
133
|
+
sleep(0.15)
|
|
132
134
|
return result
|
|
133
135
|
except Exception as err: # pylint: disable=broad-exception-caught
|
|
134
136
|
progress.update(task, completed=100, status="Failed")
|
|
135
137
|
custom_message = error_message if error_message else str(err)
|
|
136
138
|
return handle_error(message=custom_message)
|
|
139
|
+
finally:
|
|
140
|
+
progress.remove_task(task)
|
|
137
141
|
|
|
138
142
|
|
|
139
143
|
def _format_list_items(items: list[str]) -> str:
|
qbraid_cli/jobs/app.py
CHANGED
|
@@ -120,7 +120,7 @@ def jobs_list(
|
|
|
120
120
|
header_1 = "Job ID"
|
|
121
121
|
header_2 = "Submitted"
|
|
122
122
|
header_3 = "Status"
|
|
123
|
-
console.print(f"
|
|
123
|
+
console.print(f"[bold]{header_1.ljust(spacing)}{header_2.ljust(36)}{header_3}[/bold]")
|
|
124
124
|
for job_id, submitted, status in job_data:
|
|
125
125
|
if status == "COMPLETED":
|
|
126
126
|
status_color = "green"
|
qbraid_cli/jobs/toggle_braket.py
CHANGED
|
@@ -103,7 +103,7 @@ def confirm_updates(
|
|
|
103
103
|
else:
|
|
104
104
|
raise ValueError(f"Invalid mode: {mode}. Expected 'enable' or 'disable'.")
|
|
105
105
|
|
|
106
|
-
typer.echo(f"
|
|
106
|
+
typer.echo(f"==> WARNING: {provider}/{core_package} package required <==")
|
|
107
107
|
if (
|
|
108
108
|
installed_version is not None
|
|
109
109
|
and target_version is not None
|
qbraid_cli/main.py
CHANGED
|
@@ -6,27 +6,36 @@ Entrypoint for the qBraid CLI.
|
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
+
import rich
|
|
9
10
|
import typer
|
|
10
11
|
|
|
12
|
+
from qbraid_cli.account.app import account_app
|
|
11
13
|
from qbraid_cli.admin.app import admin_app
|
|
12
14
|
from qbraid_cli.configure.app import configure_app
|
|
13
|
-
from qbraid_cli.credits.app import credits_app
|
|
14
15
|
from qbraid_cli.devices.app import devices_app
|
|
15
|
-
from qbraid_cli.envs.app import envs_app
|
|
16
16
|
from qbraid_cli.jobs.app import jobs_app
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
from qbraid_cli.envs.app import envs_app
|
|
20
|
+
from qbraid_cli.kernels.app import kernels_app
|
|
21
|
+
from qbraid_cli.pip.app import pip_app
|
|
22
|
+
|
|
23
|
+
ENVS_COMMANDS = True
|
|
24
|
+
except ImportError:
|
|
25
|
+
ENVS_COMMANDS = False
|
|
19
26
|
|
|
20
27
|
app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]})
|
|
21
28
|
|
|
22
29
|
app.add_typer(admin_app, name="admin")
|
|
23
30
|
app.add_typer(configure_app, name="configure")
|
|
24
|
-
app.add_typer(
|
|
31
|
+
app.add_typer(account_app, name="account")
|
|
25
32
|
app.add_typer(devices_app, name="devices")
|
|
26
|
-
app.add_typer(envs_app, name="envs")
|
|
27
33
|
app.add_typer(jobs_app, name="jobs")
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
|
|
35
|
+
if ENVS_COMMANDS is True:
|
|
36
|
+
app.add_typer(envs_app, name="envs")
|
|
37
|
+
app.add_typer(kernels_app, name="kernels")
|
|
38
|
+
app.add_typer(pip_app, name="pip")
|
|
30
39
|
|
|
31
40
|
|
|
32
41
|
def version_callback(value: bool):
|
|
@@ -59,7 +68,7 @@ def show_banner():
|
|
|
59
68
|
typer.echo("")
|
|
60
69
|
typer.echo("- Use 'qbraid --version' to see the current version.")
|
|
61
70
|
typer.echo("")
|
|
62
|
-
|
|
71
|
+
rich.print("Reference Docs: https://docs.qbraid.com/cli/api-reference/qbraid")
|
|
63
72
|
|
|
64
73
|
|
|
65
74
|
@app.callback(invoke_without_command=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qbraid-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Command Line Interface for interacting with all parts of the qBraid platform.
|
|
5
5
|
Author-email: qBraid Development Team <contact@qbraid.com>
|
|
6
6
|
License: Proprietary
|
|
@@ -29,13 +29,14 @@ Description-Content-Type: text/markdown
|
|
|
29
29
|
License-File: LICENSE
|
|
30
30
|
Requires-Dist: typer>=0.12.1
|
|
31
31
|
Requires-Dist: rich>=10.11.0
|
|
32
|
-
Requires-Dist: qbraid-core
|
|
32
|
+
Requires-Dist: qbraid-core>=0.1.29
|
|
33
33
|
Provides-Extra: dev
|
|
34
|
-
Requires-Dist: ruff; extra == "dev"
|
|
35
34
|
Requires-Dist: isort; extra == "dev"
|
|
36
35
|
Requires-Dist: black; extra == "dev"
|
|
37
36
|
Requires-Dist: pytest; extra == "dev"
|
|
38
37
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
38
|
+
Provides-Extra: envs
|
|
39
|
+
Requires-Dist: qbraid-core[environments]; extra == "envs"
|
|
39
40
|
Provides-Extra: jobs
|
|
40
41
|
Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
|
|
41
42
|
|
|
@@ -141,7 +142,7 @@ Options
|
|
|
141
142
|
|
|
142
143
|
Commands
|
|
143
144
|
configure Configure qBraid CLI options.
|
|
144
|
-
|
|
145
|
+
account Manage qBraid account.
|
|
145
146
|
devices Manage qBraid quantum devices.
|
|
146
147
|
envs Manage qBraid environments.
|
|
147
148
|
jobs Manage qBraid quantum jobs.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
qbraid_cli/_version.py,sha256=
|
|
2
|
+
qbraid_cli/_version.py,sha256=dEuABWaRk7ju3R5JrWbpUVQ4xq7RBpvl2clGJceWAS4,411
|
|
3
3
|
qbraid_cli/exceptions.py,sha256=KjlhYJhSHMVazaNiBjD_Ur06w4sekP8zRsFzBdyIpno,672
|
|
4
|
-
qbraid_cli/handlers.py,sha256=
|
|
5
|
-
qbraid_cli/main.py,sha256=
|
|
4
|
+
qbraid_cli/handlers.py,sha256=gcEnKFobM-imO8IaPwsSqx_p_whwPW6rqrNZRT0t61M,7137
|
|
5
|
+
qbraid_cli/main.py,sha256=s8tAr5KI653G7-yKdFJeq0I9qTrVV83H8B5Se8VZaKI,2761
|
|
6
6
|
qbraid_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
qbraid_cli/account/__init__.py,sha256=smlpUcVkM3QEbJG0norGM7i71XBJlUGQYByswTfPnmg,181
|
|
8
|
+
qbraid_cli/account/app.py,sha256=ggvft1Q4d5IIv0lf3adbIkcz0nIYiEriJu91SPyo5_4,1821
|
|
7
9
|
qbraid_cli/admin/__init__.py,sha256=qcWD5mQEUCtr49mrUpZmk7eGDe0L_Gtc8RwZmzIXSwo,175
|
|
8
10
|
qbraid_cli/admin/app.py,sha256=NGisg2aouk8qK2oFogwblFTBK0vvTiL_zJYjeanC4x0,1576
|
|
9
11
|
qbraid_cli/admin/headers.py,sha256=WqpRYp81CQcF5-Afumo_qQrf-5XCfbndBJ6I7vOADKE,7133
|
|
@@ -11,28 +13,26 @@ qbraid_cli/admin/validation.py,sha256=U_8RFWBwRUNPe6LdjNpl-Yz8Br57PLWMoPbpR-jBS-
|
|
|
11
13
|
qbraid_cli/configure/__init__.py,sha256=YaJ74Ztz2vl3eYp8_jVBucWkXscxz7EZEIzr70OfuOM,187
|
|
12
14
|
qbraid_cli/configure/actions.py,sha256=-BduRmnxvf8JMNonb6VWFtdlHlcHPOPz3Bj5g8kfmBU,3197
|
|
13
15
|
qbraid_cli/configure/app.py,sha256=1uRe2lkUA4TtYb5b4mbD4LH-cKCbsZGT3Wfk7fpNzX0,2414
|
|
14
|
-
qbraid_cli/credits/__init__.py,sha256=MJhgWgpFT1_886sB-_POlRs1y3SRy23HIrKVBkp0X-Y,181
|
|
15
|
-
qbraid_cli/credits/app.py,sha256=AY3qtveO50KeQ2XREiEVqUcTrESgRuoqt9pt2Z8t4Y0,866
|
|
16
16
|
qbraid_cli/devices/__init__.py,sha256=hiScO-px6jCL5cJj5Hbty55EUfNejTO4bmqUZuS3aqc,181
|
|
17
|
-
qbraid_cli/devices/app.py,sha256=
|
|
17
|
+
qbraid_cli/devices/app.py,sha256=K5NBtXgwncn8x0lzZlXuagb_jWCKXBBdhFMm96eDJBM,2521
|
|
18
18
|
qbraid_cli/devices/validation.py,sha256=YhShyUufgrKnx2XjXOXF-PqFJYklJT9CgeqIwKcNam4,809
|
|
19
19
|
qbraid_cli/envs/__init__.py,sha256=1-cMvrATsddYxcetPJWxq6bEOqJWMktGdhoZ4qm8euA,172
|
|
20
20
|
qbraid_cli/envs/activate.py,sha256=VpvVYSfQDlcmlNWJOgkLIQ2p8YXPPLG8Jbl5t8GHUDw,2140
|
|
21
|
-
qbraid_cli/envs/app.py,sha256=
|
|
21
|
+
qbraid_cli/envs/app.py,sha256=2iJ0Ik39zf_5Kj0hCvkykAdU8ESdUoLodw1-tpcKXyE,8447
|
|
22
22
|
qbraid_cli/envs/create.py,sha256=xudzkLCNegY34zkXN_Vfl_0zVzg_tW83LcVx9quoWfU,988
|
|
23
23
|
qbraid_cli/envs/data_handling.py,sha256=Ibnp2yJoUDpivb_sNqi0suYgJZNat_LmM6Ya0Ovez5s,1288
|
|
24
24
|
qbraid_cli/jobs/__init__.py,sha256=qVLRHYIzP4XHpx_QWP_vCzd3LsCscCORaEx-Vcbx29U,172
|
|
25
|
-
qbraid_cli/jobs/app.py,sha256=
|
|
26
|
-
qbraid_cli/jobs/toggle_braket.py,sha256=
|
|
25
|
+
qbraid_cli/jobs/app.py,sha256=x4mF8KfP9FWyYKZLG5MkkHFQErgYO4VoYEQbtq7q_-Q,4916
|
|
26
|
+
qbraid_cli/jobs/toggle_braket.py,sha256=3AEu-Z5q4avduB-fJMyMTVTuyZXuA8m-hnvi325wIv4,7444
|
|
27
27
|
qbraid_cli/jobs/validation.py,sha256=KlkqVH1-vlNCHSayEpxzyXU86_TMN5prGfMFEoyBsFs,2971
|
|
28
28
|
qbraid_cli/kernels/__init__.py,sha256=jORS9vV17s5laQyq8gSVB18EPBImgEIbMZ1wKC094DA,181
|
|
29
29
|
qbraid_cli/kernels/app.py,sha256=Sl57U1JXDKWoeMQDSXJRHlKzDYSdKIbV7tSytZXo5PM,2926
|
|
30
30
|
qbraid_cli/pip/__init__.py,sha256=tJtU0rxn-ODogNh5Y4pp_BgDQXMN-3JY1QGj0OZHwjQ,169
|
|
31
31
|
qbraid_cli/pip/app.py,sha256=wzvjX5NL37XIFtZ5KvTZ-nj9xwFKt8QLYZ_vGvk3tXo,1440
|
|
32
32
|
qbraid_cli/pip/hooks.py,sha256=jkIeev3cOd-cmaoJSdSqbmhTYCs6z1we84FMqa3ZoZw,2124
|
|
33
|
-
qbraid_cli-0.
|
|
34
|
-
qbraid_cli-0.
|
|
35
|
-
qbraid_cli-0.
|
|
36
|
-
qbraid_cli-0.
|
|
37
|
-
qbraid_cli-0.
|
|
38
|
-
qbraid_cli-0.
|
|
33
|
+
qbraid_cli-0.9.0.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
|
|
34
|
+
qbraid_cli-0.9.0.dist-info/METADATA,sha256=tQ1CMKiU9fLu-2R5Vpwo8ZJCSlZvG8JrXEtPnTciE1E,6785
|
|
35
|
+
qbraid_cli-0.9.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
36
|
+
qbraid_cli-0.9.0.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
|
|
37
|
+
qbraid_cli-0.9.0.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
|
|
38
|
+
qbraid_cli-0.9.0.dist-info/RECORD,,
|
qbraid_cli/credits/__init__.py
DELETED
qbraid_cli/credits/app.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024, qBraid Development Team
|
|
2
|
-
# All rights reserved.
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
Module defining commands in the 'qbraid credits' namespace.
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
import typer
|
|
10
|
-
|
|
11
|
-
from qbraid_cli.handlers import run_progress_task
|
|
12
|
-
|
|
13
|
-
credits_app = typer.Typer(help="Manage qBraid credits.")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@credits_app.command(name="value")
|
|
17
|
-
def credits_value():
|
|
18
|
-
"""Get number of qBraid credits remaining."""
|
|
19
|
-
|
|
20
|
-
def get_credits() -> float:
|
|
21
|
-
from qbraid_core import QbraidClient
|
|
22
|
-
|
|
23
|
-
client = QbraidClient()
|
|
24
|
-
return client.user_credits_value()
|
|
25
|
-
|
|
26
|
-
qbraid_credits: float = run_progress_task(get_credits)
|
|
27
|
-
typer.secho(
|
|
28
|
-
f"\n{typer.style('qBraid credits remaining:')} "
|
|
29
|
-
f"{typer.style(f'{qbraid_credits:.4f}', fg=typer.colors.MAGENTA, bold=True)}",
|
|
30
|
-
nl=True, # Ensure a newline after output (default is True)
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if __name__ == "__main__":
|
|
35
|
-
credits_app()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|