Python client for the QDash API
Project description
qdash.client README
qdash.client is a Python client for calling the QDash API.
services: domain logic such as authentication, retries, and response normalizationrest: low-level HTTP communication
This package follows the same approach as oqtopus-client, separating the transport layer from the service layer.
For user-facing examples, see docs/user-guide/qdash-client.md.
Installation
Install the lightweight client package when only programmatic API access is needed.
pip install qdash-client
For development against this repository:
pip install ./src/qdash/client
The distribution name is qdash-client, but the Python import path is qdash.client.
Publishing
qdash-client is published from this repository with PyPI Trusted Publishing. Configure the
qdash-client project on PyPI to trust this GitHub repository and the
.github/workflows/publish-qdash-client.yml workflow.
Release tags use the qdash-client-v<version> format. Do not edit a package version in
pyproject.toml; the package version is derived from the matching Git tag at build time.
git tag qdash-client-v<version>
git push origin qdash-client-v<version>
Minimal Quick Start
This is a minimal example using /chips, /metrics/config, and /task-results/timeseries.
from qdash.client import QDashClient
client = QDashClient()
try:
chips = client.list_chips()
print(chips.total)
print([chip.chip_id for chip in chips.chips])
metrics_config = client.get_metrics_config()
print(metrics_config.keys())
series = client.get_task_results_timeseries(
chip_id="chip-001",
parameter="t1",
start_at="2026-06-01T00:00:00Z",
end_at="2026-06-02T00:00:00Z",
)
print(series.data)
finally:
client.close()
1. Public API
In most cases, you will use the following:
QDashClientQDashConfig- Exception classes such as
QDashApiError
from qdash.client import QDashClient, QDashConfig
2. Configuration
2.1 From Environment Variables
from qdash.client import QDashConfig, QDashClient
config = QDashConfig.from_env()
client = QDashClient(config)
Main environment variables:
QDASH_BASE_URLQDASH_API_TOKENQDASH_PROJECT_IDQDASH_CF_ACCESS_CLIENT_IDQDASH_CF_ACCESS_CLIENT_SECRETQDASH_TIMEOUT_SECONDSQDASH_RETRY_MAX_ATTEMPTSQDASH_RETRY_BACKOFF_SECONDSQDASH_RETRY_MAX_BACKOFF_SECONDSQDASH_VERIFY_TLSQDASH_PROXYQDASH_USER_AGENT
For legacy username/password authentication, set:
QDASH_USERNAMEQDASH_PASSWORD_ENV- the environment variable named by
QDASH_PASSWORD_ENV(defaults toQDASH_PASSWORD)
2.2 From a Configuration File
from qdash.client import QDashConfig, QDashClient
config = QDashConfig.from_file(profile="default")
client = QDashClient(config)
If path is omitted:
- If
XDG_CONFIG_HOMEis set:$XDG_CONFIG_HOME/qdash/config.ini - Otherwise:
~/.config/qdash/config.ini
Example configuration:
[default]
base_url = https://example.qdash/api
api_token = your-token
project_id = your-project-id
cf_access_client_id = your-cf-client-id
cf_access_client_secret = your-cf-client-secret
timeout_seconds = 30
retry_max_attempts = 3
retry_backoff_seconds = 0.2
retry_max_backoff_seconds = 5.0
For legacy username/password authentication from a config file, use username and password_env
instead of api_token.
Save a profile to config.ini:
from qdash.client import QDashConfig
config = QDashConfig(
base_url="https://example.qdash/api",
api_token="your-token",
cf_access_client_id="your-cf-client-id",
cf_access_client_secret="your-cf-client-secret",
)
config.save(profile="prod")
The saved file is created with owner-only permissions (0600) because it can contain API tokens
and Cloudflare Access secrets.
2.3 Automatic Loading
from qdash.client import QDashClient
# Loads config.ini by default
client = QDashClient()
3. Usage (Synchronous API)
3.1 List Chips
from qdash.client import QDashClient
client = QDashClient()
try:
chips = client.list_chips()
print([chip.chip_id for chip in chips.chips])
finally:
client.close()
3.2 Time-Series Metrics
from qdash.client import QDashClient
client = QDashClient()
try:
series = client.get_task_results_timeseries(
chip_id="chip-001",
parameter="t1",
tag="calibration",
start_at="2026-06-01T00:00:00Z",
end_at="2026-06-08T00:00:00Z",
qid="Q00",
)
print(series.data)
finally:
client.close()
3.3 Metrics Configuration
from qdash.client import QDashClient
client = QDashClient()
try:
config = client.get_metrics_config()
print(config.get("qubit_metrics", {}).keys())
print(config.get("coupling_metrics", {}).keys())
finally:
client.close()
4. Usage (Asynchronous API)
import asyncio
from qdash.client import QDashClient
async def main() -> None:
client = QDashClient()
try:
chips = await client.list_chips_async()
print([chip.chip_id for chip in chips.chips])
metrics_config = await client.get_metrics_config_async()
print(metrics_config.get("qubit_metrics", {}).keys())
series = await client.get_task_results_timeseries_async(
chip_id="chip-001",
parameter="t1",
start_at="2026-06-01T00:00:00Z",
end_at="2026-06-02T00:00:00Z",
)
print(series.data)
finally:
client.close()
asyncio.run(main())
5. Error Handling
Main exceptions:
QDashApiError(base class)QDashAuthError(missing or invalid authentication)QDashNotFoundError(404)QDashValidationError(422)QDashTransportError(transport errors, timeouts, or other HTTP statuses)
from qdash.client import QDashClient, QDashApiError
client = QDashClient()
try:
print(client.list_chips().chips)
except QDashApiError as exc:
print(exc.status_code, exc)
finally:
client.close()
6. Exporter Helper Functionality
QDashClient provides helper methods for exporters.
normalize_chip_metrics(chip_id, payload)
This method converts a QDash API response into a list of
NormalizedMetricRecord objects that are easier for exporters to consume.
7. Using the Low-Level REST Client Directly
In most cases, using QDashClient is recommended.
If you need direct access to the low-level API, you can use qdash.client.rest.
from qdash.client.rest import ApiClient, Configuration
cfg = Configuration(host="https://example.qdash/api")
rest_client = ApiClient(cfg)
try:
resp = rest_client.request("GET", "/chips")
print(resp.status_code, resp.data)
finally:
rest_client.close()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qdash_client-0.1.3.tar.gz.
File metadata
- Download URL: qdash_client-0.1.3.tar.gz
- Upload date:
- Size: 35.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e79a7393ce3e6c31a1084722b16cf10cc2476f704bd7601ece592dafe9b664a
|
|
| MD5 |
32a2ee78a6b2a0535c6c1e1158db97dc
|
|
| BLAKE2b-256 |
e969afbcb564c4b450b9f781f6ea74f16dbe1b6f308cfe23b392ce4fb6999ba9
|
Provenance
The following attestation bundles were made for qdash_client-0.1.3.tar.gz:
Publisher:
publish-qdash-client.yml on oqtopus-team/qdash
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qdash_client-0.1.3.tar.gz -
Subject digest:
2e79a7393ce3e6c31a1084722b16cf10cc2476f704bd7601ece592dafe9b664a - Sigstore transparency entry: 1825157394
- Sigstore integration time:
-
Permalink:
oqtopus-team/qdash@2a87156e03edd6ad7a63655b31a59d8d3585853c -
Branch / Tag:
refs/tags/qdash-client-v0.1.3 - Owner: https://github.com/oqtopus-team
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-qdash-client.yml@2a87156e03edd6ad7a63655b31a59d8d3585853c -
Trigger Event:
push
-
Statement type:
File details
Details for the file qdash_client-0.1.3-py3-none-any.whl.
File metadata
- Download URL: qdash_client-0.1.3-py3-none-any.whl
- Upload date:
- Size: 38.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4890a37f93c1681dc97102cd6123aa93820e879986a9c77eb8d96eccaa9b4ab6
|
|
| MD5 |
cdeb81d33bb966fadc7f0a52bb426faa
|
|
| BLAKE2b-256 |
74e3b8785b7ca82de2f86e626e16a9b2e1d1d7cfc7bd461c22c9f86baa9b0410
|
Provenance
The following attestation bundles were made for qdash_client-0.1.3-py3-none-any.whl:
Publisher:
publish-qdash-client.yml on oqtopus-team/qdash
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qdash_client-0.1.3-py3-none-any.whl -
Subject digest:
4890a37f93c1681dc97102cd6123aa93820e879986a9c77eb8d96eccaa9b4ab6 - Sigstore transparency entry: 1825157447
- Sigstore integration time:
-
Permalink:
oqtopus-team/qdash@2a87156e03edd6ad7a63655b31a59d8d3585853c -
Branch / Tag:
refs/tags/qdash-client-v0.1.3 - Owner: https://github.com/oqtopus-team
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-qdash-client.yml@2a87156e03edd6ad7a63655b31a59d8d3585853c -
Trigger Event:
push
-
Statement type: