qbraid-cli 0.8.3__tar.gz → 0.8.4a0__tar.gz
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-0.8.3 → qbraid_cli-0.8.4a0}/.gitignore +3 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/PKG-INFO +13 -14
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/README.md +7 -6
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/pyproject.toml +6 -8
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/_version.py +2 -2
- qbraid_cli-0.8.4a0/qbraid_cli/envs/create.py +33 -0
- qbraid_cli-0.8.4a0/qbraid_cli/kernels/app.py +80 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/main.py +1 -1
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli.egg-info/PKG-INFO +13 -14
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli.egg-info/SOURCES.txt +0 -3
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli.egg-info/requires.txt +1 -3
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/kernels/test_kernels_list.py +34 -21
- qbraid_cli-0.8.3/qbraid_cli/envs/create.py +0 -61
- qbraid_cli-0.8.3/qbraid_cli/kernels/app.py +0 -117
- qbraid_cli-0.8.3/tests/envs/test_envs_create.py +0 -67
- qbraid_cli-0.8.3/tests/envs/test_envs_create_qbraid_env_assets.py +0 -79
- qbraid_cli-0.8.3/tests/envs/test_envs_create_validate_env_name.py +0 -69
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.env.example +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/workflows/docs.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/workflows/format.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/workflows/main.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/workflows/pre-release.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.github/workflows/publish.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/.readthedocs.yml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/CONTRIBUTING.md +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/LICENSE +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/MANIFEST.IN +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/Makefile +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/Makefile +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/api-key.png +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/cards/jupyter.png +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/cards/python.png +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/cards/terminal.png +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/favicon.ico +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/logo.png +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/style/custom.css +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/_static/style/s4defs-roles.css +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/configure.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/credits.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/devices-list.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/devices.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/envs-activate.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/envs-list.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/envs-uninstall.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/envs.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/jobs-add.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/jobs-disable.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/jobs-enable.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/jobs-list.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/jobs.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/kernels.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/cli/qbraid.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/conf.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/guide/overview.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/index.rst +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/make.bat +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/docs/requirements.txt +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/admin/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/admin/app.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/admin/buildlogs.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/admin/headers.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/admin/validation.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/configure/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/configure/actions.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/configure/app.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/credits/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/credits/app.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/devices/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/devices/app.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/devices/validation.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/envs/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/envs/activate.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/envs/app.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/envs/data_handling.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/exceptions.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/handlers.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/jobs/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/jobs/app.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/jobs/toggle_braket.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/jobs/validation.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/kernels/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/pip/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/pip/app.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/pip/hooks.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli/py.typed +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli.egg-info/dependency_links.txt +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli.egg-info/entry_points.txt +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/qbraid_cli.egg-info/top_level.txt +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/ruff.toml +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/setup.cfg +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/configure/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/configure/test_configure_prompt_for_config.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/configure/test_configure_set.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/configure/test_configure_validate_input.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/credits/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/credits/test_credits_value.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/devices/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/devices/test_devices_list.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/devices/test_devices_validations.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/envs/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/envs/test_envs_activate.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/envs/test_envs_activate_find_shell_rc.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/envs/test_envs_activate_print_command.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/envs/test_envs_activate_pyenv.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/envs/test_envs_list.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/envs/test_envs_remove.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_disable.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_enable.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_list.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_state.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_toggle_braket_confirm.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_toggle_braket_disable.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_toggle_braket_enable.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_toggle_braket_get_data.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_validate_get_state.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_validate_handle_state.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/jobs/test_jobs_validate_library.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tests/kernels/__init__.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tools/create_dev_build.sh +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tools/install_wheel_extras.sh +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tools/split_md.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tools/split_rst.py +0 -0
- {qbraid_cli-0.8.3 → qbraid_cli-0.8.4a0}/tools/stamp_pre_release.py +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qbraid-cli
|
|
3
|
-
Version: 0.8.
|
|
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://
|
|
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
|
|
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:
|
|
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: jobs
|
|
36
34
|
Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
|
|
37
35
|
Provides-Extra: dev
|
|
@@ -43,15 +41,16 @@ Requires-Dist: pytest-cov; extra == "dev"
|
|
|
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
|
-
[](https://docs.qbraid.com/
|
|
44
|
+
[](https://docs.qbraid.com/cli/user-guide/overview)
|
|
47
45
|
[](https://pypi.org/project/qbraid-cli/)
|
|
48
46
|
[](https://pypi.org/project/qbraid-cli/)
|
|
49
47
|
[](https://pepy.tech/project/qbraid-cli)
|
|
50
|
-
[](https://github.com/qBraid/
|
|
48
|
+
[](https://github.com/qBraid/community/issues)
|
|
49
|
+
[](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/
|
|
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 →](https://lab.qbraid.com/)
|
|
61
60
|
- [Make an account →](https://account.qbraid.com/)
|
|
62
61
|
|
|
63
|
-
For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/
|
|
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/
|
|
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/
|
|
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,14 +1,15 @@
|
|
|
1
1
|
<img width="full" alt="qbraid_cli" src="https://qbraid-static.s3.amazonaws.com/logos/qbraid-cli-banner.png">
|
|
2
2
|
|
|
3
|
-
[](https://docs.qbraid.com/
|
|
3
|
+
[](https://docs.qbraid.com/cli/user-guide/overview)
|
|
4
4
|
[](https://pypi.org/project/qbraid-cli/)
|
|
5
5
|
[](https://pypi.org/project/qbraid-cli/)
|
|
6
6
|
[](https://pepy.tech/project/qbraid-cli)
|
|
7
|
-
[](https://github.com/qBraid/
|
|
7
|
+
[](https://github.com/qBraid/community/issues)
|
|
8
|
+
[](https://stackoverflow.com/questions/tagged/qbraid)
|
|
8
9
|
|
|
9
10
|
Command Line Interface for interacting with all parts of the qBraid platform.
|
|
10
11
|
|
|
11
|
-
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/
|
|
12
|
+
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.
|
|
12
13
|
|
|
13
14
|
## Getting Started
|
|
14
15
|
|
|
@@ -17,7 +18,7 @@ The qBraid-CLI comes pre-installed and pre-configured in qBraid Lab:
|
|
|
17
18
|
- [Launch qBraid Lab →](https://lab.qbraid.com/)
|
|
18
19
|
- [Make an account →](https://account.qbraid.com/)
|
|
19
20
|
|
|
20
|
-
For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/
|
|
21
|
+
For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/lab/user-guide/getting-started).
|
|
21
22
|
|
|
22
23
|
You can also install the qBraid-CLI from PyPI with:
|
|
23
24
|
|
|
@@ -59,7 +60,7 @@ $ qbraid
|
|
|
59
60
|
|
|
60
61
|
- Use 'qbraid --version' to see the current version.
|
|
61
62
|
|
|
62
|
-
Reference Docs: https://docs.qbraid.com/
|
|
63
|
+
Reference Docs: https://docs.qbraid.com/cli/api-reference/qbraid
|
|
63
64
|
```
|
|
64
65
|
|
|
65
66
|
A qBraid CLI command has the following structure:
|
|
@@ -114,7 +115,7 @@ $ qbraid --version
|
|
|
114
115
|
|
|
115
116
|
## Magic Commands
|
|
116
117
|
|
|
117
|
-
You can also access the CLI directly from within [Notebooks](https://docs.qbraid.com/
|
|
118
|
+
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:
|
|
118
119
|
|
|
119
120
|
```bash
|
|
120
121
|
$ qbraid configure magic
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qbraid-cli"
|
|
7
|
-
version = "0.8.
|
|
7
|
+
version = "0.8.4-alpha"
|
|
8
8
|
description = "Command Line Interface for interacting with all parts of the qBraid platform."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "qBraid Development Team", email = "contact@qbraid.com" }]
|
|
@@ -29,18 +29,16 @@ classifiers = [
|
|
|
29
29
|
dependencies = [
|
|
30
30
|
"typer>=0.12.1",
|
|
31
31
|
"rich>=10.11.0",
|
|
32
|
-
"
|
|
33
|
-
"ipykernel",
|
|
34
|
-
"qbraid-core>=0.1.16",
|
|
32
|
+
"qbraid-core[environments]==0.1.17a0",
|
|
35
33
|
]
|
|
36
34
|
requires-python = ">= 3.9"
|
|
37
35
|
|
|
38
36
|
[project.urls]
|
|
39
|
-
Homepage = "https://
|
|
40
|
-
Documentation = "https://docs.qbraid.com/
|
|
41
|
-
"Bug Tracker" = "https://github.com/qBraid/
|
|
37
|
+
Homepage = "https://docs.qbraid.com/cli/user-guide/overview"
|
|
38
|
+
Documentation = "https://docs.qbraid.com/cli/api-reference/qbraid"
|
|
39
|
+
"Bug Tracker" = "https://github.com/qBraid/community/issues"
|
|
42
40
|
Discord = "https://discord.gg/KugF6Cnncm"
|
|
43
|
-
"Launch on Lab" = "https://account.qbraid.com/?gitHubUrl=https://github.com/qBraid
|
|
41
|
+
"Launch on Lab" = "https://account.qbraid.com/?gitHubUrl=https://github.com/qBraid/.git"
|
|
44
42
|
|
|
45
43
|
[project.optional-dependencies]
|
|
46
44
|
jobs = ["amazon-braket-sdk>=1.48.1"]
|
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '0.1.dev1+
|
|
16
|
-
__version_tuple__ = version_tuple = (0, 1, 'dev1', '
|
|
15
|
+
__version__ = version = '0.1.dev1+g8412556'
|
|
16
|
+
__version_tuple__ = version_tuple = (0, 1, 'dev1', 'g8412556')
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright (c) 2024, qBraid Development Team
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Module supporting 'qbraid envs create' command.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import shutil
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def create_venv(*args, **kwargs) -> None:
|
|
15
|
+
"""Create a python virtual environment for the qBraid environment."""
|
|
16
|
+
from qbraid_core.services.environments import create_local_venv
|
|
17
|
+
|
|
18
|
+
return create_local_venv(*args, **kwargs)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def update_state_json(*ags, **kwargs) -> None:
|
|
22
|
+
"""Update the state.json file for the qBraid environment."""
|
|
23
|
+
from qbraid_core.services.environments.state import update_install_status
|
|
24
|
+
|
|
25
|
+
return update_install_status(*ags, **kwargs)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def create_qbraid_env_assets(slug: str, alias: str, kernel_name: str, slug_path: str) -> None:
|
|
29
|
+
"""Create a qBraid environment including python venv, PS1 configs,
|
|
30
|
+
kernel resource files, and qBraid state.json."""
|
|
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)
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import typer
|
|
11
|
+
from qbraid_core.services.environments.kernels import add_kernels, list_kernels, remove_kernels
|
|
12
|
+
from rich.console import Console
|
|
13
|
+
|
|
14
|
+
from qbraid_cli.handlers import handle_error
|
|
15
|
+
|
|
16
|
+
kernels_app = typer.Typer(help="Manage qBraid kernels.")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@kernels_app.command(name="list")
|
|
20
|
+
def kernels_list():
|
|
21
|
+
"""List all available kernels."""
|
|
22
|
+
console = Console()
|
|
23
|
+
# Get the list of kernelspecs
|
|
24
|
+
kernelspecs = list_kernels()
|
|
25
|
+
|
|
26
|
+
if len(kernelspecs) == 0:
|
|
27
|
+
console.print("No qBraid kernels are active.")
|
|
28
|
+
console.print("\nUse 'qbraid kernels add' to add a new kernel.")
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
longest_kernel_name = max(len(kernel_name) for kernel_name in kernelspecs)
|
|
32
|
+
spacing = longest_kernel_name + 10
|
|
33
|
+
|
|
34
|
+
console.print("# qbraid kernels:\n#\n")
|
|
35
|
+
|
|
36
|
+
# Ensure 'python3' kernel is printed first if it exists
|
|
37
|
+
default_kernel_name = "python3"
|
|
38
|
+
python3_kernel_info = kernelspecs.pop(default_kernel_name, None)
|
|
39
|
+
if python3_kernel_info:
|
|
40
|
+
console.print(f"{default_kernel_name.ljust(spacing)}{python3_kernel_info['resource_dir']}")
|
|
41
|
+
# print rest of the kernels
|
|
42
|
+
for kernel_name, kernel_info in sorted(kernelspecs.items()):
|
|
43
|
+
console.print(f"{kernel_name.ljust(spacing)}{kernel_info['resource_dir']}")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@kernels_app.command(name="add")
|
|
47
|
+
def kernels_add(
|
|
48
|
+
environment: str = typer.Argument(
|
|
49
|
+
..., help="Name of environment for which to add ipykernel. Values from 'qbraid envs list'."
|
|
50
|
+
)
|
|
51
|
+
):
|
|
52
|
+
"""Add a kernel."""
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
add_kernels(environment)
|
|
56
|
+
except ValueError as e:
|
|
57
|
+
handle_error(
|
|
58
|
+
message=e,
|
|
59
|
+
include_traceback=False,
|
|
60
|
+
)
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@kernels_app.command(name="remove")
|
|
65
|
+
def kernels_remove(
|
|
66
|
+
environment: str = typer.Argument(
|
|
67
|
+
...,
|
|
68
|
+
help=("Name of environment for which to remove ipykernel. Values from 'qbraid envs list'."),
|
|
69
|
+
)
|
|
70
|
+
):
|
|
71
|
+
"""Remove a kernel."""
|
|
72
|
+
try:
|
|
73
|
+
remove_kernels(environment)
|
|
74
|
+
except ValueError:
|
|
75
|
+
handle_error(message=f"Environment '{environment}' not found.", include_traceback=False)
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
kernels_app()
|
|
@@ -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,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qbraid-cli
|
|
3
|
-
Version: 0.8.
|
|
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://
|
|
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
|
|
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:
|
|
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: jobs
|
|
36
34
|
Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
|
|
37
35
|
Provides-Extra: dev
|
|
@@ -43,15 +41,16 @@ Requires-Dist: pytest-cov; extra == "dev"
|
|
|
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
|
-
[](https://docs.qbraid.com/
|
|
44
|
+
[](https://docs.qbraid.com/cli/user-guide/overview)
|
|
47
45
|
[](https://pypi.org/project/qbraid-cli/)
|
|
48
46
|
[](https://pypi.org/project/qbraid-cli/)
|
|
49
47
|
[](https://pepy.tech/project/qbraid-cli)
|
|
50
|
-
[](https://github.com/qBraid/
|
|
48
|
+
[](https://github.com/qBraid/community/issues)
|
|
49
|
+
[](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/
|
|
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 →](https://lab.qbraid.com/)
|
|
61
60
|
- [Make an account →](https://account.qbraid.com/)
|
|
62
61
|
|
|
63
|
-
For help, see qBraid Lab User Guide: [Getting Started](https://docs.qbraid.com/
|
|
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/
|
|
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/
|
|
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
|
|
@@ -99,9 +99,6 @@ tests/envs/test_envs_activate.py
|
|
|
99
99
|
tests/envs/test_envs_activate_find_shell_rc.py
|
|
100
100
|
tests/envs/test_envs_activate_print_command.py
|
|
101
101
|
tests/envs/test_envs_activate_pyenv.py
|
|
102
|
-
tests/envs/test_envs_create.py
|
|
103
|
-
tests/envs/test_envs_create_qbraid_env_assets.py
|
|
104
|
-
tests/envs/test_envs_create_validate_env_name.py
|
|
105
102
|
tests/envs/test_envs_list.py
|
|
106
103
|
tests/envs/test_envs_remove.py
|
|
107
104
|
tests/jobs/__init__.py
|
|
@@ -11,11 +11,15 @@ from unittest.mock import call, patch
|
|
|
11
11
|
from qbraid_cli.kernels.app import kernels_list
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
def mock_is_exe(path):
|
|
15
|
+
return path == "/path/to/bin/python3", "-m", "ipykernel_launcher", "-f", "test"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# @patch("jupyter_client.kernelspec.KernelSpecManager")
|
|
19
|
+
@patch("qbraid_cli.kernels.app.list_kernels", return_value={})
|
|
15
20
|
@patch("qbraid_cli.kernels.app.Console")
|
|
16
|
-
def test_kernels_list_no_active_kernels(mock_console,
|
|
21
|
+
def test_kernels_list_no_active_kernels(mock_console, mock_list_kernels):
|
|
17
22
|
"""Test listing kernels when no kernels are active."""
|
|
18
|
-
mock_kernel_spec_manager.return_value.get_all_specs.return_value = {}
|
|
19
23
|
|
|
20
24
|
kernels_list()
|
|
21
25
|
|
|
@@ -24,43 +28,52 @@ def test_kernels_list_no_active_kernels(mock_console, mock_kernel_spec_manager):
|
|
|
24
28
|
call("\nUse 'qbraid kernels add' to add a new kernel."),
|
|
25
29
|
]
|
|
26
30
|
actual_calls = mock_console.return_value.print.call_args_list
|
|
31
|
+
print(actual_calls, "actual_calls")
|
|
27
32
|
assert actual_calls == expected_calls
|
|
28
33
|
|
|
29
34
|
|
|
30
|
-
@patch(
|
|
35
|
+
@patch(
|
|
36
|
+
"qbraid_cli.kernels.app.list_kernels",
|
|
37
|
+
return_value={"python3": {"resource_dir": "/path/to/python3/kernel"}},
|
|
38
|
+
)
|
|
31
39
|
@patch("qbraid_cli.kernels.app.Console")
|
|
32
|
-
def test_kernels_list_default_python3_kernel_present(mock_console,
|
|
40
|
+
def test_kernels_list_default_python3_kernel_present(mock_console, mock_list_kernels):
|
|
33
41
|
"""Test listing kernels when the default python3 kernel is present."""
|
|
34
|
-
mock_kernel_spec_manager.return_value.get_all_specs.return_value = {
|
|
35
|
-
"python3": {"resource_dir": "/path/to/python3/kernel"}
|
|
36
|
-
}
|
|
37
42
|
|
|
38
43
|
kernels_list()
|
|
39
44
|
|
|
40
45
|
expected_calls = [
|
|
41
|
-
call("# qbraid kernels:\n#\n
|
|
46
|
+
call("# qbraid kernels:\n#\n"),
|
|
47
|
+
call("python3 /path/to/python3/kernel"),
|
|
42
48
|
]
|
|
43
49
|
actual_calls = mock_console.return_value.print.call_args_list
|
|
44
50
|
assert actual_calls == expected_calls
|
|
45
51
|
|
|
46
52
|
|
|
47
|
-
@patch(
|
|
53
|
+
@patch(
|
|
54
|
+
"qbraid_cli.kernels.app.list_kernels",
|
|
55
|
+
return_value={
|
|
56
|
+
"python3": {"resource_dir": "/path/to/python3/kernel"},
|
|
57
|
+
"another_kernel": {
|
|
58
|
+
"resource_dir": "/path/to/another/kernel",
|
|
59
|
+
"spec": {
|
|
60
|
+
"display_name": "Another Kernel",
|
|
61
|
+
"argv": ["/path/to/bin/python3", "-m", "ipykernel_launcher", "-f", "test"],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
)
|
|
48
66
|
@patch("qbraid_cli.kernels.app.Console")
|
|
49
|
-
def test_kernels_list_multiple_kernels_available(mock_console,
|
|
67
|
+
def test_kernels_list_multiple_kernels_available(mock_console, mock_list_kernels):
|
|
50
68
|
"""Test listing multiple kernels when multiple kernels are available."""
|
|
51
|
-
mock_kernel_spec_manager.return_value.get_all_specs.return_value = {
|
|
52
|
-
"python3": {"resource_dir": "/path/to/python3/kernel"},
|
|
53
|
-
"another_kernel": {"resource_dir": "/path/to/another/kernel"},
|
|
54
|
-
}
|
|
55
69
|
|
|
56
|
-
|
|
70
|
+
with patch("qbraid_core.services.environments.kernels.is_exe", mock_is_exe):
|
|
71
|
+
kernels_list()
|
|
57
72
|
|
|
58
73
|
expected_calls = [
|
|
59
|
-
call(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"another_kernel /path/to/another/kernel"
|
|
63
|
-
),
|
|
74
|
+
call("# qbraid kernels:\n#\n"),
|
|
75
|
+
call("python3 /path/to/python3/kernel"),
|
|
76
|
+
call("another_kernel /path/to/another/kernel"),
|
|
64
77
|
]
|
|
65
78
|
actual_calls = mock_console.return_value.print.call_args_list
|
|
66
79
|
assert actual_calls == expected_calls
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024, qBraid Development Team
|
|
2
|
-
# All rights reserved.
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
Module supporting 'qbraid envs create' command.
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
import json
|
|
9
|
-
import os
|
|
10
|
-
import shutil
|
|
11
|
-
import sys
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def create_venv(*args, **kwargs) -> None:
|
|
15
|
-
"""Create a python virtual environment for the qBraid environment."""
|
|
16
|
-
from qbraid_core.services.environments import create_local_venv
|
|
17
|
-
|
|
18
|
-
return create_local_venv(*args, **kwargs)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def update_state_json(*ags, **kwargs) -> None:
|
|
22
|
-
"""Update the state.json file for the qBraid environment."""
|
|
23
|
-
from qbraid_core.services.environments.state import update_install_status
|
|
24
|
-
|
|
25
|
-
return update_install_status(*ags, **kwargs)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def create_qbraid_env_assets(slug: str, alias: str, kernel_name: str, slug_path: str) -> None:
|
|
29
|
-
"""Create a qBraid environment including python venv, PS1 configs,
|
|
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)
|