Skip to content

Spaces

A Space is a small Python project you edit in the browser and run on QubitHub’s servers. Every Space starts with a main.py and a README.md. When you press Run, your Python runs in an isolated server-side sandbox, with no network and no quantum hardware, and the output comes back to the page. To get results, your code has to call a simulator itself.


OwnerSigned-in visitor (public Space)Signed-out visitor (public Space)
Open the Space and read its files✅✅✅
Edit and save files✅ (saves automatically)❌ read-only❌ read-only
Run✅❌ refused (owner only)❌ sign-in required
Visualize the circuit diagram✅ from what’s in your editor✅ from the saved main.py❌ sign-in required
Fork it into your own account✅✅sign in first
Star it✅✅—

A private Space can be opened only by its owner. Anyone else gets “Access denied”. New Spaces are private unless you choose Public.


In the web app, go to Spaces → New Space and choose a name, a title, the framework (Qiskit from IBM, PennyLane from Xanadu, or Cirq from Google) and the visibility. Spaces are private by default: only you can open them. Choose Public to let anyone with the link read the code; signed-in visitors can also draw its diagram and fork a copy. The app can’t change the visibility afterwards yet. The API can: PUT /api/spaces/{id} with {"is_public": true}.

The Space starts with a main.py in the framework you picked, and a README.md. The Qiskit and Cirq main.py build a Bell-state circuit (two entangled qubits) and only print the circuit: they do not simulate it. The PennyLane main.py computes the Bell state on PennyLane’s default.qubit simulator and prints it.

From the API, with a Bearer token (see Get a token):

Terminal window
SPACE_ID=$(curl -s -X POST https://qubithub.co/api/spaces \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name": "bell-playground", "title": "Bell playground", "sdk": "qiskit", "is_public": true}' \
| jq -r .id)

Leave out "is_public": true and the Space is created private.

Keep the Space’s link or id. There is no list of your own Spaces yet, and the public list (GET /api/spaces) shows public Spaces only.


Run executes the code in the editor, including unsaved edits. Your Python runs in a server-side sandbox, not in your browser, with no network and no quantum hardware. To get measurement results, the code must call a simulator (for example Qiskit Aer or cirq.Simulator()).

What the sandbox allows:

  • Imports: qiskit, qiskit_aer, pennylane, cirq, numpy, scipy, matplotlib, and a few standard-library modules (math, cmath, random, json, collections, itertools, functools, typing, dataclasses). Any other import is refused before the code runs.
  • No network access.
  • No file access. open, file I/O such as np.save or plt.savefig, eval, exec, and private or dunder attributes (obj.__class__) are refused before the code runs, with 400 “Security validation failed”.
  • Memory: the sandbox container is capped (512 MB by default).
  • Time: the page stops a run after 30 seconds. The API accepts up to 300.
  • Output: text only (what the code prints), cut off after 10,000 characters. There are no plots or structured results in the console yet.
  • Rate: up to 30 runs per minute per user.

Run a file from the API (owner only):

Terminal window
curl -s -X POST https://qubithub.co/api/spaces/$SPACE_ID/execute \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"file_to_run": "main.py", "timeout": 30}' | jq -r .output

Or send code directly, instead of a file:

Terminal window
curl -s -X POST https://qubithub.co/api/spaces/$SPACE_ID/execute \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"code": "import numpy as np\nprint(np.round(np.sqrt(0.5), 4))"}' | jq .

From Python, with the SDK (pip install qubithub, then qubithub login):

from qubithub import QubitHubClient
from qubithub.models import SpaceExecuteRequest
client = QubitHubClient() # uses your stored `qubithub login`
result = client.execute_space("<space-id>", SpaceExecuteRequest(file_to_run="main.py"))
print(result.status, f"{result.execution_time:.2f}s")
print(result.output)

A response has status (success, error or timeout), output, error and execution_time. If the sandbox itself fails (not your code), the error says “The code sandbox is unavailable. Please try again later.”

There is no CLI command for Spaces.


Visualize draws the circuit diagram. Like Run, it renders in the sandbox, and it works for Qiskit, PennyLane and Cirq. The owner draws what’s currently in their editor; a signed-in visitor to a public Space draws its saved main.py. Visualize needs you to be signed in, and is limited to 10 diagrams per minute.


Forking copies every file of a Space into your account, under the name <name>-fork (or a name you pick). You can edit and run the fork: it’s yours. The fork keeps the original’s visibility, and links back to the Space it came from.

Terminal window
curl -s -X POST https://qubithub.co/api/spaces/$SPACE_ID/fork \
-H "Authorization: Bearer $TOKEN" | jq '{id, name, forked_from}'

You can fork any public Space, and your own private ones. Forks are limited to 5 per minute.


The API takes a Bearer token. API keys are not accepted on these routes. Log in to get one; it is valid for 15 minutes. When calls return 401, run the login step again:

Terminal window
read -rsp "Password: " QH_PASSWORD; echo
TOKEN=$(jq -n --arg e "[email protected]" --arg p "$QH_PASSWORD" '{email: $e, password: $p}' \
| curl -s -X POST https://qubithub.co/api/auth/login -H "Content-Type: application/json" -d @- \
| jq -r .access_token)

The SDK handles tokens for you after qubithub login. See Authentication.


  • A public gallery. The launch hasn’t happened, so share Spaces by link.
  • Running someone else’s Space without forking it.
  • A list of your own Spaces, including the private ones.
  • Structured results (counts, histograms) from a Space run. Output is text.
  • Hardware. Space code cannot reach quantum hardware; it can only call a simulator.

This is direction, not a feature. The plan is for a Space to become a playground built from citable circuits and datasets: anyone could change the code and run it, and fork to keep their changes. None of that is available yet. This page will change when it is.

Need help? See Troubleshooting or email [email protected].