QisPlay: A Python and Qiskit Playground in the Browser

6 min read

QisPlay cover

Trying out a Qiskit idea usually starts with setting up a Python environment, installing the right versions of qiskit and qiskit-aer, and opening a notebook. QisPlay skips all of that: open a tab, write Python, press Run.

What is QisPlay

QisPlay is a Python and Qiskit playground that runs entirely in the browser. It has a VS Code-style editor, a file explorer with projects, a Python console, and plots. There is no install, no server, and no account: everything you create is stored in your own browser.

Try it at qisplay.nepcodex.com, or read the source on GitHub at github.com/kriss-u/QisPlay.

Why use it

  • Zero setup. Qiskit, Qiskit Aer, NumPy, SciPy, Matplotlib, and SymPy are already there. Nothing to install, no version conflicts
  • Works anywhere with a browser. A school laptop, a borrowed machine, or a computer where you can’t install software
  • Private by default. Your code never leaves your machine, and there is no account to sign up for
  • Good for teaching and sharing. Download a project as a .zip and anyone can open it in QisPlay exactly as you left it

If you’re working through a course like QisLearn, QisPlay is the free-form companion: a place to experiment with whatever circuit you want, using the real Qiskit.

Getting started

  1. Open qisplay.nepcodex.com. On your first visit it creates a starter project with main.py, a helper module, and a quantum/bell.py example. The first load takes a moment while Python is downloaded
  2. Open a .py file and press Run, or use Ctrl/Cmd+Enter or F5. Printed output appears in the output panel and Matplotlib figures appear in the plots pane
  3. Add more examples from the explorer’s Add an example file button: NumPy + Matplotlib, SciPy optimize, a Qiskit Bell state, and Qiskit Aer sampling
  4. Create your own files and folders, or start a fresh project from the project menu

Here’s the kind of code you can paste in and run as-is:

from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit.visualization import plot_histogram
import matplotlib.pyplot as plt

qc = QuantumCircuit(3, 3)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)
qc.measure(range(3), range(3))

sim = AerSimulator()
counts = sim.run(transpile(qc, sim), shots=2048).result().get_counts()
print(counts)

plot_histogram(counts)
plt.show()

It prints the measurement counts for a three-qubit GHZ state and draws the histogram right next to your code.

Features

Projects and files

  • Keep several projects and switch between them; create, rename, and delete them from the project menu
  • Organize files in folders, with familiar file icons in the explorer
  • Your scripts can import each other, so you can split code into modules
  • Files your script writes, like a CSV of results, show up in the explorer
  • Edits save automatically, even if you close the tab mid-edit
  • Download project as .zip to back up or share a project, and Open project from .zip to load one, including its open tabs. A plain zipped folder works too

Editor

  • VS Code-style editor with Dark+ and Light+ colors
  • Python autocompletion, including for Qiskit
  • Rainbow brackets and find/replace
  • Tabs for open files

Running code

  • Run the active file with Ctrl/Cmd+Enter or F5
  • Stop long-running code with Shift+F5
  • Matplotlib figures, including qc.draw("mpl") and plot_histogram, appear in a collapsible plots pane

Python console

  • An interactive Python console that remembers variables between commands, with multi-line input and history
  • Press Shift+Enter in the editor to send the current line or selection to the console, just like in VS Code
  • Restart the console any time for a clean state

Qiskit support

  • Build circuits, transpile them, and draw them as text or Matplotlib figures
  • Simulate with Qiskit Aer using the statevector, density matrix, stabilizer, and matrix product state methods
  • Noise models, Statevector, and the Estimator and Sampler primitives work too

Keyboard and themes

  • VS Code shortcuts, shown with the right keys for your platform
  • A command palette with F1 or Ctrl/Cmd+Shift+P, and quick file open with Ctrl/Cmd+P. On Firefox, use F1: Firefox keeps Ctrl/Cmd+Shift+P for opening a private window
  • Light, dark, or match-system themes

Some keys are reserved by your browser or operating system and never reach a web page, so QisPlay uses alternatives for those commands:

CommandIn VS CodeIn QisPlay
New fileCtrl+NAlt+N
Close editor tabCtrl+WAlt+W
Switch editor tabCtrl+PgUp/PgDn (⌘⌥←/→ on macOS)Alt+PgUp/PgDn (⌃⌥←/→ on macOS)
Find and replace (macOS)⌘H⌘⌥F
Go to line⌘G on macOS⌃G

The full list is always one click away in the app’s keyboard shortcuts dialog.

Limitations

  • Only the bundled packages are available. You can’t pip install anything else. The included packages are Qiskit, Qiskit Aer, NumPy, SciPy, Matplotlib, SymPy, and their dependencies
  • No input(). Scripts can’t prompt for keyboard input
  • Slower than a native install. Code runs on a single thread inside the browser, so large simulations take longer than they would on your own machine
  • No real quantum hardware. QisPlay runs simulators only; it doesn’t connect to IBM Quantum or other cloud backends
  • Storage is per browser. Projects live in the browser you made them in. Clearing site data deletes them, and they don’t sync across devices, so download a .zip of anything you want to keep
  • First load takes a moment. Python and the packages are downloaded the first time you open QisPlay

Source code

QisPlay is open source. The code is on GitHub at github.com/kriss-u/QisPlay. Issues, suggestions, and contributions are welcome.

Try it yourself

Head to qisplay.nepcodex.com, open quantum/bell.py, and press Run.

Related Posts