qbraid-cli 0.8.3__py3-none-any.whl → 0.8.4__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/envs/create.py +5 -37
- qbraid_cli/kernels/app.py +30 -49
- qbraid_cli/main.py +1 -1
- {qbraid_cli-0.8.3.dist-info → qbraid_cli-0.8.4.dist-info}/METADATA +12 -14
- {qbraid_cli-0.8.3.dist-info → qbraid_cli-0.8.4.dist-info}/RECORD +10 -10
- {qbraid_cli-0.8.3.dist-info → qbraid_cli-0.8.4.dist-info}/WHEEL +1 -1
- {qbraid_cli-0.8.3.dist-info → qbraid_cli-0.8.4.dist-info}/LICENSE +0 -0
- {qbraid_cli-0.8.3.dist-info → qbraid_cli-0.8.4.dist-info}/entry_points.txt +0 -0
- {qbraid_cli-0.8.3.dist-info → qbraid_cli-0.8.4.dist-info}/top_level.txt +0 -0
qbraid_cli/_version.py
CHANGED
qbraid_cli/envs/create.py
CHANGED
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
Module supporting 'qbraid envs create' command.
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
|
-
import json
|
|
9
|
-
import os
|
|
10
|
-
import shutil
|
|
11
|
-
import sys
|
|
12
8
|
|
|
13
9
|
|
|
14
10
|
def create_venv(*args, **kwargs) -> None:
|
|
@@ -20,42 +16,14 @@ def create_venv(*args, **kwargs) -> None:
|
|
|
20
16
|
|
|
21
17
|
def update_state_json(*ags, **kwargs) -> None:
|
|
22
18
|
"""Update the state.json file for the qBraid environment."""
|
|
23
|
-
from qbraid_core.services.environments.state import
|
|
19
|
+
from qbraid_core.services.environments.state import update_state_json as update_state
|
|
24
20
|
|
|
25
|
-
return
|
|
21
|
+
return update_state(*ags, **kwargs)
|
|
26
22
|
|
|
27
23
|
|
|
28
24
|
def create_qbraid_env_assets(slug: str, alias: str, kernel_name: str, slug_path: str) -> None:
|
|
29
25
|
"""Create a qBraid environment including python venv, PS1 configs,
|
|
30
26
|
kernel resource files, and qBraid state.json."""
|
|
31
|
-
from
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
os.makedirs(local_resource_dir, exist_ok=True)
|
|
35
|
-
|
|
36
|
-
# create state.json
|
|
37
|
-
update_state_json(slug_path, 0, 0, env_name=alias)
|
|
38
|
-
|
|
39
|
-
# create kernel.json
|
|
40
|
-
kernel_json_path = os.path.join(local_resource_dir, "kernel.json")
|
|
41
|
-
kernel_spec_manager = KernelSpecManager()
|
|
42
|
-
kernelspec_dict = kernel_spec_manager.get_all_specs()
|
|
43
|
-
kernel_data = kernelspec_dict["python3"]["spec"]
|
|
44
|
-
if sys.platform == "win32":
|
|
45
|
-
python_exec_path = os.path.join(slug_path, "pyenv", "Scripts", "python.exe")
|
|
46
|
-
else:
|
|
47
|
-
python_exec_path = os.path.join(slug_path, "pyenv", "bin", "python")
|
|
48
|
-
kernel_data["argv"][0] = python_exec_path
|
|
49
|
-
kernel_data["display_name"] = kernel_name
|
|
50
|
-
with open(kernel_json_path, "w", encoding="utf-8") as file:
|
|
51
|
-
json.dump(kernel_data, file, indent=4)
|
|
52
|
-
|
|
53
|
-
# copy logo files
|
|
54
|
-
sys_resource_dir = kernelspec_dict["python3"]["resource_dir"]
|
|
55
|
-
logo_files = ["logo-32x32.png", "logo-64x64.png", "logo-svg.svg"]
|
|
56
|
-
|
|
57
|
-
for file in logo_files:
|
|
58
|
-
sys_path = os.path.join(sys_resource_dir, file)
|
|
59
|
-
loc_path = os.path.join(local_resource_dir, file)
|
|
60
|
-
if os.path.isfile(sys_path):
|
|
61
|
-
shutil.copy(sys_path, loc_path)
|
|
27
|
+
from qbraid_core.services.environments.create import create_qbraid_env_assets as create_assets
|
|
28
|
+
|
|
29
|
+
return create_assets(slug, alias, kernel_name, slug_path)
|
qbraid_cli/kernels/app.py
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
# All rights reserved.
|
|
3
3
|
|
|
4
4
|
"""
|
|
5
|
-
Module defining commands in the 'qbraid
|
|
5
|
+
Module defining commands in the 'qbraid kernels' namespace.
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
|
-
import sys
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
|
|
11
8
|
import typer
|
|
12
|
-
from jupyter_client.kernelspec import KernelSpecManager
|
|
13
9
|
from rich.console import Console
|
|
14
10
|
|
|
15
11
|
from qbraid_cli.handlers import handle_error
|
|
@@ -17,33 +13,14 @@ from qbraid_cli.handlers import handle_error
|
|
|
17
13
|
kernels_app = typer.Typer(help="Manage qBraid kernels.")
|
|
18
14
|
|
|
19
15
|
|
|
20
|
-
def _get_kernels_path(environment: str) -> Path:
|
|
21
|
-
"""Get the path to the kernels directory for the given environment."""
|
|
22
|
-
# pylint: disable-next=import-outside-toplevel
|
|
23
|
-
from qbraid_core.services.environments.paths import installed_envs_data
|
|
24
|
-
|
|
25
|
-
slug_to_path, name_to_slug = installed_envs_data()
|
|
26
|
-
|
|
27
|
-
if environment in name_to_slug:
|
|
28
|
-
slug = name_to_slug.get(environment, None)
|
|
29
|
-
else:
|
|
30
|
-
slug = environment
|
|
31
|
-
|
|
32
|
-
if slug not in slug_to_path:
|
|
33
|
-
raise ValueError(f"Environment '{environment}' not found.")
|
|
34
|
-
|
|
35
|
-
env_path = slug_to_path[slug]
|
|
36
|
-
kernels_path = env_path / "kernels"
|
|
37
|
-
return kernels_path
|
|
38
|
-
|
|
39
|
-
|
|
40
16
|
@kernels_app.command(name="list")
|
|
41
17
|
def kernels_list():
|
|
42
18
|
"""List all available kernels."""
|
|
43
|
-
|
|
19
|
+
from qbraid_core.services.environments.kernels import get_all_kernels
|
|
44
20
|
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
console = Console()
|
|
22
|
+
# Get the list of kernelspecs
|
|
23
|
+
kernelspecs: dict = get_all_kernels()
|
|
47
24
|
|
|
48
25
|
if len(kernelspecs) == 0:
|
|
49
26
|
console.print("No qBraid kernels are active.")
|
|
@@ -53,14 +30,18 @@ def kernels_list():
|
|
|
53
30
|
longest_kernel_name = max(len(kernel_name) for kernel_name in kernelspecs)
|
|
54
31
|
spacing = longest_kernel_name + 10
|
|
55
32
|
|
|
56
|
-
output_lines = [
|
|
33
|
+
output_lines = []
|
|
34
|
+
output_lines.append("# qbraid kernels:")
|
|
35
|
+
output_lines.append("#")
|
|
36
|
+
output_lines.append("")
|
|
57
37
|
|
|
38
|
+
# Ensure 'python3' kernel is printed first if it exists
|
|
58
39
|
default_kernel_name = "python3"
|
|
59
40
|
python3_kernel_info = kernelspecs.pop(default_kernel_name, None)
|
|
60
41
|
if python3_kernel_info:
|
|
61
|
-
|
|
62
|
-
output_lines.append(
|
|
63
|
-
|
|
42
|
+
line = f"{default_kernel_name.ljust(spacing)}{python3_kernel_info['resource_dir']}"
|
|
43
|
+
output_lines.append(line)
|
|
44
|
+
# print rest of the kernels
|
|
64
45
|
for kernel_name, kernel_info in sorted(kernelspecs.items()):
|
|
65
46
|
line = f"{kernel_name.ljust(spacing)}{kernel_info['resource_dir']}"
|
|
66
47
|
output_lines.append(line)
|
|
@@ -77,20 +58,18 @@ def kernels_add(
|
|
|
77
58
|
)
|
|
78
59
|
):
|
|
79
60
|
"""Add a kernel."""
|
|
61
|
+
from qbraid_core.services.environments.kernels import add_kernels
|
|
80
62
|
|
|
81
63
|
try:
|
|
82
|
-
|
|
64
|
+
add_kernels(environment)
|
|
83
65
|
except ValueError:
|
|
84
|
-
handle_error(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
resource_path = str(Path.home() / ".local") if is_local else sys.prefix
|
|
66
|
+
handle_error(
|
|
67
|
+
message="Failed to add kernel(s). Please verify that the environment exists.",
|
|
68
|
+
include_traceback=True,
|
|
69
|
+
)
|
|
89
70
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
for kernel in kernels_path.iterdir():
|
|
93
|
-
kernel_spec_manager.install_kernel_spec(source_dir=str(kernel), prefix=resource_path)
|
|
71
|
+
console = Console()
|
|
72
|
+
console.print(f"\nSuccessfully added '{environment}' kernel(s).", highlight=False)
|
|
94
73
|
|
|
95
74
|
|
|
96
75
|
@kernels_app.command(name="remove")
|
|
@@ -101,16 +80,18 @@ def kernels_remove(
|
|
|
101
80
|
)
|
|
102
81
|
):
|
|
103
82
|
"""Remove a kernel."""
|
|
83
|
+
from qbraid_core.services.environments.kernels import remove_kernels
|
|
84
|
+
|
|
104
85
|
try:
|
|
105
|
-
|
|
86
|
+
remove_kernels(environment)
|
|
106
87
|
except ValueError:
|
|
107
|
-
handle_error(
|
|
108
|
-
|
|
88
|
+
handle_error(
|
|
89
|
+
message="Failed to remove kernel(s). Please verify that the environment exists.",
|
|
90
|
+
include_traceback=True,
|
|
91
|
+
)
|
|
109
92
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
for kernel in kernels_path.iterdir():
|
|
113
|
-
kernel_spec_manager.remove_kernel_spec(kernel.name)
|
|
93
|
+
console = Console()
|
|
94
|
+
console.print(f"\nSuccessfully removed '{environment}' kernel(s).", highlight=False)
|
|
114
95
|
|
|
115
96
|
|
|
116
97
|
if __name__ == "__main__":
|
qbraid_cli/main.py
CHANGED
|
@@ -59,7 +59,7 @@ def show_banner():
|
|
|
59
59
|
typer.echo("")
|
|
60
60
|
typer.echo("- Use 'qbraid --version' to see the current version.")
|
|
61
61
|
typer.echo("")
|
|
62
|
-
typer.echo("Reference Docs: https://docs.qbraid.com/
|
|
62
|
+
typer.echo("Reference Docs: https://docs.qbraid.com/cli/api-reference/qbraid")
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
@app.callback(invoke_without_command=True)
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qbraid-cli
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.4
|
|
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
|
|
7
|
-
Project-URL: Homepage, https://
|
|
8
|
-
Project-URL: Documentation, https://docs.qbraid.com/
|
|
9
|
-
Project-URL: Bug Tracker, https://github.com/qBraid/
|
|
7
|
+
Project-URL: Homepage, https://docs.qbraid.com/cli/user-guide/overview
|
|
8
|
+
Project-URL: Documentation, https://docs.qbraid.com/cli/api-reference/qbraid
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/qBraid/community/issues
|
|
10
10
|
Project-URL: Discord, https://discord.gg/KugF6Cnncm
|
|
11
|
-
Project-URL: Launch on Lab, https://account.qbraid.com/?gitHubUrl=https://github.com/qBraid/qBraid-Lab.git
|
|
12
11
|
Keywords: qbraid,cli,quantum,cloud
|
|
13
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
13
|
Classifier: Intended Audience :: Developers
|
|
@@ -29,9 +28,7 @@ Description-Content-Type: text/markdown
|
|
|
29
28
|
License-File: LICENSE
|
|
30
29
|
Requires-Dist: typer >=0.12.1
|
|
31
30
|
Requires-Dist: rich >=10.11.0
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist: ipykernel
|
|
34
|
-
Requires-Dist: qbraid-core >=0.1.16
|
|
31
|
+
Requires-Dist: qbraid-core[environments] >=0.1.17
|
|
35
32
|
Provides-Extra: dev
|
|
36
33
|
Requires-Dist: ruff ; extra == 'dev'
|
|
37
34
|
Requires-Dist: isort ; extra == 'dev'
|
|
@@ -43,15 +40,16 @@ Requires-Dist: amazon-braket-sdk >=1.48.1 ; extra == 'jobs'
|
|
|
43
40
|
|
|
44
41
|
<img width="full" alt="qbraid_cli" src="https://qbraid-static.s3.amazonaws.com/logos/qbraid-cli-banner.png">
|
|
45
42
|
|
|
46
|
-
[](https://docs.qbraid.com/
|
|
43
|
+
[](https://docs.qbraid.com/cli/user-guide/overview)
|
|
47
44
|
[](https://pypi.org/project/qbraid-cli/)
|
|
48
45
|
[](https://pypi.org/project/qbraid-cli/)
|
|
49
46
|
[](https://pepy.tech/project/qbraid-cli)
|
|
50
|
-
[](https://github.com/qBraid/
|
|
47
|
+
[](https://github.com/qBraid/community/issues)
|
|
48
|
+
[](https://stackoverflow.com/questions/tagged/qbraid)
|
|
51
49
|
|
|
52
50
|
Command Line Interface for interacting with all parts of the qBraid platform.
|
|
53
51
|
|
|
54
|
-
The **qBraid CLI** is a versatile command-line interface tool designed for seamless interaction with qBraid cloud services and quantum software management tools. Initially exclusive to the [qBraid Lab](https://docs.qbraid.com/
|
|
52
|
+
The **qBraid CLI** is a versatile command-line interface tool designed for seamless interaction with qBraid cloud services and quantum software management tools. Initially exclusive to the [qBraid Lab](https://docs.qbraid.com/lab/user-guide/overview) platform, the CLI now supports local installations as well. This enhancement broadens access to features like [qBraid Quantum Jobs](https://docs.qbraid.com/cli/user-guide/quantum-jobs), enabling direct acess to QPU devices from leading providers like IonQ, Oxford Quantum Circuits, QuEra, Rigetti, and IQM, as well as on-demand simulators from qBraid and AWS, all using qBraid [credits](https://docs.qbraid.com/home/pricing), with no additional access keys required.
|
|
55
53
|
|
|
56
54
|
## Getting Started
|
|
57
55
|
|
|
@@ -60,7 +58,7 @@ The qBraid-CLI comes pre-installed and pre-configured in qBraid Lab:
|
|
|
60
58
|
- [Launch qBraid Lab →](https://lab.qbraid.com/)
|
|
61
59
|
- [Make an account →](https://account.qbraid.com/)
|
|
62
60
|
|
|
63
|
-
For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/
|
|
61
|
+
For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/lab/user-guide/getting-started).
|
|
64
62
|
|
|
65
63
|
You can also install the qBraid-CLI from PyPI with:
|
|
66
64
|
|
|
@@ -102,7 +100,7 @@ $ qbraid
|
|
|
102
100
|
|
|
103
101
|
- Use 'qbraid --version' to see the current version.
|
|
104
102
|
|
|
105
|
-
Reference Docs: https://docs.qbraid.com/
|
|
103
|
+
Reference Docs: https://docs.qbraid.com/cli/api-reference/qbraid
|
|
106
104
|
```
|
|
107
105
|
|
|
108
106
|
A qBraid CLI command has the following structure:
|
|
@@ -157,7 +155,7 @@ $ qbraid --version
|
|
|
157
155
|
|
|
158
156
|
## Magic Commands
|
|
159
157
|
|
|
160
|
-
You can also access the CLI directly from within [Notebooks](https://docs.qbraid.com/
|
|
158
|
+
You can also access the CLI directly from within [Notebooks](https://docs.qbraid.com/lab/user-guide/notebooks) using IPython [magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html). First, configure the qBraid magic commands extension using:
|
|
161
159
|
|
|
162
160
|
```bash
|
|
163
161
|
$ qbraid configure magic
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
qbraid_cli/_version.py,sha256=
|
|
2
|
+
qbraid_cli/_version.py,sha256=PMm9ylBdHQbMfMeqt83bqKEQZB8k6HGxOL3Vb7FS13g,411
|
|
3
3
|
qbraid_cli/exceptions.py,sha256=KjlhYJhSHMVazaNiBjD_Ur06w4sekP8zRsFzBdyIpno,672
|
|
4
4
|
qbraid_cli/handlers.py,sha256=glxTEwxax3zKgYl9qsZ2evZXgrWQrseJS_OGyHTMFeA,7040
|
|
5
|
-
qbraid_cli/main.py,sha256=
|
|
5
|
+
qbraid_cli/main.py,sha256=AR6qp2hU_3OEg1_RxRSfZkO2ZC3H4z-dz3hzaqeAl-I,2620
|
|
6
6
|
qbraid_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
qbraid_cli/admin/__init__.py,sha256=qcWD5mQEUCtr49mrUpZmk7eGDe0L_Gtc8RwZmzIXSwo,175
|
|
8
8
|
qbraid_cli/admin/app.py,sha256=ZyTBkEvlAR-xK3fbC32yntsE3rywzL4WHjJzRTFTlzs,1454
|
|
@@ -20,20 +20,20 @@ qbraid_cli/devices/validation.py,sha256=YhShyUufgrKnx2XjXOXF-PqFJYklJT9CgeqIwKcN
|
|
|
20
20
|
qbraid_cli/envs/__init__.py,sha256=1-cMvrATsddYxcetPJWxq6bEOqJWMktGdhoZ4qm8euA,172
|
|
21
21
|
qbraid_cli/envs/activate.py,sha256=VpvVYSfQDlcmlNWJOgkLIQ2p8YXPPLG8Jbl5t8GHUDw,2140
|
|
22
22
|
qbraid_cli/envs/app.py,sha256=m1obCHrTqSPD8CF2v-jV7ZoCXdRyky1oZHl7NR2EAG4,8447
|
|
23
|
-
qbraid_cli/envs/create.py,sha256=
|
|
23
|
+
qbraid_cli/envs/create.py,sha256=xudzkLCNegY34zkXN_Vfl_0zVzg_tW83LcVx9quoWfU,988
|
|
24
24
|
qbraid_cli/envs/data_handling.py,sha256=Ibnp2yJoUDpivb_sNqi0suYgJZNat_LmM6Ya0Ovez5s,1288
|
|
25
25
|
qbraid_cli/jobs/__init__.py,sha256=qVLRHYIzP4XHpx_QWP_vCzd3LsCscCORaEx-Vcbx29U,172
|
|
26
26
|
qbraid_cli/jobs/app.py,sha256=kmg9mYla3Nd7EdjQlFu7IOvm7sejLNfPPA6Qeet-IfE,4898
|
|
27
27
|
qbraid_cli/jobs/toggle_braket.py,sha256=QVW69MkFyhMZWg_Cl48GgScC084aAG3EgYbyy-PGkqI,6756
|
|
28
28
|
qbraid_cli/jobs/validation.py,sha256=xNbjUggMhUs4wzkuRm4PuFPi_wrElYicUgYXLznHz3U,2983
|
|
29
29
|
qbraid_cli/kernels/__init__.py,sha256=jORS9vV17s5laQyq8gSVB18EPBImgEIbMZ1wKC094DA,181
|
|
30
|
-
qbraid_cli/kernels/app.py,sha256=
|
|
30
|
+
qbraid_cli/kernels/app.py,sha256=FedFpQBvK-5Fk7PTGskCHz0l8zIb7E7ex8M6UzobfKA,2923
|
|
31
31
|
qbraid_cli/pip/__init__.py,sha256=tJtU0rxn-ODogNh5Y4pp_BgDQXMN-3JY1QGj0OZHwjQ,169
|
|
32
32
|
qbraid_cli/pip/app.py,sha256=Cer_Tteo_k26bTNiLUX2k-XhdSU3wKuj9ZLubbGv7r4,1439
|
|
33
33
|
qbraid_cli/pip/hooks.py,sha256=KuDHmntPXVK8tSb4MLk9VANhL-eINswhLd8_g_25WMY,2123
|
|
34
|
-
qbraid_cli-0.8.
|
|
35
|
-
qbraid_cli-0.8.
|
|
36
|
-
qbraid_cli-0.8.
|
|
37
|
-
qbraid_cli-0.8.
|
|
38
|
-
qbraid_cli-0.8.
|
|
39
|
-
qbraid_cli-0.8.
|
|
34
|
+
qbraid_cli-0.8.4.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
|
|
35
|
+
qbraid_cli-0.8.4.dist-info/METADATA,sha256=I3EoQXD1hpbUhVf85Vy9ZNY3VdOJRa2uRMtJDZsLM7o,6715
|
|
36
|
+
qbraid_cli-0.8.4.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
37
|
+
qbraid_cli-0.8.4.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
|
|
38
|
+
qbraid_cli-0.8.4.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
|
|
39
|
+
qbraid_cli-0.8.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|