Skip to content

Commit

Permalink
New: Add binder image to run tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
ameyer-rigetti committed Aug 12, 2021
1 parent a1c1318 commit bd7c5e3
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
.gitignore
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.4.3](https://github.com/rigetti/qiskit-rigetti/releases/tag/v0.4.3)

### New

- Added binder tutorials image


## [0.4.2](https://github.com/rigetti/qiskit-rigetti/releases/tag/v0.4.2)

### Updates
Expand Down
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM rigetti/forest:3.0.0

# install jupyter notebook and jupyter lab
COPY binder-requirements.txt binder-requirements.txt
RUN pip install --no-cache-dir -r binder-requirements.txt

# create user with UID 1000 and associated home dir (required by binder)
ARG NB_USER=binder
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}

WORKDIR ${HOME}

# copy tutorials
COPY docs/examples/ examples/

# install qelib1.inc
ARG qelib1_version=0.16.2
RUN curl -L -o ${HOME}/qelib1_LICENSE.txt https://raw.githubusercontent.com/Qiskit/qiskit-terra/$qelib1_version/LICENSE.txt
RUN curl -L -o ${HOME}/qelib1.inc https://raw.githubusercontent.com/Qiskit/qiskit-terra/$qelib1_version/qiskit/qasm/libs/qelib1.inc

# transfer ownership of /home/binder to binder user
USER root
RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}

# signal that we need to publish port 8888 to run the notebook server
EXPOSE 8888

# run the notebook server
CMD ["jupyter", "lab", "--ip=0.0.0.0"]

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
[![Tests](https://github.com/rigetti/qiskit-rigetti/actions/workflows/test.yml/badge.svg)](https://github.com/rigetti/qiskit-rigetti/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/qiskit-rigetti/badge/?version=latest)](https://qiskit-rigetti.readthedocs.io/en/latest/?badge=latest)
[![pypi](https://img.shields.io/pypi/v/qiskit-rigetti.svg)](https://pypi.org/project/qiskit-rigetti/)
[![Binder](https://mybinder.org/badge_logo.svg)][binder]

# Rigetti Provider for Qiskit

## Try It Out

To try out this library, you can run example notebooks in a pre-made [binder][binder]. Alternately, you can run the following to build and run the image locally:

```bash
docker build -t qiskit-tutorials .
docker run --rm -p 8888:8888 qiskit-tutorials
```

then click on the link that is displayed after the container starts up.

[binder]: https://mybinder.org/v2/gh/rigetti/qiskit-rigetti/main?filepath=examples

## Pre-requisites

1. Install [Docker](https://www.docker.com/products/docker-desktop)
Expand Down
4 changes: 4 additions & 0 deletions binder-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
qiskit-rigetti==0.4.*
qiskit[visualization]
notebook
jupyterlab
2 changes: 1 addition & 1 deletion docs/examples/GettingStarted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"outputs": [],
"source": [
"provider = RigettiQCSProvider()\n",
"backend = provider.get_simulator(num_qubits=2, noisy=True) # or provider.get_backend(name=\"Aspen-9\")"
"backend = provider.get_simulator(num_qubits=2, noisy=True) # or provider.get_backend(name=\"Aspen-9\") when running via QCS"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/QAOA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@
" p: int,\n",
" Number of repetitions of unitaries\n",
" \"\"\"\n",
" backend = provider.get_simulator(num_qubits=len(G.nodes), noisy=False) # or provider.get_backend(name='Aspen-9')\n",
" backend = provider.get_simulator(num_qubits=len(G.nodes), noisy=False) # or provider.get_backend(name='Aspen-9') when running via QCS\n",
" \n",
" def execute_circ(theta):\n",
" \n",
Expand Down

0 comments on commit bd7c5e3

Please sign in to comment.