qbraid-core 0.2.3__tar.gz → 0.3.0__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.3/qbraid_core.egg-info → qbraid_core-0.3.0}/PKG-INFO +7 -10
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/README.md +2 -3
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/docs/api/qbraid_core.services.rst +4 -1
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/docs/index.rst +1 -1
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/pyproject.toml +15 -8
- qbraid_core-0.3.0/qbraid_core/_build_info.py +19 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/_version.py +9 -1
- qbraid_core-0.3.0/qbraid_core/diagnostics/__init__.py +16 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/auth.py +140 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/config.py +144 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/environments.py +180 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/jupyterlab.py +260 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/models.py +142 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/network.py +123 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/runner.py +96 -0
- qbraid_core-0.3.0/qbraid_core/diagnostics/system.py +198 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/__init__.py +9 -1
- qbraid_core-0.3.0/qbraid_core/services/agents/__init__.py +184 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/client.py +136 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/constants.py +135 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/discovery.py +957 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/exceptions.py +45 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/hooks.py +528 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/launcher.py +1655 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/messaging.py +261 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/opencode_api.py +278 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/permission_hook.py +157 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/permissions.py +231 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/registry.py +745 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/schemas.py +208 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/transcripts.py +672 -0
- qbraid_core-0.3.0/qbraid_core/services/agents/types.py +60 -0
- qbraid_core-0.3.0/qbraid_core/services/compute/__init__.py +135 -0
- qbraid_core-0.3.0/qbraid_core/services/compute/client.py +925 -0
- qbraid_core-0.3.0/qbraid_core/services/compute/exceptions.py +33 -0
- qbraid_core-0.3.0/qbraid_core/services/compute/schemas.py +361 -0
- qbraid_core-0.3.0/qbraid_core/services/compute/ssh.py +1190 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/__init__.py +98 -6
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/client.py +1218 -192
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/create.py +58 -101
- qbraid_core-0.3.0/qbraid_core/services/environments/kernels.py +535 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/packages.py +207 -26
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/paths.py +16 -7
- qbraid_core-0.3.0/qbraid_core/services/environments/preflight.py +114 -0
- qbraid_core-0.3.0/qbraid_core/services/environments/python.py +678 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/registry.py +596 -153
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/schema.py +12 -88
- qbraid_core-0.3.0/qbraid_core/services/environments/sync_progress.py +127 -0
- qbraid_core-0.3.0/qbraid_core/services/environments/utils/__init__.py +6 -0
- qbraid_core-0.3.0/qbraid_core/services/environments/validate.py +318 -0
- qbraid_core-0.3.0/qbraid_core/services/environments/venv.py +994 -0
- qbraid_core-0.3.0/qbraid_core/services/projects/__init__.py +44 -0
- qbraid_core-0.3.0/qbraid_core/services/projects/client.py +680 -0
- qbraid_core-0.3.0/qbraid_core/services/projects/exceptions.py +22 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/client.py +215 -8
- qbraid_core-0.3.0/qbraid_core/services/runtime/schemas/__init__.py +55 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/schemas/device.py +83 -6
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/schemas/job.py +84 -22
- qbraid_core-0.3.0/qbraid_core/services/skills/__init__.py +96 -0
- qbraid_core-0.3.0/qbraid_core/services/skills/client.py +820 -0
- qbraid_core-0.3.0/qbraid_core/services/skills/exceptions.py +21 -0
- qbraid_core-0.3.0/qbraid_core/services/skills/schemas.py +239 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/sessions.py +67 -2
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/executables.py +14 -2
- qbraid_core-0.3.0/qbraid_core/system/magic/__init__.py +46 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0/qbraid_core.egg-info}/PKG-INFO +7 -10
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core.egg-info/SOURCES.txt +44 -5
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core.egg-info/requires.txt +4 -5
- qbraid_core-0.3.0/tests/test_mypy_call_arg_validation.py +578 -0
- qbraid_core-0.2.3/qbraid_core/services/environments/kernels.py +0 -100
- qbraid_core-0.2.3/qbraid_core/services/environments/validate.py +0 -106
- qbraid_core-0.2.3/qbraid_core/services/mcp/__init__.py +0 -13
- qbraid_core-0.2.3/qbraid_core/services/mcp/client.py +0 -292
- qbraid_core-0.2.3/qbraid_core/services/mcp/discovery.py +0 -174
- qbraid_core-0.2.3/qbraid_core/services/mcp/router.py +0 -242
- qbraid_core-0.2.3/qbraid_core/services/runtime/schemas/__init__.py +0 -28
- qbraid_core-0.2.3/qbraid_core/system/magic/__init__.py +0 -30
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/LICENSE +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/MANIFEST.in +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/docs/_static/favicon.ico +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/docs/_static/logo.png +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/docs/api/qbraid_core.rst +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/docs/conf.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/__init__.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/_compat.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/_import.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/annotations.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/client.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/config.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/context.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/decimal.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/exceptions.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/py.typed +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/registry.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/retry.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/exceptions.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/magic.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/environments/state.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/quantum/__init__.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/quantum/runner.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/__init__.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/exceptions.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/schemas/enums.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/schemas/group.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/runtime/schemas/result.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/storage/__init__.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/storage/disk_usage_client.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/storage/exceptions.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/services/storage/types.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/__init__.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/exceptions.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/filemanager.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/generic.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/magic/manager.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/magic/qbraid_magic.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/packages.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core/system/versions.py +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core.egg-info/dependency_links.txt +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/qbraid_core.egg-info/top_level.txt +0 -0
- {qbraid_core-0.2.3 → qbraid_core-0.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qbraid-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
@@ -16,7 +16,6 @@ Classifier: Intended Audience :: System Administrators
|
|
|
16
16
|
Classifier: Natural Language :: English
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -31,7 +30,7 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
31
30
|
Classifier: Operating System :: POSIX
|
|
32
31
|
Classifier: Operating System :: Unix
|
|
33
32
|
Classifier: Operating System :: MacOS
|
|
34
|
-
Requires-Python: >=3.
|
|
33
|
+
Requires-Python: >=3.10
|
|
35
34
|
Description-Content-Type: text/markdown
|
|
36
35
|
License-File: LICENSE
|
|
37
36
|
Requires-Dist: requests
|
|
@@ -41,15 +40,14 @@ Requires-Dist: pydantic>2.0.0
|
|
|
41
40
|
Provides-Extra: runner
|
|
42
41
|
Requires-Dist: numpy; extra == "runner"
|
|
43
42
|
Requires-Dist: psutil; extra == "runner"
|
|
43
|
+
Provides-Extra: compute
|
|
44
|
+
Requires-Dist: websockets>=11.0; extra == "compute"
|
|
44
45
|
Provides-Extra: environments
|
|
45
46
|
Requires-Dist: jupyter_client>=7.1.0; extra == "environments"
|
|
46
47
|
Requires-Dist: ipython; extra == "environments"
|
|
47
|
-
Requires-Dist: pyyaml>6.0.0; extra == "environments"
|
|
48
48
|
Requires-Dist: ipykernel; extra == "environments"
|
|
49
|
+
Requires-Dist: pyyaml>6.0.0; extra == "environments"
|
|
49
50
|
Requires-Dist: zstandard; extra == "environments"
|
|
50
|
-
Requires-Dist: filelock; extra == "environments"
|
|
51
|
-
Provides-Extra: mcp
|
|
52
|
-
Requires-Dist: websockets>=11.0; extra == "mcp"
|
|
53
51
|
Provides-Extra: test
|
|
54
52
|
Requires-Dist: pytest; extra == "test"
|
|
55
53
|
Requires-Dist: pytest-cov; extra == "test"
|
|
@@ -71,8 +69,7 @@ Dynamic: license-file
|
|
|
71
69
|
[](https://pypi.org/project/qbraid-core/)
|
|
72
70
|
[](https://github.com/qBraid/community/issues)
|
|
73
71
|
|
|
74
|
-
Python library providing core abstractions for software development within the qBraid ecosystem, and a low-level interface to a growing array of qBraid cloud services. The qbraid-core package forms the foundational base for the [qBraid CLI](https://pypi.org/project/qbraid-cli/), the [qBraid SDK](https://pypi.org/project/qbraid/), and
|
|
75
|
-
[jupyter-environment-manager](https://pypi.org/project/jupyter-environment-manager/).
|
|
72
|
+
Python library providing core abstractions for software development within the qBraid ecosystem, and a low-level interface to a growing array of qBraid cloud services. The qbraid-core package forms the foundational base for the [qBraid CLI](https://pypi.org/project/qbraid-cli/), the [qBraid SDK](https://pypi.org/project/qbraid/), and [qBraid Lab](https://docs.qbraid.com/v2/lab/user-guide/overview).
|
|
76
73
|
|
|
77
74
|
You can find the latest, most up to date, documentation [here](https://qbraid.github.io/qbraid-core/), including a list of services that are supported.
|
|
78
75
|
|
|
@@ -108,7 +105,7 @@ Or generate your `~/.qbraid/qbraidrc` file via the qbraid-core Python interface:
|
|
|
108
105
|
>>> session = QbraidSessionV1(api_key='API_KEY')
|
|
109
106
|
>>> session.save_config()
|
|
110
107
|
>>> session.get_available_services()
|
|
111
|
-
['environments', 'runtime', 'storage']
|
|
108
|
+
['agents', 'compute', 'environments', 'projects', 'runtime', 'skills', 'storage']
|
|
112
109
|
```
|
|
113
110
|
|
|
114
111
|
Other credential configuration methods are available using the [qBraid-CLI](https://docs.qbraid.com/v2/cli/api-reference/qbraid_configure).
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
[](https://pypi.org/project/qbraid-core/)
|
|
7
7
|
[](https://github.com/qBraid/community/issues)
|
|
8
8
|
|
|
9
|
-
Python library providing core abstractions for software development within the qBraid ecosystem, and a low-level interface to a growing array of qBraid cloud services. The qbraid-core package forms the foundational base for the [qBraid CLI](https://pypi.org/project/qbraid-cli/), the [qBraid SDK](https://pypi.org/project/qbraid/), and
|
|
10
|
-
[jupyter-environment-manager](https://pypi.org/project/jupyter-environment-manager/).
|
|
9
|
+
Python library providing core abstractions for software development within the qBraid ecosystem, and a low-level interface to a growing array of qBraid cloud services. The qbraid-core package forms the foundational base for the [qBraid CLI](https://pypi.org/project/qbraid-cli/), the [qBraid SDK](https://pypi.org/project/qbraid/), and [qBraid Lab](https://docs.qbraid.com/v2/lab/user-guide/overview).
|
|
11
10
|
|
|
12
11
|
You can find the latest, most up to date, documentation [here](https://qbraid.github.io/qbraid-core/), including a list of services that are supported.
|
|
13
12
|
|
|
@@ -43,7 +42,7 @@ Or generate your `~/.qbraid/qbraidrc` file via the qbraid-core Python interface:
|
|
|
43
42
|
>>> session = QbraidSessionV1(api_key='API_KEY')
|
|
44
43
|
>>> session.save_config()
|
|
45
44
|
>>> session.get_available_services()
|
|
46
|
-
['environments', 'runtime', 'storage']
|
|
45
|
+
['agents', 'compute', 'environments', 'projects', 'runtime', 'skills', 'storage']
|
|
47
46
|
```
|
|
48
47
|
|
|
49
48
|
Other credential configuration methods are available using the [qBraid-CLI](https://docs.qbraid.com/v2/cli/api-reference/qbraid_configure).
|
|
@@ -16,7 +16,7 @@ Overview
|
|
|
16
16
|
|
|
17
17
|
Python library providing core abstractions for software development within the qBraid ecosystem, and a low-level interface
|
|
18
18
|
to a growing array of qBraid cloud services. The qbraid-core package forms the foundational base for the `qBraid CLI <https://pypi.org/project/qbraid-cli/>`_,
|
|
19
|
-
the `qBraid SDK <https://pypi.org/project/qbraid/>`_, and
|
|
19
|
+
the `qBraid SDK <https://pypi.org/project/qbraid/>`_, and `qBraid Lab <https://docs.qbraid.com/v2/lab/user-guide/overview/>`_.
|
|
20
20
|
|
|
21
21
|
.. seealso::
|
|
22
22
|
|
|
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qbraid-core"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
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"
|
|
11
|
-
requires-python = ">=3.
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
12
|
keywords = ["qbraid", "quantum", "cloud"]
|
|
13
13
|
license = {text = "Proprietary"}
|
|
14
14
|
classifiers = [
|
|
@@ -18,7 +18,6 @@ classifiers = [
|
|
|
18
18
|
"Natural Language :: English",
|
|
19
19
|
"Programming Language :: Python",
|
|
20
20
|
"Programming Language :: Python :: 3",
|
|
21
|
-
"Programming Language :: Python :: 3.9",
|
|
22
21
|
"Programming Language :: Python :: 3.10",
|
|
23
22
|
"Programming Language :: Python :: 3.11",
|
|
24
23
|
"Programming Language :: Python :: 3.12",
|
|
@@ -34,7 +33,12 @@ classifiers = [
|
|
|
34
33
|
"Operating System :: Unix",
|
|
35
34
|
"Operating System :: MacOS"
|
|
36
35
|
]
|
|
37
|
-
dependencies = [
|
|
36
|
+
dependencies = [
|
|
37
|
+
"requests",
|
|
38
|
+
"urllib3",
|
|
39
|
+
"packaging",
|
|
40
|
+
"pydantic>2.0.0",
|
|
41
|
+
]
|
|
38
42
|
|
|
39
43
|
[project.urls]
|
|
40
44
|
Homepage = "https://sdk.qbraid.com/qbraid-core/"
|
|
@@ -44,14 +48,14 @@ Discord = "https://discord.gg/KugF6Cnncm"
|
|
|
44
48
|
|
|
45
49
|
[project.optional-dependencies]
|
|
46
50
|
runner = ["numpy", "psutil"]
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
compute = ["websockets>=11.0"]
|
|
52
|
+
environments = ["jupyter_client>=7.1.0", "ipython", "ipykernel", "pyyaml>6.0.0", "zstandard"]
|
|
49
53
|
test = ["pytest", "pytest-cov", "pytest-asyncio"]
|
|
50
54
|
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"]
|
|
51
55
|
|
|
52
56
|
[tool.black]
|
|
53
57
|
line-length = 100
|
|
54
|
-
target-version = ["
|
|
58
|
+
target-version = ["py310", "py311", "py312", "py313"]
|
|
55
59
|
|
|
56
60
|
[tool.isort]
|
|
57
61
|
profile = "black"
|
|
@@ -63,10 +67,13 @@ line_length = 100
|
|
|
63
67
|
|
|
64
68
|
[tool.pylint.'MESSAGES CONTROL']
|
|
65
69
|
max-line-length = 100
|
|
66
|
-
disable = "
|
|
70
|
+
disable = "C0302,C0415,E0401,E1101,R0401,R0801,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0917,R1702,R1732,W0150,W0212,W0511,W0613,W0621,W0705,W0718"
|
|
67
71
|
|
|
68
72
|
[tool.pylint.MASTER]
|
|
69
73
|
|
|
74
|
+
[tool.setuptools.package-data]
|
|
75
|
+
qbraid_core = ["py.typed"]
|
|
76
|
+
|
|
70
77
|
[tool.pytest.ini_options]
|
|
71
78
|
addopts = "--cov=qbraid_core --cov-report=term --cov-report=xml"
|
|
72
79
|
testpaths = ["tests"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright (c) 2025, qBraid Development Team
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Build metadata — auto-generated by bin/build_wheel.py during wheel builds.
|
|
6
|
+
For editable installs, this file contains placeholder values.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
BUILD_INFO = {
|
|
10
|
+
"version": "dev",
|
|
11
|
+
"base_version": "dev",
|
|
12
|
+
"branch": "",
|
|
13
|
+
"commit": "",
|
|
14
|
+
"commit_full": "",
|
|
15
|
+
"commit_message": "",
|
|
16
|
+
"recent_changes": [],
|
|
17
|
+
"build_date": "",
|
|
18
|
+
"dirty": True,
|
|
19
|
+
}
|
|
@@ -6,6 +6,7 @@ Module defining package version.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import importlib.metadata
|
|
9
|
+
from typing import Optional
|
|
9
10
|
|
|
10
11
|
try:
|
|
11
12
|
__version__ = importlib.metadata.version("qbraid-core")
|
|
@@ -14,4 +15,11 @@ except Exception: # pylint: disable=broad-exception-caught # pragma: no cover
|
|
|
14
15
|
|
|
15
16
|
__version_tuple__ = tuple(int(part) if part.isdigit() else part for part in __version__.split("."))
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
BUILD_INFO: Optional[dict[str, object]]
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
from ._build_info import BUILD_INFO # noqa: F811
|
|
22
|
+
except ImportError:
|
|
23
|
+
BUILD_INFO = None
|
|
24
|
+
|
|
25
|
+
__all__ = ["__version__", "__version_tuple__", "BUILD_INFO"]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Copyright (c) 2025, qBraid Development Team
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Diagnostics module for troubleshooting qBraid platform issues.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from qbraid_core.diagnostics import run_diagnostics
|
|
9
|
+
report = run_diagnostics()
|
|
10
|
+
print(report.summary())
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from .models import CheckResult, CheckStatus, DiagnosticReport
|
|
14
|
+
from .runner import run_diagnostics
|
|
15
|
+
|
|
16
|
+
__all__ = ["CheckResult", "CheckStatus", "DiagnosticReport", "run_diagnostics"]
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Copyright (c) 2025, qBraid Development Team
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
"""Authentication diagnostic checks."""
|
|
5
|
+
|
|
6
|
+
from .models import CheckResult, CheckStatus
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def run_checks(verbose: bool = False) -> list[CheckResult]: # noqa: ARG001
|
|
10
|
+
"""Run authentication diagnostic checks."""
|
|
11
|
+
results = []
|
|
12
|
+
results.append(_check_api_key_present())
|
|
13
|
+
results.append(_check_access_token_present())
|
|
14
|
+
results.append(_check_credentials_valid())
|
|
15
|
+
return results
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _check_api_key_present() -> CheckResult:
|
|
19
|
+
"""Check if an API key is configured."""
|
|
20
|
+
import os
|
|
21
|
+
|
|
22
|
+
api_key = os.environ.get("QBRAID_API_KEY")
|
|
23
|
+
if api_key:
|
|
24
|
+
return CheckResult(
|
|
25
|
+
name="auth.api_key_present",
|
|
26
|
+
category="auth",
|
|
27
|
+
status=CheckStatus.PASS,
|
|
28
|
+
message="API key found in QBRAID_API_KEY environment variable.",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
from qbraid_core.config import DEFAULT_CONFIG_SECTION, load_config
|
|
33
|
+
|
|
34
|
+
config = load_config()
|
|
35
|
+
section = DEFAULT_CONFIG_SECTION
|
|
36
|
+
if config.has_section(section):
|
|
37
|
+
# Check for exact "api-key" or any "api-key-*" named key
|
|
38
|
+
if config.has_option(section, "api-key"):
|
|
39
|
+
key = config.get(section, "api-key")
|
|
40
|
+
if key and key.strip():
|
|
41
|
+
return CheckResult(
|
|
42
|
+
name="auth.api_key_present",
|
|
43
|
+
category="auth",
|
|
44
|
+
status=CheckStatus.PASS,
|
|
45
|
+
message="API key found in qbraidrc config file.",
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
named_keys = [k for k in config.options(section) if k.startswith("api-key-")]
|
|
49
|
+
if named_keys:
|
|
50
|
+
return CheckResult(
|
|
51
|
+
name="auth.api_key_present",
|
|
52
|
+
category="auth",
|
|
53
|
+
status=CheckStatus.PASS,
|
|
54
|
+
message=(
|
|
55
|
+
f"Found {len(named_keys)} named API key(s) in config:"
|
|
56
|
+
f" {', '.join(named_keys)}"
|
|
57
|
+
),
|
|
58
|
+
)
|
|
59
|
+
except Exception:
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
return CheckResult(
|
|
63
|
+
name="auth.api_key_present",
|
|
64
|
+
category="auth",
|
|
65
|
+
status=CheckStatus.FAIL,
|
|
66
|
+
message="No API key found.",
|
|
67
|
+
fix_hint="Run 'qbraid configure set api-key <YOUR_KEY>' or set QBRAID_API_KEY env var.",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _check_access_token_present() -> CheckResult:
|
|
72
|
+
"""Check if an access token is configured."""
|
|
73
|
+
import os
|
|
74
|
+
|
|
75
|
+
token = os.environ.get("QBRAID_ACCESS_TOKEN")
|
|
76
|
+
if token:
|
|
77
|
+
return CheckResult(
|
|
78
|
+
name="auth.access_token_present",
|
|
79
|
+
category="auth",
|
|
80
|
+
status=CheckStatus.PASS,
|
|
81
|
+
message="Access token found in QBRAID_ACCESS_TOKEN environment variable.",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
from qbraid_core.config import DEFAULT_CONFIG_SECTION, load_config
|
|
86
|
+
|
|
87
|
+
config = load_config()
|
|
88
|
+
if config.has_option(DEFAULT_CONFIG_SECTION, "access-token"):
|
|
89
|
+
tok = config.get(DEFAULT_CONFIG_SECTION, "access-token")
|
|
90
|
+
if tok and tok.strip():
|
|
91
|
+
return CheckResult(
|
|
92
|
+
name="auth.access_token_present",
|
|
93
|
+
category="auth",
|
|
94
|
+
status=CheckStatus.PASS,
|
|
95
|
+
message="Access token found in qbraidrc config file.",
|
|
96
|
+
)
|
|
97
|
+
except Exception:
|
|
98
|
+
pass
|
|
99
|
+
|
|
100
|
+
return CheckResult(
|
|
101
|
+
name="auth.access_token_present",
|
|
102
|
+
category="auth",
|
|
103
|
+
status=CheckStatus.SKIP,
|
|
104
|
+
message="No access token configured (optional — API key is sufficient).",
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _check_credentials_valid() -> CheckResult:
|
|
109
|
+
"""Verify credentials by calling /users/verify."""
|
|
110
|
+
try:
|
|
111
|
+
from qbraid_core.sessions import QbraidSessionV1
|
|
112
|
+
|
|
113
|
+
session = QbraidSessionV1()
|
|
114
|
+
|
|
115
|
+
if not session.api_key and not session.access_token:
|
|
116
|
+
return CheckResult(
|
|
117
|
+
name="auth.credentials_valid",
|
|
118
|
+
category="auth",
|
|
119
|
+
status=CheckStatus.SKIP,
|
|
120
|
+
message="No credentials to validate.",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
metadata = session.get_user_auth_metadata()
|
|
124
|
+
user_id = metadata.get("userId", "unknown")
|
|
125
|
+
org_id = metadata.get("organizationId", "unknown")
|
|
126
|
+
return CheckResult(
|
|
127
|
+
name="auth.credentials_valid",
|
|
128
|
+
category="auth",
|
|
129
|
+
status=CheckStatus.PASS,
|
|
130
|
+
message=f"Credentials valid. User: {user_id}, Org: {org_id}",
|
|
131
|
+
details={"userId": user_id, "organizationId": org_id},
|
|
132
|
+
)
|
|
133
|
+
except Exception as exc:
|
|
134
|
+
return CheckResult(
|
|
135
|
+
name="auth.credentials_valid",
|
|
136
|
+
category="auth",
|
|
137
|
+
status=CheckStatus.FAIL,
|
|
138
|
+
message=f"Credential validation failed: {exc}",
|
|
139
|
+
fix_hint="Check your API key is correct. Run 'qbraid configure set api-key <KEY>'.",
|
|
140
|
+
)
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Copyright (c) 2025, qBraid Development Team
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
"""Configuration diagnostic checks."""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from .models import CheckResult, CheckStatus
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def run_checks(verbose: bool = False) -> list[CheckResult]: # noqa: ARG001
|
|
13
|
+
"""Run configuration diagnostic checks."""
|
|
14
|
+
results = []
|
|
15
|
+
results.append(_check_config_file_exists())
|
|
16
|
+
results.append(_check_config_parseable())
|
|
17
|
+
results.append(_check_config_url())
|
|
18
|
+
results.append(_check_config_dir_writable())
|
|
19
|
+
return results
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _check_config_file_exists() -> CheckResult:
|
|
23
|
+
"""Check if the qBraid config file exists."""
|
|
24
|
+
config_path = Path.home() / ".qbraid" / "qbraidrc"
|
|
25
|
+
if config_path.exists():
|
|
26
|
+
return CheckResult(
|
|
27
|
+
name="config.file_exists",
|
|
28
|
+
category="config",
|
|
29
|
+
status=CheckStatus.PASS,
|
|
30
|
+
message=f"Config file found at {config_path}",
|
|
31
|
+
)
|
|
32
|
+
return CheckResult(
|
|
33
|
+
name="config.file_exists",
|
|
34
|
+
category="config",
|
|
35
|
+
status=CheckStatus.WARN,
|
|
36
|
+
message=f"Config file not found at {config_path}",
|
|
37
|
+
fix_hint="Run 'qbraid configure set api-key <KEY>' to create it.",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _check_config_parseable() -> CheckResult:
|
|
42
|
+
"""Check if the qBraid config file can be parsed."""
|
|
43
|
+
try:
|
|
44
|
+
from qbraid_core.config import load_config
|
|
45
|
+
|
|
46
|
+
config = load_config()
|
|
47
|
+
sections = config.sections()
|
|
48
|
+
return CheckResult(
|
|
49
|
+
name="config.parseable",
|
|
50
|
+
category="config",
|
|
51
|
+
status=CheckStatus.PASS,
|
|
52
|
+
message=f"Config file parsed successfully. Sections: {sections}",
|
|
53
|
+
)
|
|
54
|
+
except FileNotFoundError:
|
|
55
|
+
return CheckResult(
|
|
56
|
+
name="config.parseable",
|
|
57
|
+
category="config",
|
|
58
|
+
status=CheckStatus.SKIP,
|
|
59
|
+
message="Config file does not exist.",
|
|
60
|
+
)
|
|
61
|
+
except Exception as exc:
|
|
62
|
+
return CheckResult(
|
|
63
|
+
name="config.parseable",
|
|
64
|
+
category="config",
|
|
65
|
+
status=CheckStatus.FAIL,
|
|
66
|
+
message=f"Config file parse error: {exc}",
|
|
67
|
+
fix_hint="Check ~/.qbraid/qbraidrc for syntax errors. It uses INI format.",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _check_config_url() -> CheckResult:
|
|
72
|
+
"""Check that the configured API URL looks valid."""
|
|
73
|
+
try:
|
|
74
|
+
from qbraid_core.config import (
|
|
75
|
+
DEFAULT_CONFIG_SECTION,
|
|
76
|
+
DEFAULT_ENDPOINT_URL,
|
|
77
|
+
load_config,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
url = os.environ.get("QBRAID_API_URL")
|
|
81
|
+
source = "QBRAID_API_URL env var"
|
|
82
|
+
|
|
83
|
+
if not url:
|
|
84
|
+
try:
|
|
85
|
+
config = load_config()
|
|
86
|
+
if config.has_option(DEFAULT_CONFIG_SECTION, "url"):
|
|
87
|
+
url = config.get(DEFAULT_CONFIG_SECTION, "url")
|
|
88
|
+
source = "qbraidrc config"
|
|
89
|
+
except Exception:
|
|
90
|
+
pass
|
|
91
|
+
|
|
92
|
+
if not url:
|
|
93
|
+
url = DEFAULT_ENDPOINT_URL
|
|
94
|
+
source = "default"
|
|
95
|
+
|
|
96
|
+
if not url.startswith(("http://", "https://")):
|
|
97
|
+
return CheckResult(
|
|
98
|
+
name="config.api_url",
|
|
99
|
+
category="config",
|
|
100
|
+
status=CheckStatus.FAIL,
|
|
101
|
+
message=f"API URL is not a valid HTTP(S) URL: {url}",
|
|
102
|
+
fix_hint="Run 'qbraid configure set url https://...'",
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return CheckResult(
|
|
106
|
+
name="config.api_url",
|
|
107
|
+
category="config",
|
|
108
|
+
status=CheckStatus.PASS,
|
|
109
|
+
message=f"API URL: {url} (source: {source})",
|
|
110
|
+
)
|
|
111
|
+
except Exception as exc:
|
|
112
|
+
return CheckResult(
|
|
113
|
+
name="config.api_url",
|
|
114
|
+
category="config",
|
|
115
|
+
status=CheckStatus.ERROR,
|
|
116
|
+
message=f"Could not check API URL: {exc}",
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _check_config_dir_writable() -> CheckResult:
|
|
121
|
+
"""Check that ~/.qbraid directory exists and is writable."""
|
|
122
|
+
qbraid_dir = Path.home() / ".qbraid"
|
|
123
|
+
if not qbraid_dir.exists():
|
|
124
|
+
return CheckResult(
|
|
125
|
+
name="config.dir_writable",
|
|
126
|
+
category="config",
|
|
127
|
+
status=CheckStatus.WARN,
|
|
128
|
+
message="~/.qbraid directory does not exist.",
|
|
129
|
+
fix_hint="It will be created automatically when you first configure qBraid.",
|
|
130
|
+
)
|
|
131
|
+
if not os.access(qbraid_dir, os.W_OK):
|
|
132
|
+
return CheckResult(
|
|
133
|
+
name="config.dir_writable",
|
|
134
|
+
category="config",
|
|
135
|
+
status=CheckStatus.FAIL,
|
|
136
|
+
message="~/.qbraid directory is not writable.",
|
|
137
|
+
fix_hint=f"Fix permissions: chmod 755 {qbraid_dir}",
|
|
138
|
+
)
|
|
139
|
+
return CheckResult(
|
|
140
|
+
name="config.dir_writable",
|
|
141
|
+
category="config",
|
|
142
|
+
status=CheckStatus.PASS,
|
|
143
|
+
message="~/.qbraid directory exists and is writable.",
|
|
144
|
+
)
|