Skip to main content

qbraid-core

Documentation codecov PyPI version Python verions GitHub

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, the qBraid SDK, and qBraid Lab.

You can find the latest, most up to date, documentation here, including a list of services that are supported.

See also: qbraid-core-js

Getting Started

You can install qbraid-core from PyPI with:

python -m pip install qbraid-core

Local configuration

After installing qbraid-core, you must configure your account credentials:

  1. Create a qBraid account or log in to your existing account by visiting account.qbraid.com
  2. Navigate to Account > API Keys in the left-sidebar, and then click "Create API Key". See API Key docs.
  3. Save your API key from step 2 in local configuration file. 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.
[default]
api-key = YOUR_KEY
url = https://api-v2.qbraid.com/api/v1

Or generate your ~/.qbraid/qbraidrc file via the qbraid-core Python interface:

>>> from qbraid_core import QbraidSessionV1
>>> session = QbraidSessionV1(api_key='API_KEY')
>>> session.save_config()
>>> session.get_available_services()
['agents', 'compute', 'environments', 'projects', 'runtime', 'skills', 'storage']

Other credential configuration methods are available using the qBraid-CLI.

Verify setup

After configuring your qBraid credentials, verify your setup by running the following from a Python interpreter:

>>> import qbraid_core
>>> quantum_runtime_client = qbraid_core.client('runtime')
>>> devices = quantum_runtime_client.list_devices()
>>> for device in devices:
...     print(device.qrn, device.status)

Contributing

Tests run on the machine you develop on, not on GitHub. Before asking for review, run the full local checks:

tox -e format-check        # isort, black, mypy, ruff, headers (tox -e linters fixes most)
tox -e unit-tests          # pytest (adds jupyter-server for the Jupyter auth tests)
tox -e docs                # when you touch docstrings or docs/

Without tox: pip install -e '.[test,environments,compute]' 'jupyter-server>=2,<3' 'jupyter-server-terminals>=0.5,<1' && pytest. With pytest-xdist, pytest -n auto sizes itself from the cgroup CPU/memory limits (at most 6 workers, ~1 GiB each; tests/_workers.py); -n N overrides it.

When you touch qbraid_core/services/agents/, also run the agent contract suite, in the offline sandbox that tests/agents_contract/README.md describes (never from a shell inside a live agent session).

GitHub runs only Secret Scan and SAST on a PR. The heavy suite runs at publish, and there is no CI on push to main. Publish and Pre-release call Release gates (release-gates.yml), which starts every gate at once: the full test grid (Windows 3.11 to 3.14, Linux 3.10 to 3.14, pytest -n auto), all seven agent contract pins (Claude in two shards each), format and docs. Nothing is uploaded unless every gate succeeds. SAST runs beside them as a report that never fails the release: a full scan of qbraid_core/ is not clean yet, so it cannot gate one (a PR still fails on findings it adds). Expected time: about 12 to 15 minutes for the gates and under a minute for the build and upload (it was about 30, Windows first and the rest after it). Run with full off for a quick release: Windows 3.12, Linux 3.10 and 3.14, and the newest pin of each agent plus the Lab image's. Before a release, check the candidate on Windows alone: CI → Run workflow with full and platform: windows. If a release fails, fix everything in one PR, and once it merges start the same workflow (Publish or Pre-release) again with Run workflow on the updated main (Re-run jobs reuses the old commit).

To run CI on a PR into main anyway, add the ci label. It is one-shot: it runs the suite once on that commit (Linux only, the newest pin of each agent). The label comes off as the run starts, so later pushes run nothing; add it again to re-run (adding it during a run replaces the run in flight). On a stacked PR (into another branch) or a PR with merge conflicts, GitHub starts no run and the label stays on: remove it, fix the base or the conflict, and add it again. A Dependabot PR (or any PR from a dependabot/ branch) runs without secrets; still read the bump before you label it, since its new dependency runs in the job. A fork's PR gets a read-only token, so its label stays on: remove ci by hand. Whether a fork's run sees secrets is decided by the repository's fork-PR settings, not by the workflow, which the fork can edit.

Release gates, CI, Agent contract tests, Format, Docs, SAST and Secret Scan can also be started from the Actions tab (Run workflow); Release gates, CI and Agent contract tests take full for the whole grid, and CI takes release for the quick release grid, fail-fast to stop at the first failed row, and platform: windows for Windows alone. The label workflow and the release tagging start only from their events.

Windows runs only at publish, or on a manual run, so keep code portable: build paths with pathlib or os.path, never hard-code /, don't rely on file modes, symlinks or case-sensitive names, and open text files with an explicit encoding.

Community

Metadata

Release files for qbraid-core 0.6.63

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qbraid-core 0.6.63
File Size Uploaded Provenance Actions
qbraid_core-0.6.63.tar.gz 1.4 MB Without provenance Details for qbraid_core-0.6.63.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qbraid-core 0.6.63
File Interpreter ABI Platform Actions
qbraid_core-0.6.63-py3-none-any.whl Python 3 none any Details for qbraid_core-0.6.63-py3-none-any.whl

Total release size: 2.6 MB

Release files / qbraid_core-0.6.63.tar.gz

Download URL qbraid_core-0.6.63.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
946740d25a7864943430d35f9d84e7d488439debc67cfdc4146167682b470561
BLAKE2b-256 checksum
How to use checksums
0976abc4a63647a3fa657567c5b18483085565dbf606b446e91e8a10e7cdf0f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / qbraid_core-0.6.63-py3-none-any.whl

Download URL qbraid_core-0.6.63-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d4c968898f602cedac126cbb22796960d8063c6fc40aa453730084032762f870
BLAKE2b-256 checksum
How to use checksums
200a6b75b0dd2cbb9e7d402a3502f766d1f549aad791854093397dfa349bdad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for qbraid-core 0.6.63

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.63 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page