CLI / SDK Quickstart
This tutorial walks you through installing the QubitHub CLI, running your first quantum circuit, and publishing changes, all from the terminal.
Time to complete: ~5 minutes
Prerequisites
Section titled “Prerequisites”- Python 3.10 or later
- A QubitHub account: sign up (registration is open; no waitlist). See Account & Email Verification for the post-signup flow.
1. Install
Section titled “1. Install”pip install qubithubThis installs both the Python SDK and the qubithub CLI. Verify the install:
qubithub --version # qubithub 0.2.4qubithub --help2. Log in
Section titled “2. Log in”Interactive login (opens a prompt):
qubithub loginEnter your email or username, then your password, when prompted.
Verify you’re authenticated:
qubithub whoami3. Browse circuits
Section titled “3. Browse circuits”List available circuits:
qubithub circuits listFilter by framework:
qubithub circuits list --framework qiskitFilter by tag:
qubithub circuits list --tag entanglementView details of a specific circuit:
qubithub circuits info QubitHub/bell-state4. Run a circuit
Section titled “4. Run a circuit”Execute a circuit and watch the results:
qubithub execute QubitHub/bell-state --shots 1024 --watchThe --watch flag polls until the run completes and displays a histogram of measurement results.
Output (from a real run; counts vary run to run, and every run is on a simulator):
Resolved QubitHub/bell-state → <circuit-id>✔ Run submitted QubitHub/bell-state Run ID: <run-id> Status: ✔ completed Backend: qiskit_aer (simulation) Shots: 1024
Measurement Results (1,024 shots) 00 ████████████████████████████████████████ 531 ( 51.9%) 11 █████████████████████████████████████ 493 ( 48.1%)--watch stops polling after 3 minutes; if a run takes longer, check it later with
qubithub runs info <run-id>. The exit status follows the run: 0 when it completed,
1 when it failed or was cancelled, and 124 when polling stopped before it ended.
For JSON output (useful for scripting), pass the global --format flag before
the command:
qubithub --format json execute QubitHub/bell-state --shots 1024 --watch5. Clone a circuit
Section titled “5. Clone a circuit”Clone a circuit to your local machine to inspect it, run it, or use it as a
starting point. qubithub clone uses git when it’s available (you get the
full commit history) and falls back to a flat HTTP file download otherwise:
qubithub clone QubitHub/bell-statecd bell-stateA circuit repository typically contains:
circuit.py: the quantum circuit codequbithub.toml: circuit manifest (metadata)README.md: documentationmetadata.json: auto-generated metadata
Open the files in your editor to see how the circuit works.
6. Push changes
Section titled “6. Push changes”When you’ve edited a circuit you own (one you created, see the next step, or a fork of someone else’s), publish a new version with:
qubithub circuits pushThe CLI validates your qubithub.toml, uploads the circuit files (.py, .json, .qasm,
.qpy, .toml) and creates a new version. README.md is not uploaded: on the first
push --create it becomes the circuit’s description, and later edits to it are not pushed.
7. Create a new circuit from scratch
Section titled “7. Create a new circuit from scratch”Scaffold a new circuit project:
qubithub circuits init my-algorithm --framework qiskitThis generates a directory with template files:
my-algorithm/├── circuit.py # Your circuit code├── qubithub.toml # Manifest (edit this!)├── README.md # Documentation└── .gitignore # Sensible ignore defaultsEdit the files, then push. A brand-new circuit needs --create on its first
push so the server registers it:
cd my-algorithmqubithub circuits push --createCommand reference
Section titled “Command reference”Every command, argument and option is in the CLI reference; the SDK is in the SDK reference.
| Command | Description |
|---|---|
qubithub login | Authenticate (interactive or --token) |
qubithub logout | Clear stored credentials |
qubithub whoami | Show current user |
qubithub execute <repo> | Execute a circuit |
qubithub clone <repo> | Clone a circuit (git, with HTTP fallback) |
qubithub circuits list | Browse circuits |
qubithub circuits info <repo> | Circuit details |
qubithub circuits push | Upload local circuit (--create for new) |
qubithub circuits init <name> | Scaffold new circuit |
qubithub circuits fork <repo> | Fork a circuit |
qubithub circuits metadata | Show parsed manifest (-f json|toml) |
qubithub runs list | List your runs |
qubithub runs info <id> | Run details and results |
qubithub runs cancel <id> | Cancel a pending or running run, or delete a finished run’s record |
qubithub runs stats | Show run statistics (fails with HTTP 500; a known server defect) |
qubithub keys create <name> | Create an API key (git only today) |
qubithub keys list | List API keys |
qubithub keys revoke <id> | Revoke an API key |
qubithub config set <key> <val> | Store a CLI default (not read by any command yet in 0.2.4) |
qubithub config get <key> | Get a CLI default |
qubithub config list | List all CLI defaults |
qubithub config unset <key> | Remove a CLI default |
Using the Python SDK
Section titled “Using the Python SDK”The qubithub package also exposes a Python client:
from qubithub import QubitHubClientfrom qubithub.models import RunCreateRequest
client = QubitHubClient() # uses the credentials `qubithub login` stored
# List circuitscircuits = client.list_circuits(framework="qiskit")for c in circuits.circuits: print(f"{c.slug} ({c.framework}) — {c.title}")
# Execute a circuitrun = client.create_run(RunCreateRequest( circuit_id="<circuit-uuid>", backend_name="qiskit_aer", shots=1024,))Next steps
Section titled “Next steps”- Web UI Getting Started: explore QubitHub in the browser
- CLI reference and SDK reference: every command and method
- qubithub.toml Reference: manifest format for publishing
- Authentication: API keys, tokens, and rate limits
- Contributing Circuits: quality standards and best practices