qbraid-cli 0.7.0__py3-none-any.whl → 0.8.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.

Files changed (39) hide show
  1. qbraid_cli/_version.py +14 -5
  2. qbraid_cli/admin/__init__.py +9 -0
  3. qbraid_cli/admin/app.py +50 -0
  4. qbraid_cli/admin/headers.py +193 -0
  5. qbraid_cli/admin/validation.py +33 -0
  6. qbraid_cli/configure/__init__.py +9 -0
  7. qbraid_cli/configure/actions.py +111 -0
  8. qbraid_cli/configure/app.py +77 -0
  9. qbraid_cli/credits/__init__.py +9 -0
  10. qbraid_cli/credits/app.py +32 -0
  11. qbraid_cli/devices/__init__.py +9 -0
  12. qbraid_cli/devices/app.py +80 -0
  13. qbraid_cli/devices/validation.py +26 -0
  14. qbraid_cli/envs/__init__.py +9 -0
  15. qbraid_cli/envs/activate.py +65 -0
  16. qbraid_cli/envs/app.py +270 -0
  17. qbraid_cli/envs/create.py +128 -0
  18. qbraid_cli/envs/data_handling.py +140 -0
  19. qbraid_cli/exceptions.py +24 -0
  20. qbraid_cli/handlers.py +168 -0
  21. qbraid_cli/jobs/__init__.py +9 -0
  22. qbraid_cli/jobs/app.py +149 -0
  23. qbraid_cli/jobs/toggle_braket.py +185 -0
  24. qbraid_cli/jobs/validation.py +93 -0
  25. qbraid_cli/kernels/__init__.py +9 -0
  26. qbraid_cli/kernels/app.py +111 -0
  27. qbraid_cli/main.py +80 -0
  28. qbraid_cli-0.8.0.dist-info/METADATA +143 -0
  29. qbraid_cli-0.8.0.dist-info/RECORD +33 -0
  30. {qbraid_cli-0.7.0.dist-info → qbraid_cli-0.8.0.dist-info}/WHEEL +1 -1
  31. qbraid_cli-0.8.0.dist-info/entry_points.txt +2 -0
  32. qbraid_cli/bin/qbraid.sh +0 -1317
  33. qbraid_cli/configure.py +0 -87
  34. qbraid_cli/wrapper.py +0 -91
  35. qbraid_cli-0.7.0.data/scripts/qbraid.sh +0 -1317
  36. qbraid_cli-0.7.0.dist-info/METADATA +0 -118
  37. qbraid_cli-0.7.0.dist-info/RECORD +0 -11
  38. qbraid_cli-0.7.0.dist-info/entry_points.txt +0 -2
  39. {qbraid_cli-0.7.0.dist-info → qbraid_cli-0.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,111 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Module defining commands in the 'qbraid jobs' namespace.
6
+
7
+ """
8
+ import sys
9
+ from pathlib import Path
10
+
11
+ import typer
12
+ from jupyter_client.kernelspec import KernelSpecManager
13
+ from rich.console import Console
14
+
15
+ from qbraid_cli.envs.data_handling import installed_envs_data
16
+ from qbraid_cli.handlers import handle_error
17
+
18
+ kernels_app = typer.Typer(help="Manage qBraid kernels.")
19
+
20
+
21
+ def _get_kernels_path(environment: str) -> Path:
22
+ """Get the path to the kernels directory for the given environment."""
23
+ slug_to_path, name_to_slug = installed_envs_data()
24
+
25
+ if environment in name_to_slug:
26
+ slug = name_to_slug.get(environment, None)
27
+ else:
28
+ slug = environment
29
+
30
+ if slug not in slug_to_path:
31
+ raise ValueError(f"Environment '{environment}' not found.")
32
+
33
+ env_path = slug_to_path[slug]
34
+ kernels_path = env_path / "kernels"
35
+ return kernels_path
36
+
37
+
38
+ @kernels_app.command(name="list")
39
+ def kernels_list():
40
+ """List all available kernels."""
41
+ console = Console()
42
+
43
+ kernel_spec_manager = KernelSpecManager()
44
+ kernelspecs = kernel_spec_manager.get_all_specs()
45
+
46
+ if len(kernelspecs) == 0:
47
+ console.print("No qBraid kernels are active.")
48
+ console.print("\nUse 'qbraid kernels add' to add a new kernel.")
49
+ return
50
+
51
+ longest_kernel_name = max(len(kernel_name) for kernel_name in kernelspecs)
52
+ spacing = longest_kernel_name + 10
53
+
54
+ console.print("# qbraid kernels:\n#\n")
55
+
56
+ # Ensure 'python3' kernel is printed first if it exists
57
+ default_kernel_name = "python3"
58
+ python3_kernel_info = kernelspecs.pop(default_kernel_name, None)
59
+ if python3_kernel_info:
60
+ console.print(f"{default_kernel_name.ljust(spacing)}{python3_kernel_info['resource_dir']}")
61
+
62
+ # Print the rest of the kernels
63
+ for kernel_name, kernel_info in sorted(kernelspecs.items()):
64
+ console.print(f"{kernel_name.ljust(spacing)}{kernel_info['resource_dir']}")
65
+
66
+
67
+ @kernels_app.command(name="add")
68
+ def kernels_add(
69
+ environment: str = typer.Argument(
70
+ ..., help="Name of environment for which to add ipykernel. Values from 'qbraid envs list'."
71
+ )
72
+ ):
73
+ """Add a kernel."""
74
+
75
+ try:
76
+ kernels_path = _get_kernels_path(environment)
77
+ except ValueError:
78
+ handle_error(message=f"Environment '{environment}' not found.", include_traceback=False)
79
+ return
80
+
81
+ is_local = str(kernels_path).startswith(str(Path.home()))
82
+ resource_path = str(Path.home() / ".local") if is_local else sys.prefix
83
+
84
+ kernel_spec_manager = KernelSpecManager()
85
+
86
+ for kernel in kernels_path.iterdir():
87
+ kernel_spec_manager.install_kernel_spec(source_dir=str(kernel), prefix=resource_path)
88
+
89
+
90
+ @kernels_app.command(name="remove")
91
+ def kernels_remove(
92
+ environment: str = typer.Argument(
93
+ ...,
94
+ help=("Name of environment for which to remove ipykernel. Values from 'qbraid envs list'."),
95
+ )
96
+ ):
97
+ """Remove a kernel."""
98
+ try:
99
+ kernels_path = _get_kernels_path(environment)
100
+ except ValueError:
101
+ handle_error(message=f"Environment '{environment}' not found.", include_traceback=False)
102
+ return
103
+
104
+ kernel_spec_manager = KernelSpecManager()
105
+
106
+ for kernel in kernels_path.iterdir():
107
+ kernel_spec_manager.remove_kernel_spec(kernel.name)
108
+
109
+
110
+ if __name__ == "__main__":
111
+ kernels_app()
qbraid_cli/main.py ADDED
@@ -0,0 +1,80 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Entrypoint for the qBraid CLI.
6
+
7
+ """
8
+
9
+ import typer
10
+
11
+ from qbraid_cli.admin.app import admin_app
12
+ from qbraid_cli.configure.app import configure_app
13
+ from qbraid_cli.credits.app import credits_app
14
+ from qbraid_cli.devices.app import devices_app
15
+ from qbraid_cli.envs.app import envs_app
16
+ from qbraid_cli.jobs.app import jobs_app
17
+ from qbraid_cli.kernels.app import kernels_app
18
+
19
+ app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]})
20
+
21
+ app.add_typer(admin_app, name="admin")
22
+ app.add_typer(configure_app, name="configure")
23
+ app.add_typer(credits_app, name="credits")
24
+ app.add_typer(devices_app, name="devices")
25
+ app.add_typer(envs_app, name="envs")
26
+ app.add_typer(jobs_app, name="jobs")
27
+ app.add_typer(kernels_app, name="kernels")
28
+
29
+
30
+ def version_callback(value: bool):
31
+ """Show the version and exit."""
32
+ if value:
33
+ from ._version import __version__
34
+
35
+ typer.echo(f"qbraid-cli/{__version__}")
36
+ raise typer.Exit()
37
+
38
+
39
+ def show_banner():
40
+ """Show the qBraid CLI banner."""
41
+ typer.secho("----------------------------------", fg=typer.colors.BRIGHT_BLACK)
42
+ typer.secho(" * ", fg=typer.colors.BRIGHT_BLACK, nl=False)
43
+ typer.secho("Welcome to the qBraid CLI!", fg=typer.colors.MAGENTA, nl=False)
44
+ typer.secho(" * ", fg=typer.colors.BRIGHT_BLACK)
45
+ typer.secho("----------------------------------", fg=typer.colors.BRIGHT_BLACK)
46
+ typer.echo("")
47
+ typer.echo(" ____ _ _ ")
48
+ typer.echo(" __ _| __ ) _ __ __ _(_) __| | ")
49
+ typer.echo(r" / _` | _ \| '__/ _` | |/ _` | ")
50
+ typer.echo(" | (_| | |_) | | | (_| | | (_| | ")
51
+ typer.echo(r" \__,_|____/|_| \__,_|_|\__,_| ")
52
+ typer.echo(" |_| ")
53
+ typer.echo("")
54
+ typer.echo("")
55
+ typer.echo("- Use 'qbraid --help' to see available commands.")
56
+ typer.echo("")
57
+ typer.echo("- Use 'qbraid --version' to see the current version.")
58
+ typer.echo("")
59
+ typer.echo("Reference Docs: https://docs.qbraid.com/projects/cli/en/stable/guide/overview.html")
60
+
61
+
62
+ @app.callback(invoke_without_command=True)
63
+ def main(
64
+ ctx: typer.Context,
65
+ version: bool = typer.Option(
66
+ None,
67
+ "--version",
68
+ "-v",
69
+ callback=version_callback,
70
+ is_eager=True,
71
+ help="Show the version and exit.",
72
+ ),
73
+ ):
74
+ """The qBraid CLI."""
75
+ if ctx.invoked_subcommand is None and not version:
76
+ show_banner()
77
+
78
+
79
+ if __name__ == "__main__":
80
+ app()
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.1
2
+ Name: qbraid-cli
3
+ Version: 0.8.0
4
+ Summary: Command Line Interface for interacting with all parts of the qBraid platform.
5
+ Author-email: qBraid Development Team <contact@qbraid.com>
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
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
+ Keywords: qbraid,cli,quantum,cloud
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Natural Language :: English
16
+ Classifier: License :: Other/Proprietary License
17
+ Classifier: Intended Audience :: System Administrators
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Requires-Python: >=3.9
28
+ Description-Content-Type: text/markdown
29
+ Requires-Dist: typer >=0.12.1
30
+ Requires-Dist: rich >=10.11.0
31
+ Requires-Dist: jupyter-client <9.0.0,>=7.0.0
32
+ Requires-Dist: ipykernel
33
+ Requires-Dist: qbraid-core >=0.1.4
34
+ Provides-Extra: dev
35
+ Requires-Dist: black ; extra == 'dev'
36
+ Requires-Dist: isort ; extra == 'dev'
37
+ Requires-Dist: pylint ; extra == 'dev'
38
+ Requires-Dist: pytest ; extra == 'dev'
39
+ Provides-Extra: docs
40
+ Requires-Dist: sphinx ~=7.2.6 ; extra == 'docs'
41
+ Requires-Dist: sphinx-rtd-theme <2.1,>=1.3 ; extra == 'docs'
42
+ Requires-Dist: docutils <0.22 ; extra == 'docs'
43
+ Requires-Dist: toml ; extra == 'docs'
44
+ Requires-Dist: build ; extra == 'docs'
45
+ Requires-Dist: m2r ; extra == 'docs'
46
+ Requires-Dist: typer ; extra == 'docs'
47
+ Provides-Extra: jobs
48
+ Requires-Dist: amazon-braket-sdk >=1.48.1 ; extra == 'jobs'
49
+
50
+ <img width="full" alt="qbraid_cli" src="https://qbraid-static.s3.amazonaws.com/logos/qbraid-cli-banner.png">
51
+
52
+ [![Documentation](https://img.shields.io/badge/Documentation-DF0982)](https://docs.qbraid.com/projects/cli/en/stable/guide/overview.html)
53
+ [![PyPI version](https://img.shields.io/pypi/v/qbraid-cli.svg?color=blue)](https://pypi.org/project/qbraid-cli/)
54
+ [![Python verions](https://img.shields.io/pypi/pyversions/qbraid-cli.svg?color=blue)](https://pypi.org/project/qbraid-cli/)
55
+ [![Downloads](https://static.pepy.tech/badge/qbraid-cli)](https://pepy.tech/project/qbraid-cli)
56
+ [![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/qBraid/qBraid-Lab/issues)
57
+ [![Discord](https://img.shields.io/discord/771898982564626445.svg?color=pink)](https://discord.gg/KugF6Cnncm)
58
+
59
+ Command Line Interface for interacting with all parts of the qBraid platform.
60
+
61
+ The **qBraid CLI** is a specialized command-line interface tool designed *exclusively* for use within the [qBraid Lab](https://docs.qbraid.com/projects/lab/en/latest/lab/overview.html) platform. It is not intended for local installations or use outside the qBraid Lab environment. This tool ensures seamless integration and optimized performance specifically tailored for qBraid Lab's unique cloud-based quantum computing ecosystem.
62
+
63
+ ## Getting Started
64
+
65
+ To use the qBraid CLI, login to qBraid (or create an account), launch Lab, and then open Terminal. You can also access the CLI directly from within [Notebooks](https://docs.qbraid.com/projects/lab/en/latest/lab/notebooks.html) using the ``!`` operator. See [quantum jobs example](https://github.com/qBraid/qbraid-lab-demo/blob/045c7a8fbdcae66a7e64533dd9fe0e981dc02cf4/qbraid_lab/quantum_jobs/aws_quantum_jobs.ipynb).
66
+
67
+ - [Launch qBraid Lab &rarr;](https://lab.qbraid.com/)
68
+ - [Make an account &rarr;](https://account.qbraid.com/)
69
+
70
+ For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/projects/lab/en/latest/lab/getting_started.html).
71
+
72
+ ## Basic Commands
73
+
74
+ ```shell
75
+ $ qbraid
76
+ ----------------------------------
77
+ * Welcome to the qBraid CLI! *
78
+ ----------------------------------
79
+
80
+ ____ _ _
81
+ __ _| __ ) _ __ __ _(_) __| |
82
+ / _` | _ \| '__/ _` | |/ _` |
83
+ | (_| | |_) | | | (_| | | (_| |
84
+ \__,_|____/|_| \__,_|_|\__,_|
85
+ |_|
86
+
87
+
88
+ - Use 'qbraid --help' to see available commands.
89
+
90
+ - Use 'qbraid --version' to see the current version.
91
+
92
+ Reference Docs: https://docs.qbraid.com/projects/cli/en/stable/guide/overview.html
93
+ ```
94
+
95
+ A qBraid CLI command has the following structure:
96
+
97
+ ```shell
98
+ $ qbraid <command> <subcommand> [options and parameters]
99
+ ```
100
+
101
+ For example, to list installed environments, the command would be:
102
+
103
+ ```shell
104
+ $ qbraid envs list
105
+ ```
106
+
107
+ To view help documentation, use one of the following:
108
+
109
+ ```shell
110
+ $ qbraid --help
111
+ $ qbraid <command> --help
112
+ $ qbraid <command> <subcommand> --help
113
+ ```
114
+
115
+ For example:
116
+
117
+ ```shell
118
+ $ qbraid --help
119
+
120
+ Usage: qbraid [OPTIONS] COMMAND [ARGS]...
121
+
122
+ The qBraid CLI.
123
+
124
+ Options
125
+ --version Show the version and exit.
126
+ --install-completion Install completion for the current shell.
127
+ --show-completion Show completion for the current shell, to copy it or customize the installation.
128
+ --help Show this message and exit.
129
+
130
+ Commands
131
+ configure Configure qBraid CLI options.
132
+ credits Manage qBraid credits.
133
+ devices Manage qBraid quantum devices.
134
+ envs Manage qBraid environments.
135
+ jobs Manage qBraid quantum jobs.
136
+ kernels Manage qBraid kernels.
137
+ ```
138
+
139
+ To get the version of the qBraid CLI:
140
+
141
+ ```shell
142
+ $ qbraid --version
143
+ ```
@@ -0,0 +1,33 @@
1
+ qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ qbraid_cli/_version.py,sha256=vspFLRfYI6gAAN7kyihey2lhPos0jxqKaNDWFlKPlmU,411
3
+ qbraid_cli/exceptions.py,sha256=KjlhYJhSHMVazaNiBjD_Ur06w4sekP8zRsFzBdyIpno,672
4
+ qbraid_cli/handlers.py,sha256=i3vdRtdy4bZKg3j6fwfVMz1ddhMgzlc2hhmj-vewxpI,6542
5
+ qbraid_cli/main.py,sha256=IRKazFqtFpoiq_xOtqb-IXDKAVs4lacFIRCQCoiGNF4,2503
6
+ qbraid_cli/admin/__init__.py,sha256=Suo_L1_yBodCvLM_fpw8gRIhD4mVVOXKObtxeoMaBVo,150
7
+ qbraid_cli/admin/app.py,sha256=__6lo-iFsbfz-ayD1-AS8X1z_gYhCad1NK17hnrL7HY,1451
8
+ qbraid_cli/admin/headers.py,sha256=oE2Ry9221ZV4tgYqFJNHAPilDw72xR3LqG_gBw7BFxM,6667
9
+ qbraid_cli/admin/validation.py,sha256=LkAVXlHtM0MhCa34MIWrfX59wGXMVlZmdVB4-AQ8fBk,1003
10
+ qbraid_cli/configure/__init__.py,sha256=6GU7vR6JYRGcMsmdrpFbwLO5VSUmnLgwSbtmGWMQND4,158
11
+ qbraid_cli/configure/actions.py,sha256=3rrWHaCAsogyx0Ll-lcjbSzldD4kPuz1z6VQiWebSWw,3203
12
+ qbraid_cli/configure/app.py,sha256=1uRe2lkUA4TtYb5b4mbD4LH-cKCbsZGT3Wfk7fpNzX0,2414
13
+ qbraid_cli/credits/__init__.py,sha256=t-3XAJFAXiu_jI4sgjaIOuNne_AoSYaSEsi-SSRkvPw,154
14
+ qbraid_cli/credits/app.py,sha256=iHikmjx8pylMFNzHckuauOg-Nb9pS7xQq_H75ibVJig,774
15
+ qbraid_cli/devices/__init__.py,sha256=_PU3eMQRV4DkPw-oCmfCPh8EbVmgG76ieEKuNsY9Xqc,154
16
+ qbraid_cli/devices/app.py,sha256=zxSxrEQn7irkJoME4S_CBnRqWeB8cqPaBsIMfpdYFk0,2530
17
+ qbraid_cli/devices/validation.py,sha256=YhShyUufgrKnx2XjXOXF-PqFJYklJT9CgeqIwKcNam4,809
18
+ qbraid_cli/envs/__init__.py,sha256=YgIoMWxfGqzmwfypO5JHYuCOu6BfFwb9NHgQel1IJM8,148
19
+ qbraid_cli/envs/activate.py,sha256=VpvVYSfQDlcmlNWJOgkLIQ2p8YXPPLG8Jbl5t8GHUDw,2140
20
+ qbraid_cli/envs/app.py,sha256=t6bRwJGy-M3PAu870ZsttsM8tpSB0OFasgCJiV9nTSA,8620
21
+ qbraid_cli/envs/create.py,sha256=uCRex_TcFYw26jUOU06Ta5I8Mq5pRqLVaOE6MxrrExs,4337
22
+ qbraid_cli/envs/data_handling.py,sha256=mTVzsj6KleeeYDKGhgD-IesF9KQQMSszKFSEo8Wrv9w,4001
23
+ qbraid_cli/jobs/__init__.py,sha256=bj9XmZ4JL8OtMMZbHIu-DPhpOMXGLSB-W1b0wO7wKro,148
24
+ qbraid_cli/jobs/app.py,sha256=kmg9mYla3Nd7EdjQlFu7IOvm7sejLNfPPA6Qeet-IfE,4898
25
+ qbraid_cli/jobs/toggle_braket.py,sha256=d5C_Di80jWMFlh-77eH8YY9pjMKWXK5abenUDtPlE_I,6662
26
+ qbraid_cli/jobs/validation.py,sha256=xNbjUggMhUs4wzkuRm4PuFPi_wrElYicUgYXLznHz3U,2983
27
+ qbraid_cli/kernels/__init__.py,sha256=VhpBota_v7OoiGxrPCqJU4XBVcolf81mbCYGSxXzVhc,154
28
+ qbraid_cli/kernels/app.py,sha256=ZJWVdKzCDfzGnA1pqp01vDbE7fh8p84jC-y6DDgWlxc,3373
29
+ qbraid_cli-0.8.0.dist-info/METADATA,sha256=pzzAXIOWje3oLOPHOM6F0Va9C6hk1-eKa3HzezY9B8Y,5914
30
+ qbraid_cli-0.8.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
31
+ qbraid_cli-0.8.0.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
32
+ qbraid_cli-0.8.0.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
33
+ qbraid_cli-0.8.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ qbraid = qbraid_cli.main:app