Skip to content

Commit

Permalink
Update list of pre-release notebooks (#6609)
Browse files Browse the repository at this point in the history
- Update the stale list of pre-release notebooks by
  dropping notebooks that work with the last release 1.3.0
- Enable notebook tests that pass at Cirq HEAD
- Fix old instructions on installing pre-release cirq
- Add missing import to examples/stabilizer_code.ipynb

Ref: https://github.com/quantumlib/Cirq/blob/main/docs/dev/notebooks.md
  • Loading branch information
pavoljuhas authored May 23, 2024
1 parent e11d297 commit 528b2d2
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 56 deletions.
12 changes: 0 additions & 12 deletions dev_tools/notebooks/isolated_notebook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,10 @@
NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES: List[str] = [
# Requires pinned quimb from #6438
'cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb',
# Hardcoded qubit placement
'docs/google/qubit-placement.ipynb',
# get_qcs_objects_for_notebook
'docs/noise/calibration_api.ipynb',
'docs/tutorials/google/colab.ipynb',
'docs/tutorials/google/identifying_hardware_changes.ipynb',
'docs/tutorials/google/echoes.ipynb',
'docs/noise/floquet_calibration_example.ipynb',
'docs/tutorials/google/spin_echoes.ipynb',
'docs/tutorials/google/start.ipynb',
'docs/tutorials/google/visualizing_calibration_metrics.ipynb',
'docs/noise/qcvv/xeb_calibration_example.ipynb',
'docs/named_topologies.ipynb',
'docs/start/intro.ipynb',
# Circuit routing
'docs/transform/routing_transformer.ipynb',
]

# By default all notebooks should be tested, however, this list contains exceptions to the rule
Expand Down
4 changes: 0 additions & 4 deletions dev_tools/notebooks/notebook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
# disabled to unblock Python 3.12. TODO(#6590) - fix and enable.
'cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb',
# skipping fidelity estimation due to
# https://github.com/quantumlib/Cirq/issues/3502
'examples/*fidelity*',
# skipping quantum utility simulation (too large)
'examples/advanced/*quantum_utility*',
# tutorials that use QCS and arent skipped due to one or more cleared output cells
Expand All @@ -53,8 +51,6 @@
# temporary: need to fix QVM metrics and device spec
'docs/tutorials/google/spin_echoes.ipynb',
'docs/tutorials/google/visualizing_calibration_metrics.ipynb',
# shouldn't have outputs generated for style reasons
'docs/simulate/qvm_builder_code.ipynb',
]


Expand Down
4 changes: 2 additions & 2 deletions docs/dev/notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ You should configure notebooks differently depending on whether they rely on fea
When you introduce a notebook that depends on pre-release features of Cirq, make sure to

