Python connector for services provided by AQT
Project description
aqt-connector
An SDK and lightweight CLI to authenticate with AQT's Arnica platform using OIDC (Auth0).
It supports:
- Device Authorization Flow (QR code + verification URL)
- Client Credentials Flow (machine-to-machine)
- Local token storage and verification against JWKS
- Simple Python API and a small CLI (via python -m aqt_connector)
Unless you were explicitly sent here, you probably want to instead use an AQT provider for another library, where this library has already been integrated. We already have those for:
- Qiskit: https://github.com/qiskit-community/qiskit-aqt-provider
- Cirq: https://github.com/quantumlib/Cirq/tree/main/cirq-aqt
- Pennylane: https://github.com/PennyLaneAI/pennylane-aqt
Requirements
- Python >= 3.9, < 3.14
Installation
pip install aqt-connector
Quickstart
Python API
By obtaining an access token through one of the following methods, it will be verified and stored locally. The stored token is re-used in later log_in attempts and does thus not require you to authenticate again, unless the token has expired.
from aqt_connector import ArnicaApp, ArnicaConfig, log_in, get_access_token
# Configure (use client credentials OR device flow)
config = ArnicaConfig()
# Option A: client credentials
# config.client_id = "YOUR_CLIENT_ID"
# config.client_secret = "YOUR_CLIENT_SECRET"
# Option B: device flow (no client credentials set)
# Optional: change base API URL
# config.arnica_url = "https://arnica.aqt.eu/api"
app = ArnicaApp(config)
# Acquire token (stored by default when obtained)
token = log_in(app)
print("Access token:", token[:10] + "…")
# Later, get current token (if still valid and stored)
maybe_token = get_access_token(app)
CLI: log in
The CLI is exposed via the module entry point. Run:
python -m aqt_connector --help
python -m aqt_connector log-in
By default, this starts the device flow and prints a QR code and verification URL. Once you complete the flow in your browser, an ID token is obtained, verified, and stored locally.
You can also provide client credentials (machine-to-machine):
python -m aqt_connector log-in \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_CLIENT_SECRET
Optional override of the Arnica API URL:
python -m aqt_connector log-in --arnica-url https://arnica.aqt.eu/api
Where are things stored?
- When using the CLI, configuration and the token are stored in your OS application directory for "aqt" (e.g. Linux: ~/.config/aqt; macOS: ~/Library/Application Support/aqt; Windows: %APPDATA%\aqt).
- The token is saved as a file named access_token in that directory.
Configuration
The SDK loads configuration from two places, in this order of precedence (last wins):
- A local config file at {app_dir}/config
- Environment variables prefixed with AQT_
app_dir defaults to:
- Library usage (Python API): ~/.aqt
- CLI usage: your OS app directory for "aqt" (see Quickstart)
Config file (TOML)
Create a file named config in the app_dir or a custom location which you then pass to the ArnicaConfig (config = ArnicaConfig("~/myconfig")). TOML dotted keys or tables are supported. Example:
[default]
arnica_url = "https://arnica.aqt.eu/api"
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
store_access_token = true
Notes:
- store_access_token=true will persist the obtained token to {app_dir}/access_token
- To disable persistence, set store_access_token=false in this file
Environment variables
Environment variables use the AQT_ prefix and map to the same lowercase keys. Examples:
- AQT_ARNICA_URL
- AQT_CLIENT_ID
- AQT_CLIENT_SECRET
- AQT_STORE_ACCESS_TOKEN
Tip: Prefer the config file to disable persistence reliably (see notes above).
Testing
Install the dependencies
uv sync --group test
Unit tests:
pytest -q tests/commit
Integration tests (require Auth0 test credentials and a browser via Playwright):
# Required environment variables
# AUTH0_TEST_TENANT_DOMAIN
# AUTH0_TEST_CLIENT_CREDENTIALS_AUDIENCE
# AUTH0_TEST_CLIENT_CREDENTIALS_CLIENT_ID
# AUTH0_TEST_CLIENT_CREDENTIALS_CLIENT_SECRET
# AUTH0_TEST_DEVICE_FLOW_CLIENT_ID
# AUTH0_TEST_DEVICE_FLOW_USER_EMAIL
# AUTH0_TEST_DEVICE_FLOW_USER_PASSWORD
pytest -q tests/integration
Contributing
Issues and PRs are welcome. For local development, we use UV to manage virtual environments and install the package:
uv sync # includes dev tools by default
Run linters and tests before submitting changes.
uvx pyproject-fmt pyproject.toml --check
uvx ruff check
uvx typos
uvx ruff format --check
uv run mypy .
License
Copyright (c) Alpine Quantum Technologies GmbH.
This software is licensed under the Apache License 2.0. See the LICENSE file for details.
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 aqt_connector-0.4.0.tar.gz.
File metadata
- Download URL: aqt_connector-0.4.0.tar.gz
- Upload date:
- Size: 175.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f6c9a00ad990ae8b5b134538cb7d066f594df9f6e6e458e314265cef956b059
|
|
| MD5 |
2ce1759a946b4f0fe3943ab0a47e9e39
|
|
| BLAKE2b-256 |
722dacadd05c524bad24cfa2118598a8a3046cc81834329e9c68c5223a46671a
|
Provenance
The following attestation bundles were made for aqt_connector-0.4.0.tar.gz:
Publisher:
release.yml on alpine-quantum-technologies/aqt-connector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aqt_connector-0.4.0.tar.gz -
Subject digest:
0f6c9a00ad990ae8b5b134538cb7d066f594df9f6e6e458e314265cef956b059 - Sigstore transparency entry: 1461990459
- Sigstore integration time:
-
Permalink:
alpine-quantum-technologies/aqt-connector@d9ef91516d29985f9066a8b8cbe15023be23f317 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/alpine-quantum-technologies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d9ef91516d29985f9066a8b8cbe15023be23f317 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file aqt_connector-0.4.0-py3-none-any.whl.
File metadata
- Download URL: aqt_connector-0.4.0-py3-none-any.whl
- Upload date:
- Size: 31.1 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 |
0e8217707e3b6c3c45deb0dd1eea5460fbe9c016dc6d97188c7e9e72b5578b1d
|
|
| MD5 |
7ab939fa8f5f446b85f6413e4d1a401e
|
|
| BLAKE2b-256 |
c9fd2a76a424e3b03f36eeeb8a1375ab3031063fe12b7941873cee8f4c6197e7
|
Provenance
The following attestation bundles were made for aqt_connector-0.4.0-py3-none-any.whl:
Publisher:
release.yml on alpine-quantum-technologies/aqt-connector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aqt_connector-0.4.0-py3-none-any.whl -
Subject digest:
0e8217707e3b6c3c45deb0dd1eea5460fbe9c016dc6d97188c7e9e72b5578b1d - Sigstore transparency entry: 1461990463
- Sigstore integration time:
-
Permalink:
alpine-quantum-technologies/aqt-connector@d9ef91516d29985f9066a8b8cbe15023be23f317 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/alpine-quantum-technologies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d9ef91516d29985f9066a8b8cbe15023be23f317 -
Trigger Event:
workflow_run
-
Statement type: