Qubitra Python SDK
The Python client for the Qubitra platform. Submit quantum circuits to a backend, wait for them to finish, and read normalized results.
Full documentation, including a quickstart and the API reference, is at q-plat-dev.cloud.qubitra.io/docs.
Install
pip install qubitra-sdk
The distribution is qubitra-sdk and the import is qubitra. Python 3.11 or newer
is required. Optional extras integrate with quantum frameworks: qubitra-sdk[qiskit],
qubitra-sdk[cirq], qubitra-sdk[pennylane], qubitra-sdk[openqarp].
Quickstart
Create an API key in the Qubitra console and set it as QUBITRA_API_KEY, then:
from qubitra import QubitraClient
BELL = (
'OPENQASM 3.0; include "stdgates.inc"; qubit[2] q; bit[2] c; '
"h q[0]; cx q[0], q[1]; c = measure q;"
)
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="sim-statevector-26q",
circuit=BELL,
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}
Note that include "stdgates.inc"; is required in OpenQASM 3 programs: the language
defines no gates of its own, so h and cx are undefined without it.
Configuration
| Variable | Default | Meaning |
|---|---|---|
QUBITRA_API_KEY |
— | API key (qpk_…), required. Identifies your organization. |
QUBITRA_API_URL |
https://q.cloud.qubitra.io/api |
The Qubitra deployment to reach. |
Both can also be passed as constructor arguments — QubitraClient(api_key=…, api_url=…) —
which take precedence over the environment.
API surface
| Call | What it does |
|---|---|
client.backends.list() / .get(id) |
List the backends available to you, or read one by id. |
client.jobs.submit(...) |
Submit one circuit as a job; returns a Job immediately. |
client.jobs.run(backend_id=…, pubs=[…]) |
Submit an ordered list of PUBs as one job. |
client.jobs.quote(...) / .quote_run(...) |
What submitting would hold from your balance, without submitting. |
client.jobs.list() |
Your organization's jobs, newest first. |
client.jobs.get(id) / .result(id) / .cancel(id) |
Read status, fetch results, cancel. |
client.jobs.wait(id) |
Wait until the job reaches a terminal status. |
client.sessions.create(...) / .list() / .get(id) / .close(id) |
Group a run of jobs and bound its budget. |
client.apps.list() / .get(slug) |
Browse the marketplace's Applications, or read one. |
client.apps.acquire(slug) / .call(slug, inputs) |
Acquire an Application for your organization, and call it. |
client.acquisitions.list() / .accept(id, version) / .end(id) |
Manage your organization's acquisitions and their terms. |
client.author.create(...) / .publish_version(...) |
Publish your own Endpoint as an Application. |
A job carries an ordered list of PUBs (Primitive Unit Blocs). A Pub is a circuit
plus optional observables, parameter_values rows, and a shots count. JobResult.pubs
is index-aligned with the submission; each entry is a CountsResult,
ProbabilitiesResult, ExpectationValuesResult, or ErrorResult. For a single-circuit
submission, the convenience properties result.counts, .values, .probabilities, and
.shots read the first entry.
A Session groups a run of jobs under one id and bounds what the run may spend via
max_credits and max_seconds. It does not reserve hardware or affect queue priority.
Credits are whole: one credit is £1, and Backend.price gives each backend's price per
task, circuit, 1,000 shots or minute. Submitting a job holds its quote (Job.hold); when
it ends it is charged what it cost (Job.charge) and the rest returns to your balance.
jobs.result is available once a job is COMPLETED; calling it earlier raises
InvalidRequestError.
Errors
Every failure the SDK raises is a QubitraError. The subclasses are
AuthenticationError (with PermissionDeniedError and NotAcquiredError beneath it),
NotFoundError, InvalidRequestError (with InputValidationError),
InsufficientCreditsError, CeilingReachedError, ApplicationUnavailableError, and
ProviderError. Each carries the platform's error body
on .detail and the HTTP status on .status_code.
Typing
All models are frozen pydantic models, and the package ships py.typed, so the full
surface is visible to type checkers.
Metadata
Release files for qubitra-sdk 0.5.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.5.0.tar.gz | 148.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qubitra_sdk-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 238.0 kB
Release files / qubitra_sdk-0.5.0.tar.gz
| Download URL | qubitra_sdk-0.5.0.tar.gz |
|---|---|
| Size | 148.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c07b79713e86cfe01fbe4e52025d0c2dbc3bbdaaa03166cde818ae0a7c71e49a
|
|
BLAKE2b-256 checksum How to use checksums |
d8aac8af25d9a1eb1e8e43d4c2827fc24d5244daef44af386dcb756c974fa6cc
|
| 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.5.0-py3-none-any.whl
| Download URL | qubitra_sdk-0.5.0-py3-none-any.whl |
|---|---|
| Size | 89.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e2e484cfbcf1f5ebc37e2b1a1002877ecd1c0e7ba67751efa52b4d342ea9393
|
|
BLAKE2b-256 checksum How to use checksums |
5d7fe15e5c9ff629ec5efb0d539212c6e80ce8ae666b28fe392b358e3bfd804f
|
| 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}
|