niobium — the Qubitra Python SDK
The Python client for the Qubitra platform. Codename niobium; it installs as
qubitra-sdk and imports as qubitra (ADR-0041 D1).
The SDK speaks q-platform vocabulary — Backends, Jobs, Offerings — and talks to the
Qubitra API's public /v1 surface. Which backend a Job actually lands on, and the
supply chain behind it, is the platform's business: the SDK never names a vendor.
Install
pip install qubitra-sdk
Inside this repo it is a uv workspace member, so uv sync at the root installs it
editable and no publish step is involved.
Quickstart
from qubitra import QubitraClient
with QubitraClient() as client:
for backend in client.backends.list():
print(backend.id, backend.qubit_count, backend.supported_formats)
job = client.jobs.submit(
backend_id="qpu-superconducting-127q",
circuit="OPENQASM 3.0; qubit[2] q; bit[2] c; h q[0]; cx q[0], q[1]; c = measure q;",
shots=1024,
name="bell-pair",
)
job = client.jobs.wait(job.id, timeout=600)
if job.status.is_terminal and job.error:
raise SystemExit(f"job {job.id} failed: {job.error}")
print(client.jobs.result(job.id).counts) # {"00": 512, "11": 512}
Two runnable versions of that sit in examples/: submit_bell_pair.py is the whole path,
and list_backends.py is the read-only smoke test. Both take their key from the environment:
QUBITRA_API_KEY=qpk_... uv run pkg/niobium/examples/submit_bell_pair.py
Against a local stack (mise run dev:qplat), add QUBITRA_API_URL=http://localhost:8080 and
mint a key on the console's API keys page.
Configuration
| Variable | Default | Meaning |
|---|---|---|
QUBITRA_API_KEY |
— | API key (qpk_…), required. Resolves to your organization. |
QUBITRA_API_URL |
http://localhost:8080 |
The Qubitra deployment to reach. |
Both are also constructor arguments — QubitraClient(api_key=…, api_url=…) — which
take precedence over the environment.
Surface
| Call | What it does |
|---|---|
client.backends.list() / .get(id) |
The backends available to you, and one by id. |
client.jobs.submit(...) |
Submit a circuit; returns a Job immediately. |
client.jobs.list() |
Your organization's jobs, newest first. |
client.jobs.get(id) / .result(id) / .cancel(id) |
Read status, fetch counts, cancel. |
client.jobs.wait(id) |
Poll until the Job reaches a terminal status. |
client.marketplace.offerings() |
The marketplace catalogue. |
jobs.result is valid once a Job is COMPLETED; asking earlier raises
InvalidRequestError.
Every failure is a QubitraError: AuthenticationError, NotFoundError,
InvalidRequestError, InsufficientCreditsError, or ProviderError. Each carries
the platform's RFC 9457 Problem Details body (ADR-0008) on .detail and its HTTP
status on .status_code.
Models are frozen pydantic models; the package ships py.typed, so a caller's type
checker sees the whole surface.
Layout
src/qubitra/— the public facade:client.py,models.py,errors.py,credentials.py.src/qubitra/_providers/— the adapter seam (ADR-0041 D2).base.pyis the protocol the facade depends on;qubitra.pyimplements it over/v1. A second platform slots in here without touching the facade.tests/— facade behaviour over a fake adapter, plus contract tests driving the adapter's real request path against an httpxMockTransport.
The SDK is synchronous (ADR-0041 D7); client objects own their transport, so an async twin is additive.
Tasks
mise exec -- uv run pytest pkg/niobium -q # tests
mise exec -- mypy pkg/niobium # types
mise exec -- ruff check pkg/niobium # lint
Release files for qubitra-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qubitra_sdk-0.1.0.tar.gz | 20.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qubitra_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.4 kB
Release files / qubitra_sdk-0.1.0.tar.gz
| Download URL | qubitra_sdk-0.1.0.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12d7353a1c5464f4f5fca01e36506855873b9f72a2b41e0d8eeb843052f4c190
|
|
BLAKE2b-256 checksum How to use checksums |
5ed440415961c994b69328560c31cb7ba476d0a888918038cd70e332b4346d36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / qubitra_sdk-0.1.0-py3-none-any.whl
| Download URL | qubitra_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58f3b2b4be40f153a4ccb9c19130cee49e6bd471b0a29386a72370df0f941176
|
|
BLAKE2b-256 checksum How to use checksums |
2ef51fe0a071f5082c1cf720bbb1dd97f4d6d68b0d32b3e0c7f9356da20b1732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|