Skip to content

Commit c95c1b4

Browse files
authored
update links for colab (#48)
* update links for colab * test common versions of python * fix indentation * lol requests not requirements * pin ubuntu version * test specifying the architecture * test to remove python3.12 * pip freeze to help pip * oh good luck * maybe 3.9 cant resolve * test old deps with no dep checking * upgrade pip * dont specify versions * revert requirements and actions * try using the conda package manager * remove pip requirements * attempt to fix conda init error * remove existing conda envs * add pip dependency to conda * pls work conda pls
1 parent 728c721 commit c95c1b4

File tree

10 files changed

+84
-44
lines changed

10 files changed

+84
-44
lines changed

.github/workflows/test_notebooks.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
11
name: Test Notebooks
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
410

511
jobs:
612
test:
713
runs-on: ubuntu-22.04
814
steps:
9-
- name: Check out code
10-
uses: actions/checkout@v3
15+
- name: Check out code
16+
uses: actions/checkout@v4
1117

12-
- name: Set up Python
13-
uses: actions/setup-python@v4
14-
with:
15-
python-version: '3.11'
18+
- name: Set up Conda
19+
uses: conda-incubator/setup-miniconda@v2
20+
with:
21+
activate-environment: myenv
22+
environment-file: environment.yml
23+
python-version: "3.11"
24+
auto-activate-base: false
1625

17-
- name: Install dependencies
18-
run: |
19-
pip install -r requirements.txt
26+
- name: Prepare Conda environment
27+
shell: bash -l {0}
28+
run: |
29+
if conda env list | grep -q 'myenv'; then
30+
echo "Environment 'myenv' already exists, updating environment"
31+
conda env update --name myenv --file environment.yml --prune
32+
else
33+
echo "Creating new environment 'myenv'"
34+
conda env create -f environment.yml
35+
fi
2036
21-
- name: Run notebook tests
22-
run: python tests/test_notebooks.py
23-
env:
24-
IONQ_API_KEY: ${{ secrets.IONQ_API_KEY }}
37+
- name: Run notebook tests
38+
shell: bash -l {0}
39+
run: |
40+
conda activate myenv
41+
python tests/test_notebooks.py
42+
env:
43+
IONQ_API_KEY: ${{ secrets.IONQ_API_KEY }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ share/python-wheels/
2828
# Distribution / packaging
2929
.Python
3030
env/
31+
venv/
3132
ionq/
3233
build/
3334
develop-eggs/

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ This repository contains Python samples exploring quantum computing on IonQ's pl
44

55
If you're looking for advanced and in-depth examples for a given library that implement a specific algorithm, check out some of the other projects in the [ionq-samples](https://github.com/ionq-samples) organization on GitHub.
66

7-
----
7+
---
88

99
## Prerequisites
1010

1111
There are a wide variety of ways to run these notebooks, but for starters you'll need:
1212

1313
1. [Python](https://www.python.org/downloads/) installed, using a version between 3.8 and 3.11.
14-
1. A [virtual environment](https://docs.python.org/3/library/venv.html) to help ensure your dependencies don't conflict with anything else you have installed.
15-
1. An [IonQ API key](https://cloud.ionq.com/settings/keys), which optionally you can store as an environment variable for ease of use. Our notebooks expect to find it stored as `IONQ_API_KEY`.
16-
1. An installation of the library you're wanting to run. To install all the libraries at once, run `pip install -r requirements.txt` from the root directory of this repository.
14+
2. A [virtual environment](https://docs.python.org/3/library/venv.html) to help ensure your dependencies don't conflict with anything else you have installed.
15+
3. An [IonQ API key](https://cloud.ionq.com/settings/keys), which optionally you can store as an environment variable for ease of use. Our notebooks expect to find it stored as `IONQ_API_KEY`.
16+
4. An installation of the library you're wanting to run. To install all the libraries at once using Conda, run the following command from the root directory of this repository:
1717

18-
----
18+
```shell
19+
conda env create -f environment.yml
20+
```
21+
22+
---
1923

2024
## Usage
2125

@@ -27,21 +31,24 @@ If you're unfamiliar with Jupyter but you're used to a traditional IDE or code e
2731

2832
1. From your terminal, navigate to this repository and run the following command from within this directory:
2933

30-
```shell
31-
jupyter notebook
32-
```
34+
```shell
35+
jupyter notebook
36+
```
37+
3338
1. Once the server is started, it should automatically open your browser. In case it doesn't, you can navigate directly to it by pointing your browser at [http://localhost:8888](http://localhost:8888)
3439
1. Navigate to the location of a `.ipynb` file and open it. If you don't have a particular SDK in mind, we recommend starting with `qiskit`, as its the most commonly used library today.
3540

3641
#### VS Code
42+
3743
1. Open the folder in VS Code and navigate to a `.ipynb` file and open it.
3844
1. If it's your first time using it, it will suggest a number of plugins that you may need to install before the notebook will be fully functional.
3945
1. At the top-right of the screen, click on `Select Kernel` and choose an appropriate Python runtime to run the notebook in.
4046

4147
#### Cloud
48+
4249
1. Open the notebook by clicking on the ![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg) badge located in each notebook. Or open this repository in [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ionq-samples/getting-started/HEAD)
4350

44-
----
51+
---
4552

4653
## Support
4754

api.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"source": [
77
"# Direct API Access\n",
88
"\n",
9-
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/api/main.ipynb)\n",
9+
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/api.ipynb)\n",
1010
"\n",
1111
"IonQ offers a set of API resources that allow you to submit and manage jobs directly. This notebook offers a few simple examples, but visit [docs.ionq.com](https://docs.ionq.com) for a complete guide with additional resources and functionality."
1212
]
@@ -176,7 +176,7 @@
176176
"name": "python",
177177
"nbconvert_exporter": "python",
178178
"pygments_lexer": "ipython3",
179-
"version": "3.11.6"
179+
"version": "3.11.8"
180180
},
181181
"orig_nbformat": 4
182182
},

cirq.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"source": [
77
"# Cirq\n",
88
"\n",
9-
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/cirq/main.ipynb)\n",
9+
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/cirq.ipynb)\n",
1010
"\n",
11-
"[Cirq](https://github.com/quantumlib/Cirq) is an open-source Python library developed by Google for designing, simulating, and running quantum circuits on quantum computers."
11+
"[Cirq](https://github.com/quantumlib/Cirq) is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators. It is designed to be flexible, and is suitable for use in a variety of quantum computing tasks."
1212
]
1313
},
1414
{
@@ -122,7 +122,7 @@
122122
"name": "python",
123123
"nbconvert_exporter": "python",
124124
"pygments_lexer": "ipython3",
125-
"version": "3.11.0"
125+
"version": "3.11.8"
126126
}
127127
},
128128
"nbformat": 4,

