Skip to content

A collection of Python samples demonstrating how to get started with IonQ using various quantum frameworks

License

Notifications You must be signed in to change notification settings

ionq-samples/getting-started

Repository files navigation

IonQ Quantum Computing Samples

Python samples demonstrating quantum computing on IonQ's platform using popular quantum libraries. A great starting point for exploring quantum computation.

For advanced examples implementing specific algorithms, check out the ionq-samples organization.


Quick Start

Prerequisites

  • Python 3.10-3.13
  • IonQ API key (set as IONQ_API_KEY environment variable)

Installation

Using pip:

pip install -e .

Using uv (faster):

curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install -e .

Using conda:

conda env create -f environment.yml

Running Notebooks

Jupyter:

jupyter notebook

VS Code: Open any .ipynb file and select a Python kernel.

Cloud: Click the Open in Colab badge in each notebook.


Docker

Run in a containerized environment:

# Build
docker build --platform=linux/x86_64 -t ionq-notebooks .

# Run
docker run -p 8888:8888 -e IONQ_API_KEY="your_api_key" ionq-notebooks

Open http://localhost:8888 in your browser.


Development

Running Tests

# All tests
pytest tests/

# Parallel execution
pytest -n auto tests/

# Specific notebook
pytest tests/test_notebooks.py::test_notebook_execution[qiskit.ipynb]

# With custom timeout
NBEXEC_TIMEOUT_SECONDS=900 pytest tests/

GitHub Actions automatically tests all notebooks on every push.


Git Hooks

This repository includes a pre-commit Git hook to automatically clean Jupyter notebook metadata using nb-clean before committing. This helps reduce unnecessary noise in commits and avoid merge conflicts.

To enable this, run the following command in your terminal from the root of this repository:

git config core.hooksPath .githooks

Note: If uv is not installed, the hook will issue a warning and skip the cleaning process.


Support

Submit issues or PRs in this repository, or contact support@ionq.com.

About

A collection of Python samples demonstrating how to get started with IonQ using various quantum frameworks

Topics

Resources

License

Stars

Watchers

Forks

Contributors 6