Skip to content

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

Terminal window
pip install qubithub

This installs both the Python SDK and the qubithub CLI. Verify the install:

Terminal window
qubithub --version # qubithub 0.2.4
qubithub --help

Interactive login (opens a prompt):

Terminal window
qubithub login

Enter your email or username, then your password, when prompted.

Verify you’re authenticated:

Terminal window
qubithub whoami

List available circuits:

Terminal window
qubithub circuits list

Filter by framework:

Terminal window
qubithub circuits list --framework qiskit

Filter by tag:

Terminal window
qubithub circuits list --tag entanglement

View details of a specific circuit:

Terminal window
qubithub circuits info QubitHub/bell-state

Execute a circuit and watch the results:

Terminal window
qubithub execute QubitHub/bell-state --shots 1024 --watch

The --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:

Terminal window
qubithub --format json execute QubitHub/bell-state --shots 1024 --watch

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:

Terminal window
qubithub clone QubitHub/bell-state
cd bell-state

A circuit repository typically contains:

  • circuit.py: the quantum circuit code
  • qubithub.toml: circuit manifest (metadata)
  • README.md: documentation
  • metadata.json: auto-generated metadata

Open the files in your editor to see how the circuit works.

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:

Terminal window
qubithub circuits push

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

Scaffold a new circuit project:

Terminal window
qubithub circuits init my-algorithm --framework qiskit

This generates a directory with template files:

my-algorithm/
├── circuit.py # Your circuit code
├── qubithub.toml # Manifest (edit this!)
├── README.md # Documentation
└── .gitignore # Sensible ignore defaults

Edit the files, then push. A brand-new circuit needs --create on its first push so the server registers it:

Terminal window
cd my-algorithm
qubithub circuits push --create

Every command, argument and option is in the CLI reference; the SDK is in the SDK reference.

CommandDescription
qubithub loginAuthenticate (interactive or --token)
qubithub logoutClear stored credentials
qubithub whoamiShow current user
qubithub execute <repo>Execute a circuit
qubithub clone <repo>Clone a circuit (git, with HTTP fallback)
qubithub circuits listBrowse circuits
qubithub circuits info <repo>Circuit details
qubithub circuits pushUpload local circuit (--create for new)
qubithub circuits init <name>Scaffold new circuit
qubithub circuits fork <repo>Fork a circuit
qubithub circuits metadataShow parsed manifest (-f json|toml)
qubithub runs listList 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 statsShow run statistics (fails with HTTP 500; a known server defect)
qubithub keys create <name>Create an API key (git only today)
qubithub keys listList 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 listList all CLI defaults
qubithub config unset <key>Remove a CLI default

The qubithub package also exposes a Python client:

from qubithub import QubitHubClient
from qubithub.models import RunCreateRequest
client = QubitHubClient() # uses the credentials `qubithub login` stored
# List circuits
circuits = client.list_circuits(framework="qiskit")
for c in circuits.circuits:
print(f"{c.slug} ({c.framework}) — {c.title}")
# Execute a circuit
run = client.create_run(RunCreateRequest(
circuit_id="<circuit-uuid>",
backend_name="qiskit_aer",
shots=1024,
))