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: Publish and Pre-release run the full test grid (Windows and every supported Python), all seven agent contract jobs, the format check and the docs build before anything is uploaded, and there is no CI on push to main. If a release fails there (most likely on Windows), 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.

CI, Agent contract tests, Format, Docs, SAST and Secret Scan can also be started from the Actions tab (Run workflow); CI and Agent contract tests take full for the whole grid. The label workflow and the release tagging start only from their events.

Windows runs only at publish, or on a manual CI run with full, 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.60

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.60
File Size Uploaded Provenance Actions
qbraid_core-0.6.60.tar.gz 1.3 MB Without provenance Details for qbraid_core-0.6.60.tar.gz

Built distribution (wheel)

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

Total release size: 2.5 MB

Release files / qbraid_core-0.6.60.tar.gz

Download URL qbraid_core-0.6.60.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
64d4deedbeef310cfe6ce871cfc822630c34485dd936e55fbb9abf51c46ae998
BLAKE2b-256 checksum
How to use checksums
62365a874367381141441fa663169d041f4bfacf49c16af46fbacf5827cb1bf5
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.60-py3-none-any.whl

Download URL qbraid_core-0.6.60-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
aac76d02ab05ebea40c514900a3beb5ed2836805ac125f0fd14e72ca0c7240a8
BLAKE2b-256 checksum
How to use checksums
476ea3288d9a32b92e8d31ea495880f0d577088cda0eb3860329ca7cb4071119
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.60

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.60 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