diff --git a/cirq-aqt/setup.py b/cirq-aqt/setup.py index e5a803e54bd..73352a05c68 100644 --- a/cirq-aqt/setup.py +++ b/cirq-aqt/setup.py @@ -60,7 +60,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires=('>=3.9.0'), + python_requires=('>=3.10.0'), install_requires=requirements, license='Apache 2', description=description, diff --git a/cirq-core/cirq/_version.py b/cirq-core/cirq/_version.py index b9539b39b18..4190ae6fef5 100644 --- a/cirq-core/cirq/_version.py +++ b/cirq-core/cirq/_version.py @@ -13,16 +13,16 @@ # limitations under the License. """Define version number here, read it from setup.py automatically, -and warn users that the latest version of cirq uses python 3.9+""" +and warn users that the latest version of cirq uses python 3.10+""" import sys -if sys.version_info < (3, 9, 0): # pragma: no cover +if sys.version_info < (3, 10, 0): # pragma: no cover raise SystemError( - "You installed the latest version of cirq but aren't on python 3.9+.\n" + "You installed the latest version of cirq but aren't on python 3.10+.\n" 'To fix this error, you need to either:\n' '\n' - 'A) Update to python 3.9 or later.\n' + 'A) Update to python 3.10 or later.\n' '- OR -\n' 'B) Explicitly install an older deprecated-but-compatible version ' 'of cirq (e.g. "python -m pip install cirq==1.1.*")' diff --git a/cirq-core/cirq/ops/qid_util.py b/cirq-core/cirq/ops/qid_util.py index 79f13e59762..4c114c8a828 100644 --- a/cirq-core/cirq/ops/qid_util.py +++ b/cirq-core/cirq/ops/qid_util.py @@ -41,8 +41,7 @@ def q(*args: Union[int, str]) -> Union['cirq.LineQubit', 'cirq.GridQubit', 'cirq >>> cirq.q("foo") == cirq.NamedQubit("foo") True - Note that arguments should be treated as positional only, even - though this is only enforceable in python 3.8 or later. + Note that arguments should be treated as positional only. Args: *args: One or two ints, or a single str, as described above. diff --git a/cirq-core/cirq/protocols/json_serialization_test.py b/cirq-core/cirq/protocols/json_serialization_test.py index e48fa23504a..82ac67b6278 100644 --- a/cirq-core/cirq/protocols/json_serialization_test.py +++ b/cirq-core/cirq/protocols/json_serialization_test.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import contextlib import dataclasses import datetime @@ -19,7 +20,6 @@ import json import os import pathlib -import sys import warnings from typing import Dict, List, Optional, Tuple, Type from unittest import mock @@ -56,12 +56,6 @@ class _ModuleDeprecation: } -# pyQuil 3.0, necessary for cirq_rigetti module requires -# python >= 3.9 -if sys.version_info < (3, 9): # pragma: no cover - del TESTED_MODULES['cirq_rigetti'] - - def _get_testspecs_for_modules() -> List[ModuleJsonTestSpec]: modules = [] for m in TESTED_MODULES.keys(): diff --git a/cirq-core/requirements.txt b/cirq-core/requirements.txt index abde404991c..ccba6c10b72 100644 --- a/cirq-core/requirements.txt +++ b/cirq-core/requirements.txt @@ -4,7 +4,7 @@ attrs duet>=0.2.8 matplotlib~=3.0 networkx>=2.4 -numpy~=1.16 +numpy~=1.22 pandas sortedcontainers~=2.0 scipy<1.13.0 diff --git a/cirq-core/setup.py b/cirq-core/setup.py index 54179e52852..a55d1c644b6 100644 --- a/cirq-core/setup.py +++ b/cirq-core/setup.py @@ -63,7 +63,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires=('>=3.9.0'), + python_requires=('>=3.10.0'), install_requires=requirements, extras_require={'contrib': contrib_requirements}, license='Apache 2', diff --git a/cirq-ft/setup.py b/cirq-ft/setup.py index 37a6a10a038..f02d227043a 100644 --- a/cirq-ft/setup.py +++ b/cirq-ft/setup.py @@ -59,7 +59,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires='>=3.9.0', + python_requires='>=3.10.0', install_requires=requirements, license='Apache 2', description=description, diff --git a/cirq-google/cirq_google/_version.py b/cirq-google/cirq_google/_version.py index b9539b39b18..4190ae6fef5 100644 --- a/cirq-google/cirq_google/_version.py +++ b/cirq-google/cirq_google/_version.py @@ -13,16 +13,16 @@ # limitations under the License. """Define version number here, read it from setup.py automatically, -and warn users that the latest version of cirq uses python 3.9+""" +and warn users that the latest version of cirq uses python 3.10+""" import sys -if sys.version_info < (3, 9, 0): # pragma: no cover +if sys.version_info < (3, 10, 0): # pragma: no cover raise SystemError( - "You installed the latest version of cirq but aren't on python 3.9+.\n" + "You installed the latest version of cirq but aren't on python 3.10+.\n" 'To fix this error, you need to either:\n' '\n' - 'A) Update to python 3.9 or later.\n' + 'A) Update to python 3.10 or later.\n' '- OR -\n' 'B) Explicitly install an older deprecated-but-compatible version ' 'of cirq (e.g. "python -m pip install cirq==1.1.*")' diff --git a/cirq-google/setup.py b/cirq-google/setup.py index a39d8b3b750..a1a8328b8ef 100644 --- a/cirq-google/setup.py +++ b/cirq-google/setup.py @@ -62,7 +62,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires=('>=3.9.0'), + python_requires=('>=3.10.0'), install_requires=requirements, license='Apache 2', description=description, diff --git a/cirq-ionq/setup.py b/cirq-ionq/setup.py index 19f4bff5e93..edc4a9787e7 100644 --- a/cirq-ionq/setup.py +++ b/cirq-ionq/setup.py @@ -59,7 +59,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires=('>=3.9.0'), + python_requires=('>=3.10.0'), install_requires=requirements, license='Apache 2', description=description, diff --git a/cirq-pasqal/setup.py b/cirq-pasqal/setup.py index 9b101a3a0df..8867b39703a 100644 --- a/cirq-pasqal/setup.py +++ b/cirq-pasqal/setup.py @@ -58,7 +58,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires='>=3.9.0', + python_requires='>=3.10.0', install_requires=requirements, license='Apache 2', description=description, diff --git a/cirq-rigetti/setup.py b/cirq-rigetti/setup.py index 93c1d7731ce..2b4cab45879 100644 --- a/cirq-rigetti/setup.py +++ b/cirq-rigetti/setup.py @@ -60,7 +60,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires='>=3.9.0', + python_requires='>=3.10.0', install_requires=requirements, license='Apache 2', description=description, diff --git a/cirq-web/setup.py b/cirq-web/setup.py index 18ed9c99b80..dd119fb896e 100644 --- a/cirq-web/setup.py +++ b/cirq-web/setup.py @@ -62,7 +62,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires='>=3.9.0', + python_requires='>=3.10.0', install_requires=requirements, license='Apache 2', description=description, diff --git a/dev_tools/modules_test.py b/dev_tools/modules_test.py index 2d7f90164bf..a8c32943c68 100644 --- a/dev_tools/modules_test.py +++ b/dev_tools/modules_test.py @@ -37,7 +37,7 @@ def test_modules(): 'url': 'http://github.com/quantumlib/cirq', 'author': 'The Cirq Developers', 'author_email': 'cirq-dev@googlegroups.com', - 'python_requires': '>=3.9.0', + 'python_requires': '>=3.10.0', 'install_requires': ['req1', 'req2'], 'license': 'Apache 2', 'packages': ['pack1', 'pack1.sub'], diff --git a/dev_tools/modules_test_data/mod1/setup.py b/dev_tools/modules_test_data/mod1/setup.py index 001c077cd64..3fbec467755 100644 --- a/dev_tools/modules_test_data/mod1/setup.py +++ b/dev_tools/modules_test_data/mod1/setup.py @@ -22,7 +22,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires=('>=3.9.0'), + python_requires=('>=3.10.0'), install_requires=requirements, license='Apache 2', packages=pack1_packages, diff --git a/dev_tools/snippets_test.py b/dev_tools/snippets_test.py index cc9e8955515..70acc23f7ee 100644 --- a/dev_tools/snippets_test.py +++ b/dev_tools/snippets_test.py @@ -54,8 +54,8 @@ where pattern is the regex matching pattern (passed to re.compile) and substitution is the replacement string. """ + import inspect -import sys from typing import Any, Dict, List, Optional, Pattern, Tuple, Iterator import os @@ -759,16 +759,15 @@ def test_assert_code_snippet_executes_correctly(): {}, ) - if sys.version_info[0] >= 3: # Our print capture only works in python 3. - with pytest.raises(AssertionError): - assert_code_snippet_executes_correctly( - """ + with pytest.raises(AssertionError): + assert_code_snippet_executes_correctly( + """ print("abc") # prints # def """, - {}, - ) + {}, + ) assert_code_snippet_executes_correctly( """ diff --git a/setup.py b/setup.py index a1b2d14a954..022265562df 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ url='http://github.com/quantumlib/cirq', author='The Cirq Developers', author_email='cirq-dev@googlegroups.com', - python_requires='>=3.9.0', + python_requires='>=3.10.0', install_requires=requirements, extras_require={'dev_env': dev_requirements}, license='Apache 2',