Skip to content

Commit bd7c5e3

Browse files
New: Add binder image to run tutorials
1 parent a1c1318 commit bd7c5e3

7 files changed

+67
-2
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
.gitignore

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.4.3](https://github.com/rigetti/qiskit-rigetti/releases/tag/v0.4.3)
4+
5+
### New
6+
7+
- Added binder tutorials image
8+
9+
310
## [0.4.2](https://github.com/rigetti/qiskit-rigetti/releases/tag/v0.4.2)
411

512
### Updates

Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM rigetti/forest:3.0.0
2+
3+
# install jupyter notebook and jupyter lab
4+
COPY binder-requirements.txt binder-requirements.txt
5+
RUN pip install --no-cache-dir -r binder-requirements.txt
6+
7+
# create user with UID 1000 and associated home dir (required by binder)
8+
ARG NB_USER=binder
9+
ARG NB_UID=1000
10+
ENV USER ${NB_USER}
11+
ENV NB_UID ${NB_UID}
12+
ENV HOME /home/${NB_USER}
13+
RUN adduser --disabled-password \
14+
--gecos "Default user" \
15+
--uid ${NB_UID} \
16+
${NB_USER}
17+
18+
WORKDIR ${HOME}
19+
20+
# copy tutorials
21+
COPY docs/examples/ examples/
22+
23+
# install qelib1.inc
24+
ARG qelib1_version=0.16.2
25+
RUN curl -L -o ${HOME}/qelib1_LICENSE.txt https://raw.githubusercontent.com/Qiskit/qiskit-terra/$qelib1_version/LICENSE.txt
26+
RUN curl -L -o ${HOME}/qelib1.inc https://raw.githubusercontent.com/Qiskit/qiskit-terra/$qelib1_version/qiskit/qasm/libs/qelib1.inc
27+
28+
# transfer ownership of /home/binder to binder user
29+
USER root
30+
RUN chown -R ${NB_UID} ${HOME}
31+
USER ${NB_USER}
32+
33+
# signal that we need to publish port 8888 to run the notebook server
34+
EXPOSE 8888
35+
36+
# run the notebook server
37+
CMD ["jupyter", "lab", "--ip=0.0.0.0"]
38+

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
[![Tests](https://github.com/rigetti/qiskit-rigetti/actions/workflows/test.yml/badge.svg)](https://github.com/rigetti/qiskit-rigetti/actions/workflows/test.yml)
22
[![Documentation Status](https://readthedocs.org/projects/qiskit-rigetti/badge/?version=latest)](https://qiskit-rigetti.readthedocs.io/en/latest/?badge=latest)
33
[![pypi](https://img.shields.io/pypi/v/qiskit-rigetti.svg)](https://pypi.org/project/qiskit-rigetti/)
4+
[![Binder](https://mybinder.org/badge_logo.svg)][binder]
45

56
# Rigetti Provider for Qiskit
67

8+
## Try It Out
9+
10+
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:
11+
12+
```bash
13+
docker build -t qiskit-tutorials .
14+
docker run --rm -p 8888:8888 qiskit-tutorials
15+
```
16+
17+
then click on the link that is displayed after the container starts up.
18+
19+
[binder]: https://mybinder.org/v2/gh/rigetti/qiskit-rigetti/main?filepath=examples
20+
721
## Pre-requisites
822

923
1. Install [Docker](https://www.docker.com/products/docker-desktop)

binder-requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
qiskit-rigetti==0.4.*
2+
qiskit[visualization]
3+
notebook
4+
jupyterlab

docs/examples/GettingStarted.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"outputs": [],
4646
"source": [
4747
"provider = RigettiQCSProvider()\n",
48-
"backend = provider.get_simulator(num_qubits=2, noisy=True) # or provider.get_backend(name=\"Aspen-9\")"
48+
"backend = provider.get_simulator(num_qubits=2, noisy=True) # or provider.get_backend(name=\"Aspen-9\") when running via QCS"
4949
]
5050
},
5151
{

docs/examples/QAOA.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@
577577
" p: int,\n",
578578
" Number of repetitions of unitaries\n",
579579
" \"\"\"\n",
580-
" backend = provider.get_simulator(num_qubits=len(G.nodes), noisy=False) # or provider.get_backend(name='Aspen-9')\n",
580+
" backend = provider.get_simulator(num_qubits=len(G.nodes), noisy=False) # or provider.get_backend(name='Aspen-9') when running via QCS\n",
581581
" \n",
582582
" def execute_circ(theta):\n",
583583
" \n",

0 commit comments

Comments
 (0)