Skip to content

Commit f9cf19e

Browse files
committed
Make QVM notebooks use development version of cirq_google
Problem: QVM notebooks would use the last stable cirq_google if imported before package upgrade. Solution: Import cirq_google only after its possible upgrade. Fixes b/425769714
1 parent 5c96d02 commit f9cf19e

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

docs/hardware/qubit_picking.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@
9595
"try:\n",
9696
" import cirq\n",
9797
"\n",
98-
" # trigger ImportError when cirq is not cirq~=1.0.dev\n",
99-
" from cirq_google.engine import load_device_noise_properties as _\n",
98+
" # raise ImportError when cirq is not new enough\n",
99+
" if cirq.__version__ == \"1.5.0\":\n",
100+
" raise ImportError(\"This notebook requires development version of Cirq\")\n",
100101
"except ImportError:\n",
101102
" print(\"installing cirq...\")\n",
102103
" !pip install --upgrade --quiet cirq~=1.0.dev\n",

docs/simulate/noisy_simulation.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@
8484
"try:\n",
8585
" import cirq\n",
8686
"\n",
87-
" # trigger ImportError when cirq is not cirq~=1.0.dev\n",
88-
" from cirq_google.engine import load_device_noise_properties as _\n",
87+
" # raise ImportError when cirq is not new enough\n",
88+
" if cirq.__version__ == \"1.5.0\":\n",
89+
" raise ImportError(\"This notebook requires development version of Cirq\")\n",
8990
"except ImportError:\n",
9091
" print(\"installing cirq...\")\n",
9192
" !pip install --upgrade --quiet cirq~=1.0.dev\n",

docs/simulate/quantum_virtual_machine.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@
9797
"\n",
9898
"try:\n",
9999
" import cirq\n",
100-
" import cirq_google\n",
101100
"\n",
102-
" # trigger ImportError when cirq is not cirq~=1.0.dev\n",
103-
" from cirq_google.engine import load_device_noise_properties as _\n",
101+
" # raise ImportError when cirq is not new enough\n",
102+
" if cirq.__version__ == \"1.5.0\":\n",
103+
" raise ImportError(\"This notebook requires development version of Cirq\")\n",
104+
"\n",
105+
" import cirq_google\n",
104106
"except ImportError:\n",
105107
" print(\"installing cirq...\")\n",
106108
" !pip install --upgrade --quiet cirq-google~=1.0.dev\n",

docs/simulate/qvm_basic_example.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@
104104
"\n",
105105
"try:\n",
106106
" import cirq\n",
107-
" import cirq_google\n",
108107
"\n",
109-
" # trigger ImportError when cirq is not cirq~=1.0.dev\n",
110-
" from cirq_google.engine import load_device_noise_properties as _\n",
108+
" # raise ImportError when cirq is not new enough\n",
109+
" if cirq.__version__ == \"1.5.0\":\n",
110+
" raise ImportError(\"This notebook requires development version of Cirq\")\n",
111+
"\n",
112+
" import cirq_google\n",
111113
"except ImportError:\n",
112114
" print(\"installing cirq...\")\n",
113115
" !pip install --upgrade --quiet cirq-google~=1.0.dev\n",

0 commit comments

Comments
 (0)