qbraid-core 0.2.0a9__tar.gz → 0.2.2__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.
- {qbraid_core-0.2.0a9/qbraid_core.egg-info → qbraid_core-0.2.2}/PKG-INFO +15 -48
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/README.md +11 -36
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/docs/api/qbraid_core.services.rst +3 -2
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/docs/conf.py +2 -2
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/docs/index.rst +11 -2
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/pyproject.toml +5 -6
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/__init__.py +6 -7
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/_compat.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/_import.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/annotations.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/client.py +7 -93
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/config.py +3 -5
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/decimal.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/registry.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/retry.py +3 -2
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/__init__.py +3 -6
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/__init__.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/client.py +21 -14
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/create.py +83 -44
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/kernels.py +1 -1
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/magic.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/packages.py +3 -4
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/paths.py +1 -1
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/registry.py +7 -9
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/schema.py +5 -2
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/validate.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/mcp/__init__.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/mcp/client.py +2 -1
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/mcp/discovery.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/mcp/router.py +1 -0
- qbraid_core-0.2.2/qbraid_core/services/quantum/__init__.py +15 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/quantum/runner.py +5 -2
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/__init__.py +17 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/client.py +4 -3
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/schemas/device.py +3 -1
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/schemas/enums.py +1 -1
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/schemas/job.py +6 -3
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/storage/__init__.py +5 -7
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/storage/disk_usage_client.py +5 -3
- {qbraid_core-0.2.0a9/qbraid_core/services/chat → qbraid_core-0.2.2/qbraid_core/services/storage}/exceptions.py +2 -2
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/storage/types.py +1 -0
- qbraid_core-0.2.2/qbraid_core/sessions.py +396 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/__init__.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/executables.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/generic.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/magic/__init__.py +1 -0
- qbraid_core-0.2.2/qbraid_core/system/magic/qbraid_magic.py +62 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/packages.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/versions.py +1 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2/qbraid_core.egg-info}/PKG-INFO +15 -48
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core.egg-info/SOURCES.txt +0 -11
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core.egg-info/requires.txt +1 -10
- qbraid_core-0.2.0a9/CLAUDE.md +0 -64
- qbraid_core-0.2.0a9/qbraid_core/services/chat/__init__.py +0 -29
- qbraid_core-0.2.0a9/qbraid_core/services/chat/client.py +0 -170
- qbraid_core-0.2.0a9/qbraid_core/services/environments/utils/__init__.py +0 -6
- qbraid_core-0.2.0a9/qbraid_core/services/quantum/__init__.py +0 -44
- qbraid_core-0.2.0a9/qbraid_core/services/quantum/adapter.py +0 -146
- qbraid_core-0.2.0a9/qbraid_core/services/quantum/client.py +0 -282
- qbraid_core-0.2.0a9/qbraid_core/services/quantum/exceptions.py +0 -17
- qbraid_core-0.2.0a9/qbraid_core/services/quantum/proxy.py +0 -109
- qbraid_core-0.2.0a9/qbraid_core/services/quantum/proxy_braket.py +0 -116
- qbraid_core-0.2.0a9/qbraid_core/services/storage/client.py +0 -187
- qbraid_core-0.2.0a9/qbraid_core/services/storage/exceptions.py +0 -17
- qbraid_core-0.2.0a9/qbraid_core/sessions.py +0 -789
- qbraid_core-0.2.0a9/qbraid_core/system/magic/qbraid_magic.py +0 -207
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/LICENSE +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/MANIFEST.in +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/docs/_static/favicon.ico +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/docs/_static/logo.png +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/docs/api/qbraid_core.rst +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/_version.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/context.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/exceptions.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/py.typed +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/exceptions.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/environments/state.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/exceptions.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/schemas/__init__.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/services/runtime/schemas/result.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/exceptions.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/filemanager.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core/system/magic/manager.py +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core.egg-info/dependency_links.txt +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/qbraid_core.egg-info/top_level.txt +0 -0
- {qbraid_core-0.2.0a9 → qbraid_core-0.2.2}/setup.cfg +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qbraid-core
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Python library with core abstractions for software development in the qBraid ecosystem.
|
|
5
5
|
Author: qBraid Development Team
|
|
6
6
|
Author-email: contact@qbraid.com
|
|
7
7
|
License: Proprietary
|
|
8
|
-
Project-URL: Homepage, https://
|
|
9
|
-
Project-URL: Documentation, https://qbraid.
|
|
8
|
+
Project-URL: Homepage, https://sdk.qbraid.com/qbraid-core/
|
|
9
|
+
Project-URL: Documentation, https://docs.qbraid.com/v2/core
|
|
10
10
|
Project-URL: Bug Tracker, https://github.com/qBraid/community/issues
|
|
11
11
|
Project-URL: Discord, https://discord.gg/KugF6Cnncm
|
|
12
12
|
Keywords: qbraid,quantum,cloud
|
|
@@ -44,17 +44,10 @@ Requires-Dist: psutil; extra == "runner"
|
|
|
44
44
|
Provides-Extra: environments
|
|
45
45
|
Requires-Dist: jupyter_client>=7.1.0; extra == "environments"
|
|
46
46
|
Requires-Dist: ipython; extra == "environments"
|
|
47
|
-
Requires-Dist: pydantic>2.0.0; extra == "environments"
|
|
48
47
|
Requires-Dist: pyyaml>6.0.0; extra == "environments"
|
|
49
48
|
Requires-Dist: ipykernel; extra == "environments"
|
|
50
49
|
Requires-Dist: zstandard; extra == "environments"
|
|
51
|
-
|
|
52
|
-
Requires-Dist: jupyter_client>=7.1.0; extra == "envs"
|
|
53
|
-
Requires-Dist: ipython; extra == "envs"
|
|
54
|
-
Requires-Dist: pydantic>2.0.0; extra == "envs"
|
|
55
|
-
Requires-Dist: pyyaml>6.0.0; extra == "envs"
|
|
56
|
-
Requires-Dist: ipykernel; extra == "envs"
|
|
57
|
-
Requires-Dist: zstandard; extra == "envs"
|
|
50
|
+
Requires-Dist: filelock; extra == "environments"
|
|
58
51
|
Provides-Extra: mcp
|
|
59
52
|
Requires-Dist: websockets>=11.0; extra == "mcp"
|
|
60
53
|
Provides-Extra: test
|
|
@@ -68,7 +61,6 @@ Requires-Dist: sphinx-autodoc-typehints<3.2,>=1.24; extra == "docs"
|
|
|
68
61
|
Requires-Dist: docutils<0.23; extra == "docs"
|
|
69
62
|
Requires-Dist: sphinx-copybutton; extra == "docs"
|
|
70
63
|
Requires-Dist: sphinx-pydantic; extra == "docs"
|
|
71
|
-
Requires-Dist: zstandard; extra == "docs"
|
|
72
64
|
Dynamic: license-file
|
|
73
65
|
|
|
74
66
|
# qbraid-core
|
|
@@ -100,27 +92,26 @@ After installing qbraid-core, you must configure your account credentials:
|
|
|
100
92
|
|
|
101
93
|
1. Create a qBraid account or log in to your existing account by visiting
|
|
102
94
|
[account.qbraid.com](https://account.qbraid.com/)
|
|
103
|
-
2.
|
|
104
|
-
|
|
105
|
-
3. Save your API key from step 2 in local [configuration file](https://docs.qbraid.com/cli/user-guide/config-files). On Linux and macOS, this file is located at `~/.qbraid/qbraidrc`, where `~` corresponds to your home (`$HOME`) directory. On Windows, the equivalent default location is `%USERPROFILE%\.qbraid\qbraidrc`.
|
|
95
|
+
2. Navigate to **Account** > **API Keys** in the left-sidebar, and then click "Create API Key". See [API Key docs](https://docs.qbraid.com/v2/home/account#api-keys).
|
|
96
|
+
3. Save your API key from step 2 in local [configuration file](https://docs.qbraid.com/v2/cli/user-guide/config-files). On Linux and macOS, this file is located at `~/.qbraid/qbraidrc`, where `~` corresponds to your home (`$HOME`) directory. On Windows, the equivalent default location is `%USERPROFILE%\.qbraid\qbraidrc`.
|
|
106
97
|
|
|
107
98
|
```ini
|
|
108
99
|
[default]
|
|
109
100
|
api-key = YOUR_KEY
|
|
110
|
-
url = https://api.qbraid.com/api
|
|
101
|
+
url = https://api-v2.qbraid.com/api/v1
|
|
111
102
|
```
|
|
112
103
|
|
|
113
104
|
Or generate your `~/.qbraid/qbraidrc` file via the qbraid-core Python interface:
|
|
114
105
|
|
|
115
106
|
```python
|
|
116
|
-
>>> from qbraid_core import
|
|
117
|
-
>>> session =
|
|
107
|
+
>>> from qbraid_core import QbraidSessionV1
|
|
108
|
+
>>> session = QbraidSessionV1(api_key='API_KEY')
|
|
118
109
|
>>> session.save_config()
|
|
119
110
|
>>> session.get_available_services()
|
|
120
|
-
['
|
|
111
|
+
['environments', 'runtime', 'storage']
|
|
121
112
|
```
|
|
122
113
|
|
|
123
|
-
Other credential configuration methods are available using the [qBraid-CLI](https://docs.qbraid.com/cli/api-reference/qbraid_configure).
|
|
114
|
+
Other credential configuration methods are available using the [qBraid-CLI](https://docs.qbraid.com/v2/cli/api-reference/qbraid_configure).
|
|
124
115
|
|
|
125
116
|
### Verify setup
|
|
126
117
|
|
|
@@ -128,10 +119,10 @@ After configuring your qBraid credentials, verify your setup by running the foll
|
|
|
128
119
|
|
|
129
120
|
```python
|
|
130
121
|
>>> import qbraid_core
|
|
131
|
-
>>>
|
|
132
|
-
>>>
|
|
133
|
-
>>> for
|
|
134
|
-
... print(
|
|
122
|
+
>>> quantum_runtime_client = qbraid_core.client('runtime')
|
|
123
|
+
>>> devices = quantum_runtime_client.list_devices()
|
|
124
|
+
>>> for device in devices:
|
|
125
|
+
... print(device.qrn, device.status)
|
|
135
126
|
```
|
|
136
127
|
|
|
137
128
|
## Community
|
|
@@ -139,27 +130,3 @@ After configuring your qBraid credentials, verify your setup by running the foll
|
|
|
139
130
|
- For feature requests and bug reports: [Submit an issue](https://github.com/qBraid/community/issues)
|
|
140
131
|
- For discussions and/or specific questions about qBraid services, [join our discord community](https://discord.gg/KugF6Cnncm)
|
|
141
132
|
- For questions that are more suited for a forum, post to [Stack Overflow](https://stackoverflow.com/) with the [`qbraid`](https://stackoverflow.com/questions/tagged/qbraid) tag.
|
|
142
|
-
|
|
143
|
-
## Launch on qBraid
|
|
144
|
-
|
|
145
|
-
The "Launch on qBraid" button (below) can be added to any public GitHub
|
|
146
|
-
repository. Clicking on it automaically opens qBraid Lab, and performs a
|
|
147
|
-
`git clone` of the project repo into your account's home directory. Copy the
|
|
148
|
-
code below, and replace `YOUR-USERNAME` and `YOUR-REPOSITORY` with your GitHub
|
|
149
|
-
info.
|
|
150
|
-
|
|
151
|
-
[<img src="https://qbraid-static.s3.amazonaws.com/logos/Launch_on_qBraid_white.png" width="150">](https://account.qbraid.com?gitHubUrl=https://github.com/qBraid/qBraid.git)
|
|
152
|
-
|
|
153
|
-
Use the badge in your project's `README.md`:
|
|
154
|
-
|
|
155
|
-
```markdown
|
|
156
|
-
[<img src="https://qbraid-static.s3.amazonaws.com/logos/Launch_on_qBraid_white.png" width="150">](https://account.qbraid.com?gitHubUrl=https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.git)
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Use the badge in your project's `README.rst`:
|
|
160
|
-
|
|
161
|
-
```rst
|
|
162
|
-
.. image:: https://qbraid-static.s3.amazonaws.com/logos/Launch_on_qBraid_white.png
|
|
163
|
-
:target: https://account.qbraid.com?gitHubUrl=https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.git
|
|
164
|
-
:width: 150px
|
|
165
|
-
```
|
|
@@ -27,27 +27,26 @@ After installing qbraid-core, you must configure your account credentials:
|
|
|
27
27
|
|
|
28
28
|
1. Create a qBraid account or log in to your existing account by visiting
|
|
29
29
|
[account.qbraid.com](https://account.qbraid.com/)
|
|
30
|
-
2.
|
|
31
|
-
|
|
32
|
-
3. Save your API key from step 2 in local [configuration file](https://docs.qbraid.com/cli/user-guide/config-files). On Linux and macOS, this file is located at `~/.qbraid/qbraidrc`, where `~` corresponds to your home (`$HOME`) directory. On Windows, the equivalent default location is `%USERPROFILE%\.qbraid\qbraidrc`.
|
|
30
|
+
2. Navigate to **Account** > **API Keys** in the left-sidebar, and then click "Create API Key". See [API Key docs](https://docs.qbraid.com/v2/home/account#api-keys).
|
|
31
|
+
3. Save your API key from step 2 in local [configuration file](https://docs.qbraid.com/v2/cli/user-guide/config-files). On Linux and macOS, this file is located at `~/.qbraid/qbraidrc`, where `~` corresponds to your home (`$HOME`) directory. On Windows, the equivalent default location is `%USERPROFILE%\.qbraid\qbraidrc`.
|
|
33
32
|
|
|
34
33
|
```ini
|
|
35
34
|
[default]
|
|
36
35
|
api-key = YOUR_KEY
|
|
37
|
-
url = https://api.qbraid.com/api
|
|
36
|
+
url = https://api-v2.qbraid.com/api/v1
|
|
38
37
|
```
|
|
39
38
|
|
|
40
39
|
Or generate your `~/.qbraid/qbraidrc` file via the qbraid-core Python interface:
|
|
41
40
|
|
|
42
41
|
```python
|
|
43
|
-
>>> from qbraid_core import
|
|
44
|
-
>>> session =
|
|
42
|
+
>>> from qbraid_core import QbraidSessionV1
|
|
43
|
+
>>> session = QbraidSessionV1(api_key='API_KEY')
|
|
45
44
|
>>> session.save_config()
|
|
46
45
|
>>> session.get_available_services()
|
|
47
|
-
['
|
|
46
|
+
['environments', 'runtime', 'storage']
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
Other credential configuration methods are available using the [qBraid-CLI](https://docs.qbraid.com/cli/api-reference/qbraid_configure).
|
|
49
|
+
Other credential configuration methods are available using the [qBraid-CLI](https://docs.qbraid.com/v2/cli/api-reference/qbraid_configure).
|
|
51
50
|
|
|
52
51
|
### Verify setup
|
|
53
52
|
|
|
@@ -55,10 +54,10 @@ After configuring your qBraid credentials, verify your setup by running the foll
|
|
|
55
54
|
|
|
56
55
|
```python
|
|
57
56
|
>>> import qbraid_core
|
|
58
|
-
>>>
|
|
59
|
-
>>>
|
|
60
|
-
>>> for
|
|
61
|
-
... print(
|
|
57
|
+
>>> quantum_runtime_client = qbraid_core.client('runtime')
|
|
58
|
+
>>> devices = quantum_runtime_client.list_devices()
|
|
59
|
+
>>> for device in devices:
|
|
60
|
+
... print(device.qrn, device.status)
|
|
62
61
|
```
|
|
63
62
|
|
|
64
63
|
## Community
|
|
@@ -66,27 +65,3 @@ After configuring your qBraid credentials, verify your setup by running the foll
|
|
|
66
65
|
- For feature requests and bug reports: [Submit an issue](https://github.com/qBraid/community/issues)
|
|
67
66
|
- For discussions and/or specific questions about qBraid services, [join our discord community](https://discord.gg/KugF6Cnncm)
|
|
68
67
|
- For questions that are more suited for a forum, post to [Stack Overflow](https://stackoverflow.com/) with the [`qbraid`](https://stackoverflow.com/questions/tagged/qbraid) tag.
|
|
69
|
-
|
|
70
|
-
## Launch on qBraid
|
|
71
|
-
|
|
72
|
-
The "Launch on qBraid" button (below) can be added to any public GitHub
|
|
73
|
-
repository. Clicking on it automaically opens qBraid Lab, and performs a
|
|
74
|
-
`git clone` of the project repo into your account's home directory. Copy the
|
|
75
|
-
code below, and replace `YOUR-USERNAME` and `YOUR-REPOSITORY` with your GitHub
|
|
76
|
-
info.
|
|
77
|
-
|
|
78
|
-
[<img src="https://qbraid-static.s3.amazonaws.com/logos/Launch_on_qBraid_white.png" width="150">](https://account.qbraid.com?gitHubUrl=https://github.com/qBraid/qBraid.git)
|
|
79
|
-
|
|
80
|
-
Use the badge in your project's `README.md`:
|
|
81
|
-
|
|
82
|
-
```markdown
|
|
83
|
-
[<img src="https://qbraid-static.s3.amazonaws.com/logos/Launch_on_qBraid_white.png" width="150">](https://account.qbraid.com?gitHubUrl=https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.git)
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Use the badge in your project's `README.rst`:
|
|
87
|
-
|
|
88
|
-
```rst
|
|
89
|
-
.. image:: https://qbraid-static.s3.amazonaws.com/logos/Launch_on_qBraid_white.png
|
|
90
|
-
:target: https://account.qbraid.com?gitHubUrl=https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.git
|
|
91
|
-
:width: 150px
|
|
92
|
-
```
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import qbraid_core
|
|
10
10
|
|
|
11
11
|
project = "qBraid"
|
|
12
|
-
copyright = "
|
|
12
|
+
copyright = "2026, qBraid Development Team"
|
|
13
13
|
author = "qBraid Development Team"
|
|
14
14
|
|
|
15
15
|
# Set the version
|
|
@@ -30,7 +30,7 @@ extensions = [
|
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
# for rendering documentation without installing the package deps
|
|
33
|
-
autodoc_mock_imports = ["jupyter_client", "IPython", "yaml"]
|
|
33
|
+
autodoc_mock_imports = ["jupyter_client", "IPython", "yaml", "zstandard", "filelock"]
|
|
34
34
|
|
|
35
35
|
# The master toctree document.
|
|
36
36
|
master_doc = "index"
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
Python client for developing software with qBraid cloud services
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
|
+
:Release: |release|
|
|
13
|
+
|
|
12
14
|
Overview
|
|
13
15
|
---------
|
|
14
16
|
|
|
@@ -33,7 +35,7 @@ You can install qbraid-core from PyPI with:
|
|
|
33
35
|
Resources
|
|
34
36
|
-----------
|
|
35
37
|
|
|
36
|
-
- `User Guide <https://docs.qbraid.com/core/user-guide>`_
|
|
38
|
+
- `User Guide <https://docs.qbraid.com/v2/core/user-guide>`_
|
|
37
39
|
- `API Reference <https://qbraid.github.io/qbraid-core/api/qbraid_core.html>`_
|
|
38
40
|
|
|
39
41
|
|
|
@@ -57,6 +59,7 @@ Resources
|
|
|
57
59
|
qbraid_qir <https://qbraid.github.io/qbraid-qir/api/qbraid_qir.html>
|
|
58
60
|
qbraid_qir.cirq <https://qbraid.github.io/qbraid-qir/api/qbraid_qir.cirq.html>
|
|
59
61
|
qbraid_qir.qasm3 <https://qbraid.github.io/qbraid-qir/api/qbraid_qir.qasm3.html>
|
|
62
|
+
qbraid_qir.squin <https://qbraid.github.io/qbraid-qir/api/qbraid_qir.squin.html>
|
|
60
63
|
|
|
61
64
|
.. toctree::
|
|
62
65
|
:maxdepth: 1
|
|
@@ -70,4 +73,10 @@ Resources
|
|
|
70
73
|
:caption: PYQASM API Reference
|
|
71
74
|
:hidden:
|
|
72
75
|
|
|
73
|
-
pyqasm <https://qbraid.github.io/pyqasm/api/pyqasm.html>
|
|
76
|
+
pyqasm <https://qbraid.github.io/pyqasm/api/pyqasm.html>
|
|
77
|
+
|
|
78
|
+
.. toctree::
|
|
79
|
+
:caption: ALGOS API Reference
|
|
80
|
+
:hidden:
|
|
81
|
+
|
|
82
|
+
qbraid_algorithms <https://qbraid.github.io/qbraid-algorithms/api/qbraid_algorithms.html>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qbraid-core"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
authors = [{name = "qBraid Development Team"}, {email = "contact@qbraid.com"}]
|
|
9
9
|
description = "Python library with core abstractions for software development in the qBraid ecosystem."
|
|
10
10
|
readme = "README.md"
|
|
@@ -37,18 +37,17 @@ classifiers = [
|
|
|
37
37
|
dependencies = ["requests", "urllib3", "packaging", "pydantic>2.0.0"]
|
|
38
38
|
|
|
39
39
|
[project.urls]
|
|
40
|
-
Homepage = "https://
|
|
41
|
-
Documentation = "https://qbraid.
|
|
40
|
+
Homepage = "https://sdk.qbraid.com/qbraid-core/"
|
|
41
|
+
Documentation = "https://docs.qbraid.com/v2/core"
|
|
42
42
|
"Bug Tracker" = "https://github.com/qBraid/community/issues"
|
|
43
43
|
Discord = "https://discord.gg/KugF6Cnncm"
|
|
44
44
|
|
|
45
45
|
[project.optional-dependencies]
|
|
46
46
|
runner = ["numpy", "psutil"]
|
|
47
|
-
environments = ["jupyter_client>=7.1.0", "ipython", "
|
|
48
|
-
envs = ["jupyter_client>=7.1.0", "ipython", "pydantic>2.0.0", "pyyaml>6.0.0", "ipykernel", "zstandard"]
|
|
47
|
+
environments = ["jupyter_client>=7.1.0", "ipython", "pyyaml>6.0.0", "ipykernel", "zstandard", "filelock"]
|
|
49
48
|
mcp = ["websockets>=11.0"]
|
|
50
49
|
test = ["pytest", "pytest-cov", "pytest-asyncio"]
|
|
51
|
-
docs = ["sphinx>=7.2.6,<8.3.0", "sphinx-rtd-theme>=1.3,<3.1", "sphinx-autodoc-typehints>=1.24,<3.2", "docutils<0.23", "sphinx-copybutton", "sphinx-pydantic"
|
|
50
|
+
docs = ["sphinx>=7.2.6,<8.3.0", "sphinx-rtd-theme>=1.3,<3.1", "sphinx-autodoc-typehints>=1.24,<3.2", "docutils<0.23", "sphinx-copybutton", "sphinx-pydantic"]
|
|
52
51
|
|
|
53
52
|
[tool.black]
|
|
54
53
|
line-length = 100
|
|
@@ -13,8 +13,8 @@ Classes
|
|
|
13
13
|
:toctree: ../stubs/
|
|
14
14
|
|
|
15
15
|
Session
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
QbraidClientV1
|
|
17
|
+
QbraidSessionV1
|
|
18
18
|
|
|
19
19
|
Functions
|
|
20
20
|
----------
|
|
@@ -40,10 +40,11 @@ Exceptions
|
|
|
40
40
|
UserNotFoundError
|
|
41
41
|
|
|
42
42
|
"""
|
|
43
|
+
|
|
43
44
|
from ._compat import __version__
|
|
44
45
|
from ._import import LazyLoader
|
|
45
46
|
from .annotations import deprecated
|
|
46
|
-
from .client import
|
|
47
|
+
from .client import QbraidClientV1
|
|
47
48
|
from .exceptions import (
|
|
48
49
|
AuthError,
|
|
49
50
|
ConfigError,
|
|
@@ -54,7 +55,7 @@ from .exceptions import (
|
|
|
54
55
|
UserNotFoundError,
|
|
55
56
|
)
|
|
56
57
|
from .retry import PostForcelistRetry
|
|
57
|
-
from .sessions import
|
|
58
|
+
from .sessions import QbraidSessionV1, Session
|
|
58
59
|
|
|
59
60
|
# Hold the default session in a global variable, but don't initialize it yet.
|
|
60
61
|
_DEFAULT_SESSION = None # pylint: disable=invalid-name
|
|
@@ -67,7 +68,7 @@ def setup_default_session(**kwargs):
|
|
|
67
68
|
parameters, because a default session will be created for you.
|
|
68
69
|
"""
|
|
69
70
|
global _DEFAULT_SESSION # pylint: disable=global-statement
|
|
70
|
-
_DEFAULT_SESSION =
|
|
71
|
+
_DEFAULT_SESSION = QbraidSessionV1(**kwargs)
|
|
71
72
|
|
|
72
73
|
|
|
73
74
|
def _get_default_session():
|
|
@@ -111,9 +112,7 @@ def client(*args, **kwargs):
|
|
|
111
112
|
|
|
112
113
|
__all__ = [
|
|
113
114
|
"Session",
|
|
114
|
-
"QbraidClient",
|
|
115
115
|
"QbraidClientV1",
|
|
116
|
-
"QbraidSession",
|
|
117
116
|
"QbraidSessionV1",
|
|
118
117
|
"PostForcelistRetry",
|
|
119
118
|
"client",
|
|
@@ -5,104 +5,13 @@
|
|
|
5
5
|
Module defining abstract base clas for qBraid micro-service clients.
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
|
-
|
|
9
|
-
import warnings
|
|
8
|
+
|
|
10
9
|
from typing import Any, Optional
|
|
11
10
|
|
|
12
11
|
from ._compat import check_version
|
|
13
12
|
from .config import load_config
|
|
14
13
|
from .exceptions import AuthError, RequestsApiError, ResourceNotFoundError, UserNotFoundError
|
|
15
|
-
from .sessions import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class QbraidClient:
|
|
19
|
-
"""Base class for qBraid micro-service clients."""
|
|
20
|
-
|
|
21
|
-
def __init__(self, api_key: Optional[str] = None, session: Optional[QbraidSession] = None):
|
|
22
|
-
if api_key and session:
|
|
23
|
-
raise ValueError("Provide either api_key or session, not both.")
|
|
24
|
-
|
|
25
|
-
self._user_metadata: Optional[dict[str, str]] = None
|
|
26
|
-
self.session = session or QbraidSession(api_key=api_key)
|
|
27
|
-
check_version("qbraid-core")
|
|
28
|
-
|
|
29
|
-
@property
|
|
30
|
-
def session(self) -> QbraidSession:
|
|
31
|
-
"""The QbraidSession used to make requests."""
|
|
32
|
-
return self._session
|
|
33
|
-
|
|
34
|
-
@session.setter
|
|
35
|
-
def session(self, value: Optional[QbraidSession]) -> None:
|
|
36
|
-
"""Set the QbraidSession, ensuring it is a valid QbraidSession instance.
|
|
37
|
-
|
|
38
|
-
Raises:
|
|
39
|
-
AuthError: If the provided session is not valid.
|
|
40
|
-
TypeError: If the value is not a QbraidSession instance.
|
|
41
|
-
"""
|
|
42
|
-
session = value if value is not None else QbraidSession()
|
|
43
|
-
|
|
44
|
-
if not isinstance(session, QbraidSession):
|
|
45
|
-
raise TypeError("The session must be a QbraidSession instance.")
|
|
46
|
-
|
|
47
|
-
try:
|
|
48
|
-
user = session.get_user()
|
|
49
|
-
self._user_metadata = {
|
|
50
|
-
"organization": user.get("organization", "qbraid"),
|
|
51
|
-
"role": user.get("role", "user"),
|
|
52
|
-
}
|
|
53
|
-
self._session = session
|
|
54
|
-
except UserNotFoundError as err:
|
|
55
|
-
raise AuthError(f"Access denied due to missing or invalid credentials: {err}") from err
|
|
56
|
-
|
|
57
|
-
@staticmethod
|
|
58
|
-
def _is_valid_object_id(candidate_id: str) -> bool:
|
|
59
|
-
"""
|
|
60
|
-
Check if the provided string is a valid MongoDB ObjectId format.
|
|
61
|
-
|
|
62
|
-
Args:
|
|
63
|
-
candidate_id (str): The string to check.
|
|
64
|
-
|
|
65
|
-
Returns:
|
|
66
|
-
bool: True if the string is a valid ObjectId format, False otherwise.
|
|
67
|
-
"""
|
|
68
|
-
try:
|
|
69
|
-
return bool(re.match(r"^[0-9a-fA-F]{24}$", candidate_id))
|
|
70
|
-
except (TypeError, SyntaxError):
|
|
71
|
-
return False
|
|
72
|
-
|
|
73
|
-
@staticmethod
|
|
74
|
-
def _convert_email_symbols(email: str) -> Optional[str]:
|
|
75
|
-
"""Convert email to compatible string format"""
|
|
76
|
-
return (
|
|
77
|
-
email.replace("-", "-2d")
|
|
78
|
-
.replace(".", "-2e")
|
|
79
|
-
.replace("@", "-40")
|
|
80
|
-
.replace("_", "-5f")
|
|
81
|
-
.replace("+", "-2b")
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
def user_credits_value(self) -> float:
|
|
85
|
-
"""
|
|
86
|
-
Get the current user's qBraid credits value.
|
|
87
|
-
|
|
88
|
-
.. deprecated::
|
|
89
|
-
Use :meth:`QbraidClientV1.user_credits_value` instead.
|
|
90
|
-
|
|
91
|
-
Returns:
|
|
92
|
-
float: The current user's qBraid credits value.
|
|
93
|
-
"""
|
|
94
|
-
warnings.warn(
|
|
95
|
-
"QbraidClient.user_credits_value() is deprecated. "
|
|
96
|
-
"Use QbraidClientV1.user_credits_value() instead.",
|
|
97
|
-
DeprecationWarning,
|
|
98
|
-
stacklevel=2,
|
|
99
|
-
)
|
|
100
|
-
try:
|
|
101
|
-
res = self.session.get("/billing/credits/get-user-credits").json()
|
|
102
|
-
credits_value = res["qbraidCredits"]
|
|
103
|
-
return float(credits_value)
|
|
104
|
-
except (RequestsApiError, KeyError, ValueError) as err:
|
|
105
|
-
raise ResourceNotFoundError(f"Credits value not found: {err}") from err
|
|
14
|
+
from .sessions import QbraidSessionV1
|
|
106
15
|
|
|
107
16
|
|
|
108
17
|
class QbraidClientV1: # pylint: disable=too-few-public-methods
|
|
@@ -178,6 +87,7 @@ class QbraidClientV1: # pylint: disable=too-few-public-methods
|
|
|
178
87
|
- organizationId (str): Organization ID
|
|
179
88
|
- userId (str): User ID
|
|
180
89
|
"""
|
|
90
|
+
assert self._user_metadata is not None
|
|
181
91
|
org_id = self._user_metadata.get("organizationId")
|
|
182
92
|
try:
|
|
183
93
|
res = self.session.get("/billing/credits/balance", params={"organizationId": org_id})
|
|
@@ -196,3 +106,7 @@ class QbraidClientV1: # pylint: disable=too-few-public-methods
|
|
|
196
106
|
return float(balance["qbraidCredits"])
|
|
197
107
|
except (KeyError, ValueError) as err:
|
|
198
108
|
raise ResourceNotFoundError(f"Credits value not found: {err}") from err
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class QbraidClient(QbraidClientV1):
|
|
112
|
+
"""Legacy client class for backwards compatibility."""
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
Module for saving/loading configuration to/from the qbraidrc file.
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
import configparser
|
|
9
10
|
import os
|
|
10
11
|
from pathlib import Path
|
|
@@ -13,15 +14,12 @@ from typing import Optional
|
|
|
13
14
|
from .exceptions import ConfigError
|
|
14
15
|
|
|
15
16
|
DEFAULT_CONFIG_SECTION = "default"
|
|
16
|
-
DEFAULT_ENDPOINT_URL = "https://api.qbraid.com/api"
|
|
17
|
-
DEFAULT_ORGANIZATION = "
|
|
17
|
+
DEFAULT_ENDPOINT_URL = "https://api-v2.qbraid.com/api/v1"
|
|
18
|
+
DEFAULT_ORGANIZATION = "organization:default"
|
|
18
19
|
DEFAULT_WORKSPACE = "qbraid"
|
|
19
|
-
SUPPORTED_WORKSPACES = {"qbraid", "aws"}
|
|
20
20
|
DEFAULT_CONFIG_PATH = Path.home() / ".qbraid" / "qbraidrc"
|
|
21
21
|
USER_CONFIG_PATH = os.getenv("QBRAID_CONFIG_FILE", str(DEFAULT_CONFIG_PATH))
|
|
22
22
|
|
|
23
|
-
DEFAULT_ENDPOINT_URL_V1 = "https://api.qbraid.com/api/v1"
|
|
24
|
-
|
|
25
23
|
|
|
26
24
|
def load_config(filepath: str = USER_CONFIG_PATH) -> configparser.ConfigParser:
|
|
27
25
|
"""Load the configuration from the file."""
|
|
@@ -9,6 +9,7 @@ Module containing custom ``urllib3.Retry`` class
|
|
|
9
9
|
import logging
|
|
10
10
|
from typing import Optional
|
|
11
11
|
|
|
12
|
+
from urllib3.response import BaseHTTPResponse
|
|
12
13
|
from urllib3.util.retry import Retry
|
|
13
14
|
|
|
14
15
|
STATUS_FORCELIST = (
|
|
@@ -36,7 +37,7 @@ class PostForcelistRetry(Retry):
|
|
|
36
37
|
through the qBraid API is safe.
|
|
37
38
|
"""
|
|
38
39
|
|
|
39
|
-
def increment(
|
|
40
|
+
def increment(
|
|
40
41
|
self,
|
|
41
42
|
method=None,
|
|
42
43
|
url=None,
|
|
@@ -87,7 +88,7 @@ class PostForcelistRetry(Retry):
|
|
|
87
88
|
|
|
88
89
|
return super().is_retry(method, status_code, has_retry_after)
|
|
89
90
|
|
|
90
|
-
def get_retry_after(self, response:
|
|
91
|
+
def get_retry_after(self, response: BaseHTTPResponse) -> Optional[float]:
|
|
91
92
|
"""Get the value of the Retry-After header with safeguards.
|
|
92
93
|
|
|
93
94
|
Handles cases where the server may have mistakenly sent milliseconds
|
|
@@ -9,25 +9,22 @@ Module defining qBraid service clients.
|
|
|
9
9
|
.. currentmodule:: qbraid_core.services
|
|
10
10
|
|
|
11
11
|
"""
|
|
12
|
+
|
|
12
13
|
import importlib
|
|
13
14
|
from typing import TYPE_CHECKING
|
|
14
15
|
|
|
15
|
-
__all__ = []
|
|
16
|
+
__all__ = []
|
|
16
17
|
|
|
17
18
|
_lazy = {
|
|
18
19
|
"environments": ["EnvironmentManagerClient"],
|
|
19
|
-
"quantum": ["QuantumClient"],
|
|
20
20
|
"runtime": ["QuantumRuntimeClient"],
|
|
21
|
-
"chat": ["ChatClient"],
|
|
22
21
|
"storage": ["FileStorageClient"],
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
if TYPE_CHECKING:
|
|
26
|
-
from .chat import ChatClient as ChatClient
|
|
27
25
|
from .environments import EnvironmentManagerClient as EnvironmentManagerClient
|
|
28
|
-
from .quantum import QuantumClient as QuantumClient
|
|
29
26
|
from .runtime import QuantumRuntimeClient as QuantumRuntimeClient
|
|
30
|
-
from .storage import
|
|
27
|
+
from .storage import DiskUsageClient as DiskUsageClient
|
|
31
28
|
|
|
32
29
|
|
|
33
30
|
def __getattr__(name):
|