Skip to main content

qly-sdk

Python client for Qly, a quantum computing platform. Write a circuit in OpenQASM or Qiskit, submit it to real quantum hardware (IBM, IonQ, AWS Braket, Quantinuum, Azure) or a simulator, and pull the results back.

pip install qly-sdk

The PyPI name is qly-sdk; everything else is just qly — you import qly and the CLI command is qly.

Getting a key

Sign in at qly.app, open API Keys (/settings/api-keys), and create one. You'll see the secret once — it looks like qly_live_…. Jobs you run with the key are billed to your account's prepaid balance, which you top up on the billing page.

Quickstart

from qly import Qly

client = Qly(api_key="qly_live_...")   # or set QLY_API_KEY in your environment

bell = """
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0], q[1];
measure q -> c;
"""

job = client.run(bell, provider="ibm", device="ibm_kingston", shots=1024)
print(job.counts)   # {'00': 503, '11': 521}

run() submits and blocks until the job finishes. If you'd rather not block, use submit() and poll yourself.

Command line

The package installs a qly command, so you can work from a shell without writing any Python:

qly configure                  # paste your key once; stored in ~/.config/qly/
qly devices                    # what can I run on?
qly balance

qly submit bell.qasm --provider ionq --device simulator --shots 1024 --wait
qly jobs --limit 10            # recent jobs
qly job <job-id>               # status + measurement histogram

submit --wait polls until the job finishes and prints the counts. Every command takes --json for machine-readable output, and --api-key / QLY_API_KEY override the stored key (useful in CI).

Submitting and polling separately

job = client.submit(bell, provider="ibm", device="ibm_kingston", shots=1024)
print(job.id, job.status)        # 'd4a…', 'PENDING'

job = client.wait(job)           # blocks until terminal, raises on failure
print(job.counts)

# or poll by hand:
job = client.get_job(job.id)
if job.done:
    print(job.results)

From a Qiskit circuit

Install the extra (pip install "qly-sdk[qiskit]") and pass the circuit directly:

from qiskit import QuantumCircuit
from qly import Qly

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])

client = Qly()
job = client.run(circuit=qc, provider="ionq", device="simulator", shots=512)
print(job.counts)

Listing devices and checking balance

for d in client.devices():
    print(d.provider, d.id, d.qubits, "sim" if d.is_simulator else "qpu")

print(client.balance().formatted)   # '$12.40'

Estimator (expectation values)

For IBM, you can ask for Pauli expectation values instead of shot counts:

job = client.run(
    ansatz_qasm,
    provider="ibm",
    device="ibm_kingston",
    primitive="estimator",
    observables=["ZZ", "IZ", "ZI"],
    shots=4096,
)
print(job.results)   # {'evs': [...], 'stds': [...]}

Errors

Exception When
AuthenticationError missing / invalid / revoked key
InsufficientBalanceError not enough credit; .estimated_cents, .balance_cents
RateLimitError too many submissions; .retry_after
JobFailedError job ended FAILED/ERROR/CANCELLED; .job for detail
JobTimeoutError run()/wait() timed out
APIError anything else; .status_code, .payload
from qly import InsufficientBalanceError

try:
    client.run(circuit, provider="ibm", device="ibm_kingston")
except InsufficientBalanceError as e:
    print(f"Need ~{e.estimated_cents}¢, have {e.balance_cents}¢")

Configuration

Argument Env var Default
api_key QLY_API_KEY — (required)
base_url QLY_BASE_URL https://qly.app

License

MIT

Metadata

Release files for qly-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qly-sdk 0.2.0
File Size Uploaded Provenance Actions
qly_sdk-0.2.0.tar.gz 14.0 kB Without provenance Details for qly_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qly-sdk 0.2.0
File Interpreter ABI Platform Actions
qly_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for qly_sdk-0.2.0-py3-none-any.whl

Total release size: 28.0 kB

Release files / qly_sdk-0.2.0.tar.gz

Download URL qly_sdk-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0c00d1c74cd7a21db982981ae91063f13039dcf0659907df1263279fe297c54c
BLAKE2b-256 checksum
How to use checksums
7f7c419b4d3c1218c93a79e7d68c9226861ad7398ab78906b677d6a3255a5d93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / qly_sdk-0.2.0-py3-none-any.whl

Download URL qly_sdk-0.2.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8163cd70aa3966f99b9b5285449a2e2b11cfdfc83f4ef224d34e948ac9f63a20
BLAKE2b-256 checksum
How to use checksums
81f54f7b62bd9cac4a60b11bf38f3bf3a59064b1c6a5df88c2d92707c21375b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for qly-sdk 0.2.0

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