Skip to content

Commit 143f7d7

Browse files
authored
NEP-29 - enforce minimum Python version 3.10 (quantumlib#6591)
- Raise exception if running with Python <= 3.9.x - Clean up checks and notes relevant for old Pythons - Bump up to numpy~=1.22 which is effectively the minimum version that works with Python 3.10. We are a bit more permissive than NEP 29 which suggests numpy-1.23+. Fixes: quantumlib#6463 Ref: https://numpy.org/neps/nep-0029-deprecation_policy.html
1 parent b502f3a commit 143f7d7

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

cirq/_version.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
# limitations under the License.
1414

1515
"""Define version number here, read it from setup.py automatically,
16-
and warn users that the latest version of cirq uses python 3.9+"""
16+
and warn users that the latest version of cirq uses python 3.10+"""
1717

1818
import sys
1919

20-
if sys.version_info < (3, 9, 0): # pragma: no cover
20+
if sys.version_info < (3, 10, 0): # pragma: no cover
2121
raise SystemError(
22-
"You installed the latest version of cirq but aren't on python 3.9+.\n"
22+
"You installed the latest version of cirq but aren't on python 3.10+.\n"
2323
'To fix this error, you need to either:\n'
2424
'\n'
25-
'A) Update to python 3.9 or later.\n'
25+
'A) Update to python 3.10 or later.\n'
2626
'- OR -\n'
2727
'B) Explicitly install an older deprecated-but-compatible version '
2828
'of cirq (e.g. "python -m pip install cirq==1.1.*")'

cirq/ops/qid_util.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def q(*args: Union[int, str]) -> Union['cirq.LineQubit', 'cirq.GridQubit', 'cirq
4141
>>> cirq.q("foo") == cirq.NamedQubit("foo")
4242
True
4343
44-
Note that arguments should be treated as positional only, even
45-
though this is only enforceable in python 3.8 or later.
44+
Note that arguments should be treated as positional only.
4645
4746
Args:
4847
*args: One or two ints, or a single str, as described above.

cirq/protocols/json_serialization_test.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import contextlib
1516
import dataclasses
1617
import datetime
@@ -19,7 +20,6 @@
1920
import json
2021
import os
2122
import pathlib
22-
import sys
2323
import warnings
2424
from typing import Dict, List, Optional, Tuple, Type
2525
from unittest import mock
@@ -56,12 +56,6 @@ class _ModuleDeprecation:
5656
}
5757

5858

59-
# pyQuil 3.0, necessary for cirq_rigetti module requires
60-
# python >= 3.9
61-
if sys.version_info < (3, 9): # pragma: no cover
62-
del TESTED_MODULES['cirq_rigetti']
63-
64-
6559
def _get_testspecs_for_modules() -> List[ModuleJsonTestSpec]:
6660
modules = []
6761
for m in TESTED_MODULES.keys():

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ attrs
44
duet>=0.2.8
55
matplotlib~=3.0
66
networkx>=2.4
7-
numpy~=1.16
7+
numpy~=1.22
88
pandas
99
sortedcontainers~=2.0
1010
scipy<1.13.0

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
url='http://github.com/quantumlib/cirq',
6464
author='The Cirq Developers',
6565
author_email='[email protected]',
66-
python_requires=('>=3.9.0'),
66+
python_requires=('>=3.10.0'),
6767
install_requires=requirements,
6868
extras_require={'contrib': contrib_requirements},
6969
license='Apache 2',

0 commit comments

Comments
 (0)