From b0823e0711b40293deb72a8680d246bc194e3540 Mon Sep 17 00:00:00 2001 From: Michael Hucka Date: Wed, 6 Aug 2025 07:32:38 -0700 Subject: [PATCH 1/4] Update isolated_notebook_test.py Update `NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES` to reflect changes in the contents of the `docs/simulate` directory. --- dev_tools/notebooks/isolated_notebook_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev_tools/notebooks/isolated_notebook_test.py b/dev_tools/notebooks/isolated_notebook_test.py index 6f4c8027f23..8776e254ad9 100644 --- a/dev_tools/notebooks/isolated_notebook_test.py +++ b/dev_tools/notebooks/isolated_notebook_test.py @@ -48,6 +48,8 @@ 'docs/simulate/noisy_simulation.ipynb', 'docs/simulate/quantum_virtual_machine.ipynb', 'docs/simulate/qvm_basic_example.ipynb', + 'docs/simulate/qvm_builder_code.ipynb', + 'docs/simulate/qvm_stabilizer_example.ipynb', # Remove once the renaming of `whitelisted_users` -> `allowlisted_users` # throughout cirq_google is released. 'docs/simulate/virtual_engine_interface.ipynb', From f11d1d0d6446c643c8daf041ba022f82d65712b9 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Mon, 11 Aug 2025 17:36:18 -0700 Subject: [PATCH 2/4] Use stable Cirq in QVM-related notebooks --- dev_tools/notebooks/isolated_notebook_test.py | 9 +-------- docs/hardware/qubit_picking.ipynb | 17 +---------------- docs/simulate/noisy_simulation.ipynb | 17 +---------------- docs/simulate/quantum_virtual_machine.ipynb | 11 ++--------- docs/simulate/qvm_basic_example.ipynb | 18 +----------------- docs/simulate/qvm_builder_code.ipynb | 13 +------------ docs/simulate/qvm_stabilizer_example.ipynb | 13 +------------ 7 files changed, 8 insertions(+), 90 deletions(-) diff --git a/dev_tools/notebooks/isolated_notebook_test.py b/dev_tools/notebooks/isolated_notebook_test.py index 8776e254ad9..0b46c82ef0a 100644 --- a/dev_tools/notebooks/isolated_notebook_test.py +++ b/dev_tools/notebooks/isolated_notebook_test.py @@ -43,16 +43,9 @@ # Please, always indicate in comments the feature used for easier bookkeeping. NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES: list[str] = [ - # Requires `load_device_noise_properties` from #7369 - 'docs/hardware/qubit_picking.ipynb', - 'docs/simulate/noisy_simulation.ipynb', - 'docs/simulate/quantum_virtual_machine.ipynb', - 'docs/simulate/qvm_basic_example.ipynb', - 'docs/simulate/qvm_builder_code.ipynb', - 'docs/simulate/qvm_stabilizer_example.ipynb', # Remove once the renaming of `whitelisted_users` -> `allowlisted_users` # throughout cirq_google is released. - 'docs/simulate/virtual_engine_interface.ipynb', + 'docs/simulate/virtual_engine_interface.ipynb' ] # By default all notebooks should be tested, however, this list contains exceptions to the rule diff --git a/docs/hardware/qubit_picking.ipynb b/docs/hardware/qubit_picking.ipynb index 23879927d2e..be1ea41b18e 100644 --- a/docs/hardware/qubit_picking.ipynb +++ b/docs/hardware/qubit_picking.ipynb @@ -71,17 +71,6 @@ "When running a circuit on a noisy quantum hardware device, the choice and even ordering of hardware qubits used directly affects how reliably the device measures a correct result. This notebook covers some of the available qubit error information that can be useful for picking good hardware qubits to run your circuit on." ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "cb67ae611d34" - }, - "source": [ - "## Setup\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 --upgrade cirq~=1.0.dev`." - ] - }, { "cell_type": "code", "execution_count": null, @@ -94,13 +83,9 @@ "# @title Setup\n", "try:\n", " import cirq\n", - "\n", - " # raise ImportError when cirq is not new enough\n", - " if cirq.__version__ == \"1.5.0\":\n", - " raise ImportError(\"This notebook requires the development version of Cirq\")\n", "except ImportError:\n", " print(\"installing cirq...\")\n", - " !pip install --upgrade --quiet cirq~=1.0.dev\n", + " !pip install --quiet cirq\n", " print(\"installed cirq.\")\n", " import cirq\n", "\n", diff --git a/docs/simulate/noisy_simulation.ipynb b/docs/simulate/noisy_simulation.ipynb index 66298e9899d..c7e32433514 100644 --- a/docs/simulate/noisy_simulation.ipynb +++ b/docs/simulate/noisy_simulation.ipynb @@ -62,17 +62,6 @@ "" ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "f9c6fb06ebbf" - }, - "source": [ - "## Setup\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 --upgrade cirq~=1.0.dev`." - ] - }, { "cell_type": "code", "execution_count": null, @@ -83,13 +72,9 @@ "source": [ "try:\n", " import cirq\n", - "\n", - " # raise ImportError when cirq is not new enough\n", - " if cirq.__version__ == \"1.5.0\":\n", - " raise ImportError(\"This notebook requires the development version of Cirq\")\n", "except ImportError:\n", " print(\"installing cirq...\")\n", - " !pip install --upgrade --quiet cirq~=1.0.dev\n", + " !pip install --quiet cirq\n", " print(\"installed cirq.\")" ] }, diff --git a/docs/simulate/quantum_virtual_machine.ipynb b/docs/simulate/quantum_virtual_machine.ipynb index 38b4d134d03..9d62cbb36d1 100644 --- a/docs/simulate/quantum_virtual_machine.ipynb +++ b/docs/simulate/quantum_virtual_machine.ipynb @@ -79,9 +79,7 @@ "id": "p31cCK_T1ylm" }, "source": [ - "## Setup\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 --upgrade cirq~=1.0.dev`." + "## Setup" ] }, { @@ -97,15 +95,10 @@ "\n", "try:\n", " import cirq\n", - "\n", - " # raise ImportError when cirq is not new enough\n", - " if cirq.__version__ == \"1.5.0\":\n", - " raise ImportError(\"This notebook requires the development version of Cirq\")\n", - "\n", " import cirq_google\n", "except ImportError:\n", " print(\"installing cirq...\")\n", - " !pip install --upgrade --quiet cirq-google~=1.0.dev\n", + " !pip install --quiet cirq-google\n", " print(\"installed cirq.\")\n", " import cirq\n", " import cirq_google\n", diff --git a/docs/simulate/qvm_basic_example.ipynb b/docs/simulate/qvm_basic_example.ipynb index 2fbc7c6958e..1279b777615 100644 --- a/docs/simulate/qvm_basic_example.ipynb +++ b/docs/simulate/qvm_basic_example.ipynb @@ -80,17 +80,6 @@ "## **Install** Cirq and qsim" ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "8e3ded3ff3d1" - }, - "source": [ - "## Setup\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 --upgrade cirq~=1.0.dev`." - ] - }, { "cell_type": "code", "execution_count": null, @@ -104,15 +93,10 @@ "\n", "try:\n", " import cirq\n", - "\n", - " # raise ImportError when cirq is not new enough\n", - " if cirq.__version__ == \"1.5.0\":\n", - " raise ImportError(\"This notebook requires the development version of Cirq\")\n", - "\n", " import cirq_google\n", "except ImportError:\n", " print(\"installing cirq...\")\n", - " !pip install --upgrade --quiet cirq-google~=1.0.dev\n", + " !pip install --quiet cirq-google\n", " print(\"installed cirq.\")\n", " import cirq\n", " import cirq_google\n", diff --git a/docs/simulate/qvm_builder_code.ipynb b/docs/simulate/qvm_builder_code.ipynb index 3f140a83f14..db5f04ec493 100644 --- a/docs/simulate/qvm_builder_code.ipynb +++ b/docs/simulate/qvm_builder_code.ipynb @@ -80,17 +80,6 @@ "## **Install** Cirq and qsim" ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "3f2687e48726" - }, - "source": [ - "## Setup\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 --upgrade cirq~=1.0.dev`." - ] - }, { "cell_type": "code", "execution_count": null, @@ -107,7 +96,7 @@ " import cirq_google\n", "except ImportError:\n", " print(\"installing cirq...\")\n", - " !pip install --upgrade --quiet cirq-google~=1.0.dev\n", + " !pip install --quiet cirq-google\n", " print(\"installed cirq.\")\n", " import cirq\n", " import cirq_google\n", diff --git a/docs/simulate/qvm_stabilizer_example.ipynb b/docs/simulate/qvm_stabilizer_example.ipynb index 5cdf890ce49..98b024d3b61 100644 --- a/docs/simulate/qvm_stabilizer_example.ipynb +++ b/docs/simulate/qvm_stabilizer_example.ipynb @@ -80,17 +80,6 @@ "## **Install** Cirq and qsim, Create **Quantum Virtual Machine**" ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "3f2687e48726" - }, - "source": [ - "## Setup\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 --upgrade cirq~=1.0.dev`." - ] - }, { "cell_type": "code", "execution_count": null, @@ -107,7 +96,7 @@ " import cirq_google\n", "except ImportError:\n", " print(\"installing cirq...\")\n", - " !pip install --upgrade --quiet cirq-google~=1.0.dev\n", + " !pip install --quiet cirq-google\n", " print(\"installed cirq.\")\n", " import cirq\n", " import cirq_google\n", From 58a8fd70f4ee7f53ffa7ae918ea0c9171a915fde Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Mon, 11 Aug 2025 18:24:32 -0700 Subject: [PATCH 3/4] Use stable cirq in virtual_engine_interface.ipynb The `allowlisted_users` argument is already in the stable cirq. --- dev_tools/notebooks/isolated_notebook_test.py | 6 +----- docs/simulate/virtual_engine_interface.ipynb | 14 ++------------ 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/dev_tools/notebooks/isolated_notebook_test.py b/dev_tools/notebooks/isolated_notebook_test.py index 0b46c82ef0a..c281606644b 100644 --- a/dev_tools/notebooks/isolated_notebook_test.py +++ b/dev_tools/notebooks/isolated_notebook_test.py @@ -42,11 +42,7 @@ # note that these notebooks are still tested in dev_tools/notebook_test.py # Please, always indicate in comments the feature used for easier bookkeeping. -NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES: list[str] = [ - # Remove once the renaming of `whitelisted_users` -> `allowlisted_users` - # throughout cirq_google is released. - 'docs/simulate/virtual_engine_interface.ipynb' -] +NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES: list[str] = [] # By default all notebooks should be tested, however, this list contains exceptions to the rule # please always add a reason for skipping. diff --git a/docs/simulate/virtual_engine_interface.ipynb b/docs/simulate/virtual_engine_interface.ipynb index e37319035b1..1ddc31350e9 100644 --- a/docs/simulate/virtual_engine_interface.ipynb +++ b/docs/simulate/virtual_engine_interface.ipynb @@ -31,15 +31,6 @@ "# limitations under the License." ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "ff0101ac0724" - }, - "source": [ - "Note: this notebook relies on unreleased Cirq features. If you want to try these features, make sure you install cirq-google via `pip install --upgrade cirq-google~=1.0.dev`." - ] - }, { "cell_type": "markdown", "metadata": { @@ -103,14 +94,13 @@ "source": [ "try:\n", " import cirq\n", - " import cirq_google\n", "except ImportError:\n", " print(\"installing cirq...\")\n", - " !pip install --upgrade --quiet cirq~=1.0.dev cirq-google~=1.0.dev\n", + " !pip install --quiet cirq\n", " print(\"installed cirq.\")\n", " import cirq\n", - " import cirq_google\n", "\n", + "import cirq_google\n", "import sympy" ] }, From e3b3344e226827aa999a152b7501df63c97e25f1 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Mon, 11 Aug 2025 18:41:42 -0700 Subject: [PATCH 4/4] Use similar import stanza as in other notebooks --- docs/simulate/virtual_engine_interface.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/simulate/virtual_engine_interface.ipynb b/docs/simulate/virtual_engine_interface.ipynb index 1ddc31350e9..a8d024548e9 100644 --- a/docs/simulate/virtual_engine_interface.ipynb +++ b/docs/simulate/virtual_engine_interface.ipynb @@ -94,13 +94,14 @@ "source": [ "try:\n", " import cirq\n", + " import cirq_google\n", "except ImportError:\n", " print(\"installing cirq...\")\n", " !pip install --quiet cirq\n", " print(\"installed cirq.\")\n", " import cirq\n", + " import cirq_google\n", "\n", - "import cirq_google\n", "import sympy" ] },