environment.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: myenv
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- python=3.11
7+
- pip
8+
- matplotlib
9+
- jupyter
10+
# Add other dependencies here, for Conda packages.
11+
- pip:
12+
# Pip-only packages here, if any.
13+
- qiskit
14+
- qiskit-ionq
15+
- cirq
16+
- cirq-ionq
17+
- pennylane
18+
- pennylane-ionq
19+
- projectq
20+
- cuda-quantum
21+
- pylatexenc
22+
- requests

pennylane.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"source": [
77
"# PennyLane\n",
88
"\n",
9-
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/pennylane/main.ipynb)"
9+
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/pennylane.ipynb)\n",
10+
"\n",
11+
"[PennyLane](https://pennylane.ai/) is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations. It is designed to work with existing quantum computing hardware and simulators, and integrates seamlessly with machine learning libraries such as TensorFlow and PyTorch."
1012
]
1113
},
1214
{
@@ -121,7 +123,7 @@
121123
"name": "python",
122124
"nbconvert_exporter": "python",
123125
"pygments_lexer": "ipython3",
124-
"version": "3.11.6"
126+
"version": "3.11.8"
125127
}
126128
},
127129
"nbformat": 4,

projectq.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"source": [
77
"# ProjectQ\n",
88
"\n",
9-
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/projectq/main.ipynb)\n",
9+
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/projectq.ipynb)\n",
1010
"\n",
11-
"ProjectQ is an open-source software framework for quantum computing that allows users to design, simulate, and optimize quantum circuits on various backends."
11+
"[ProjectQ](https://projectq.ch/) is an open-source software framework for quantum computing that allows users to design, simulate, and optimize quantum circuits on various backends."
1212
]
1313
},
1414
{

qiskit.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# Getting Started with Qiskit\n",
99
"\n",
10-
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/qiskit/main.ipynb)\n",
10+
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/qiskit.ipynb)\n",
1111
"\n",
1212
"[Qiskit](https://qiskit.org/) is an open-source quantum computing framework developed by IBM for building, simulating, and running quantum circuits on real and simulated quantum devices."
1313
]

requirements.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)