- mark the notebook at the top that `Note: this notebook relies on unreleased Cirq features. If you want to try these feature, make sure you install cirq via pip install cirq~=1.0.dev`.
- use `pip install cirq —pre` in the installation instructions
- use `pip install cirq~=1.0.dev` in the installation instructions
- make sure [notebook_test.py](https://github.com/quantumlib/Cirq/blob/main/dev_tools/notebooks/notebook_test.py) covers the notebook
- exclude the notebook from the [isolated_notebook_test.py](https://github.com/quantumlib/Cirq/blob/main/dev_tools/notebooks/isolated_notebook_test.py) by adding it to `NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES`

Expand All @@ -92,7 +92,7 @@ When you introduce a notebook that only uses already released features of Cirq,

At release time, we change all the **pre-release notebooks** in bulk:
- remove the pre-release notices
- change `pip install cirq —pre` to `pip install cirq`
- change `pip install cirq~=1.0.dev` to `pip install cirq`
- remove the exclusions in [isolated_notebook_test.py](https://github.com/quantumlib/Cirq/blob/main/dev_tools/notebooks/isolated_notebook_test.py) by making `NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES=[]`

As all the notebooks have been tested continuously up to this point, the release notebook PR should pass without issues.
Expand Down
6 changes: 2 additions & 4 deletions docs/google/qubit-placement.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"source": [
"# Qubit Placement\n",
"\n",
"This notebooks walks through qubit placement runtime features exposed through the `cirq_google.workflow` tools.",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
"This notebooks walks through qubit placement runtime features exposed through the `cirq_google.workflow` tools."
]
},
{
Expand Down Expand Up @@ -77,8 +76,7 @@
" import cirq\n",
"except ImportError:\n",
" print(\"installing cirq...\")\n",
" # This depends on unreleased (as of 1.14) qubit placement functions.\n",
" !pip install --quiet cirq~=1.0.dev\n",
" !pip install --quiet cirq\n",
" print(\"installed cirq.\")\n",
" import cirq"
]
Expand Down
11 changes: 1 addition & 10 deletions docs/named_topologies.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@
"</table>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ea381f53cf89"
},
"source": [
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -85,7 +76,7 @@
" import cirq\n",
"except ImportError:\n",
" print(\"installing cirq...\")\n",
" !pip install --quiet cirq~=1.0.dev\n",
" !pip install --quiet cirq\n",
" print(\"installed cirq.\")\n",
" \n",
"import cirq"
Expand Down
7 changes: 2 additions & 5 deletions docs/start/intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@
"source": [
"To use Cirq one first needs to install Cirq. Installation instructions are available at [https://quantumai.google/cirq/start/install](https://quantumai.google/cirq/start/install). For the purpose of this tutorial, we run `pip install cirq` as shown in the following code cell to install the latest release of Cirq. \n",
"\n",
"> Different notebook execution systems exist, but for most part they have \"run\" button on a cell which you can click, or \"shift + enter\" is often the shortcut to run the cell. \n",
"\n",
"\n",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`.\n"
"> Different notebook execution systems exist, but for most part they have \"run\" button on a cell which you can click, or \"shift + enter\" is often the shortcut to run the cell. \n"
]
},
{
Expand All @@ -100,7 +97,7 @@
" import cirq\n",
"except ImportError:\n",
" print(\"installing cirq...\")\n",
" !pip install --quiet cirq~=1.0.dev\n",
" !pip install --quiet cirq\n",
" print(\"installed cirq.\")\n",
" import cirq\n",
"\n",
Expand Down
5 changes: 2 additions & 3 deletions docs/transform/routing_transformer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
"id": "RrRN9ilV0Ltg"
},
"source": [
"## Setup\n",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
"## Setup\n"
]
},
{
Expand All @@ -85,7 +84,7 @@
" import cirq\n",
"except ImportError:\n",
" print(\"installing cirq...\")\n",
" !pip install --quiet cirq~=1.0.dev\n",
" !pip install --quiet cirq\n",
" import cirq\n",
"\n",
" print(\"installed cirq.\")"
Expand Down
3 changes: 1 addition & 2 deletions docs/tutorials/google/colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
"id": "fe7e28f44667"
},
"source": [
"## Setup\n",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
"## Setup\n"
]
},
{
Expand Down
6 changes: 2 additions & 4 deletions docs/tutorials/google/echoes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@
"id": "bpBUR4JblClA"
},
"source": [
"We first install Cirq then import packages we will use.\n",
"\n",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
"We first install Cirq then import packages we will use.\n"
]
},
{
Expand All @@ -115,7 +113,7 @@
"try:\n",
" import cirq\n",
"except ImportError:\n",
" !pip install --quiet cirq~=1.0.dev"
" !pip install --quiet cirq"
]
},
{
Expand Down
6 changes: 2 additions & 4 deletions docs/tutorials/google/identifying_hardware_changes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@
"source": [
"### Setup\n",
"\n",
"First, install Cirq and import the necessary packages.\n",
"\n",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
"First, install Cirq and import the necessary packages.\n"
]
},
{
Expand Down Expand Up @@ -188,7 +186,7 @@
"try:\n",
" import cirq\n",
"except ImportError:\n",
" !pip install --quiet cirq~=1.0.dev"
" !pip install --quiet cirq"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/tutorials/google/spin_echoes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@
"id": "BRfLi9YSMg4v"
},
"source": [
"## Setup\n",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
"## Setup\n"
]
},
{
Expand All @@ -109,7 +108,7 @@
" import cirq\n",
"except ImportError:\n",
" print(\"installing cirq...\")\n",
" !pip install --quiet cirq~=1.0.dev\n",
" !pip install --quiet cirq\n",
" print(\"installed cirq.\")"
]
},
Expand Down
5 changes: 2 additions & 3 deletions docs/tutorials/google/visualizing_calibration_metrics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@
"id": "fe7e28f44667"
},
"source": [
"## Setup\n",
"Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq via `pip install cirq~=1.0.dev`."
"## Setup\n"
]
},
{
Expand All @@ -88,7 +87,7 @@
" import cirq\n",
"except ImportError:\n",
" print(\"installing cirq...\")\n",
" !pip install --quiet cirq~=1.0.dev\n",
" !pip install --quiet cirq\n",
" print(\"installed cirq.\")\n",
"import cirq\n",
"import cirq_google\n",
Expand Down
1 change: 1 addition & 0 deletions examples/stabilizer_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
" print(\"installing cirq...\")\n",
" !pip install --quiet cirq\n",
" print(\"installed cirq.\")\n",
" import cirq\n",
" \n",
"from cirq.contrib.svg import SVGCircuit\n",
"import examples.stabilizer_code as sc"
Expand Down

0 comments on commit 528b2d2

Please sign in to comment.