qbraid-cli 0.8.3__py3-none-any.whl → 0.8.4a0__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.
qbraid_cli/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.8.3'
16
- __version_tuple__ = version_tuple = (0, 8, 3)
15
+ __version__ = version = '0.8.4a0'
16
+ __version_tuple__ = version_tuple = (0, 8, 4)
qbraid_cli/envs/create.py CHANGED
@@ -28,34 +28,6 @@ def update_state_json(*ags, **kwargs) -> None:
28
28
  def create_qbraid_env_assets(slug: str, alias: str, kernel_name: str, slug_path: str) -> None:
29
29
  """Create a qBraid environment including python venv, PS1 configs,
30
30
  kernel resource files, and qBraid state.json."""
31
- from jupyter_client.kernelspec import KernelSpecManager
32
-
33
- local_resource_dir = os.path.join(slug_path, "kernels", f"python3_{slug}")
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)
31
+ from qbraid_core.services.environments.create import create_qbraid_env_assets
32
+
33
+ return create_qbraid_env_assets(slug, alias, kernel_name, slug_path)
qbraid_cli/kernels/app.py CHANGED
@@ -5,11 +5,10 @@
5
5
  Module defining commands in the 'qbraid jobs' namespace.
6
6
 
7
7
  """
8
- import sys
9
8
  from pathlib import Path
10
9
 
11
10
  import typer
12
- from jupyter_client.kernelspec import KernelSpecManager
11
+ from qbraid_core.services.environments.kernels import add_kernels, list_kernels, remove_kernels
13
12
  from rich.console import Console
14
13
 
15
14
  from qbraid_cli.handlers import handle_error
@@ -17,33 +16,12 @@ from qbraid_cli.handlers import handle_error
17
16
  kernels_app = typer.Typer(help="Manage qBraid kernels.")
18
17
 
19
18
 
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
19
  @kernels_app.command(name="list")
41
20
  def kernels_list():
42
21
  """List all available kernels."""
43
22
  console = Console()
44
-
45
- kernel_spec_manager = KernelSpecManager()
46
- kernelspecs = kernel_spec_manager.get_all_specs()
23
+ # Get the list of kernelspecs
24
+ kernelspecs = list_kernels()
47
25
 
48
26
  if len(kernelspecs) == 0:
49
27
  console.print("No qBraid kernels are active.")
@@ -53,21 +31,16 @@ def kernels_list():
53
31
  longest_kernel_name = max(len(kernel_name) for kernel_name in kernelspecs)
54
32
  spacing = longest_kernel_name + 10
55
33
 
56
- output_lines = ["# qbraid kernels:\n#\n"]
34
+ console.print("# qbraid kernels:\n#\n")
57
35
 
36
+ # Ensure 'python3' kernel is printed first if it exists
58
37
  default_kernel_name = "python3"
59
38
  python3_kernel_info = kernelspecs.pop(default_kernel_name, None)
60
39
  if python3_kernel_info:
61
- python3_line = f"{default_kernel_name.ljust(spacing)}{python3_kernel_info['resource_dir']}"
62
- output_lines.append(python3_line)
63
-
40
+ console.print(f"{default_kernel_name.ljust(spacing)}{python3_kernel_info['resource_dir']}")
41
+ # print rest of the kernels
64
42
  for kernel_name, kernel_info in sorted(kernelspecs.items()):
65
- line = f"{kernel_name.ljust(spacing)}{kernel_info['resource_dir']}"
66
- output_lines.append(line)
67
-
68
- final_output = "\n".join(output_lines)
69
-
70
- console.print(final_output)
43
+ console.print(f"{kernel_name.ljust(spacing)}{kernel_info['resource_dir']}")
71
44
 
72
45
 
73
46
  @kernels_app.command(name="add")
@@ -79,19 +52,14 @@ def kernels_add(
79
52
  """Add a kernel."""
80
53
 
81
54
  try:
82
- kernels_path = _get_kernels_path(environment)
83
- except ValueError:
84
- handle_error(message=f"Environment '{environment}' not found.", include_traceback=False)
55
+ add_kernels(environment)
56
+ except ValueError as e:
57
+ handle_error(
58
+ message=e,
59
+ include_traceback=False,
60
+ )
85
61
  return
86
62
 
87
- is_local = str(kernels_path).startswith(str(Path.home()))
88
- resource_path = str(Path.home() / ".local") if is_local else sys.prefix
89
-
90
- kernel_spec_manager = KernelSpecManager()
91
-
92
- for kernel in kernels_path.iterdir():
93
- kernel_spec_manager.install_kernel_spec(source_dir=str(kernel), prefix=resource_path)
94
-
95
63
 
96
64
  @kernels_app.command(name="remove")
97
65
  def kernels_remove(
@@ -102,16 +70,11 @@ def kernels_remove(
102
70
  ):
103
71
  """Remove a kernel."""
104
72
  try:
105
- kernels_path = _get_kernels_path(environment)
73
+ remove_kernels(environment)
106
74
  except ValueError:
107
75
  handle_error(message=f"Environment '{environment}' not found.", include_traceback=False)
108
76
  return
109
77
 
110
- kernel_spec_manager = KernelSpecManager()
111
-
112
- for kernel in kernels_path.iterdir():
113
- kernel_spec_manager.remove_kernel_spec(kernel.name)
114
-
115
78
 
116
79
  if __name__ == "__main__":
117
80
  kernels_app()
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/projects/cli/en/stable/guide/overview.html")
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,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.8.3
3
+ Version: 0.8.4a0
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://www.qbraid.com/
8
- Project-URL: Documentation, https://docs.qbraid.com/projects/cli/en/stable/guide/overview.html
9
- Project-URL: Bug Tracker, https://github.com/qBraid/qBraid-Lab/issues
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
11
+ Project-URL: Launch on Lab, https://account.qbraid.com/?gitHubUrl=https://github.com/qBraid/.git
12
12
  Keywords: qbraid,cli,quantum,cloud
13
13
  Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Intended Audience :: Developers
@@ -29,9 +29,7 @@ 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: jupyter-client <9.0.0,>=7.0.0
33
- Requires-Dist: ipykernel
34
- Requires-Dist: qbraid-core >=0.1.16
32
+ Requires-Dist: qbraid-core[environments] ==0.1.17a0
35
33
  Provides-Extra: dev
36
34
  Requires-Dist: ruff ; extra == 'dev'
37
35
  Requires-Dist: isort ; extra == 'dev'
@@ -43,15 +41,16 @@ Requires-Dist: amazon-braket-sdk >=1.48.1 ; extra == 'jobs'
43
41
 
44
42
  <img width="full" alt="qbraid_cli" src="https://qbraid-static.s3.amazonaws.com/logos/qbraid-cli-banner.png">
45
43
 
46
- [![Documentation](https://img.shields.io/badge/Documentation-DF0982)](https://docs.qbraid.com/projects/cli/en/stable/guide/overview.html)
44
+ [![Documentation](https://img.shields.io/badge/Documentation-DF0982)](https://docs.qbraid.com/cli/user-guide/overview)
47
45
  [![PyPI version](https://img.shields.io/pypi/v/qbraid-cli.svg?color=blue)](https://pypi.org/project/qbraid-cli/)
48
46
  [![Python verions](https://img.shields.io/pypi/pyversions/qbraid-cli.svg?color=blue)](https://pypi.org/project/qbraid-cli/)
49
47
  [![Downloads](https://static.pepy.tech/badge/qbraid-cli)](https://pepy.tech/project/qbraid-cli)
50
- [![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/qBraid/qBraid-Lab/issues)
48
+ [![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/qBraid/community/issues)
49
+ [![Stack Overflow](https://img.shields.io/badge/StackOverflow-qbraid-orange?logo=stackoverflow)](https://stackoverflow.com/questions/tagged/qbraid)
51
50
 
52
51
  Command Line Interface for interacting with all parts of the qBraid platform.
53
52
 
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/projects/lab/en/latest/lab/overview.html) platform, the CLI now supports local installations as well. This enhancement broadens access to features like [qBraid Quantum Jobs](https://docs.qbraid.com/projects/lab/en/latest/lab/quantum_jobs.html), 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 AWS, all using qBraid credits, with no additional access keys required.
53
+ 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
54
 
56
55
  ## Getting Started
57
56
 
@@ -60,7 +59,7 @@ The qBraid-CLI comes pre-installed and pre-configured in qBraid Lab:
60
59
  - [Launch qBraid Lab &rarr;](https://lab.qbraid.com/)
61
60
  - [Make an account &rarr;](https://account.qbraid.com/)
62
61
 
63
- For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/projects/lab/en/latest/lab/getting_started.html).
62
+ For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/lab/user-guide/getting-started).
64
63
 
65
64
  You can also install the qBraid-CLI from PyPI with:
66
65
 
@@ -102,7 +101,7 @@ $ qbraid
102
101
 
103
102
  - Use 'qbraid --version' to see the current version.
104
103
 
105
- Reference Docs: https://docs.qbraid.com/projects/cli/en/stable/guide/overview.html
104
+ Reference Docs: https://docs.qbraid.com/cli/api-reference/qbraid
106
105
  ```
107
106
 
108
107
  A qBraid CLI command has the following structure:
@@ -157,7 +156,7 @@ $ qbraid --version
157
156
 
158
157
  ## Magic Commands
159
158
 
160
- You can also access the CLI directly from within [Notebooks](https://docs.qbraid.com/projects/lab/en/latest/lab/notebooks.html) using IPython [magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html). First, configure the qBraid magic commands extension using:
159
+ 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
160
 
162
161
  ```bash
163
162
  $ qbraid configure magic
@@ -1,8 +1,8 @@
1
1
  qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- qbraid_cli/_version.py,sha256=PNJoCh_Xu8X2ZZy-EA7kXABRDndslRLGoRtvfJaj5qs,411
2
+ qbraid_cli/_version.py,sha256=DwxZYWf2zCv6KexzcADTVsrPQT7fKqDMptvMyhll1Ug,413
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=eRgBEYj9WPxHqTbSQvlV39yaDje-6yvZdrTnw5UQbQY,2638
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=HxNciItDoGC5jqiruHm0oUfNSqtuDfzE-ro4ztGUh5Q,2185
23
+ qbraid_cli/envs/create.py,sha256=GlVMPK_Rurvj03tPzdVBD1HtTkz9_LfiH_tXC6PbZ1Q,1026
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=voLQR8DVqvH3W_rhxkkLg9MPd-ahA3jZ41WwupvSmNY,3490
30
+ qbraid_cli/kernels/app.py,sha256=PgTd_hPYEKa3AxCsE3LHC5nISx4aqcGvftXVIHmoX-c,2282
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.3.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
35
- qbraid_cli-0.8.3.dist-info/METADATA,sha256=7kruHoU8Q6BeeS6xCo-quPQHoqgyrrOJPYPU9Lc2IX0,6780
36
- qbraid_cli-0.8.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
37
- qbraid_cli-0.8.3.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
38
- qbraid_cli-0.8.3.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
39
- qbraid_cli-0.8.3.dist-info/RECORD,,
34
+ qbraid_cli-0.8.4a0.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
35
+ qbraid_cli-0.8.4a0.dist-info/METADATA,sha256=u37RFYpijtSZNSW-KO2GEHrx8Rb1yjHAec3jTfVQSj4,6816
36
+ qbraid_cli-0.8.4a0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
37
+ qbraid_cli-0.8.4a0.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
38
+ qbraid_cli-0.8.4a0.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
39
+ qbraid_cli-0.8.4a0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5