Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum python version to 3.9 #6167

Merged
merged 26 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
13d1aad
dropped 3.7 support
skushnir123 Jun 27, 2023
09df863
Update setup.py
skushnir123 Jun 27, 2023
3f2c731
Merge branch 'master' into drop-37
skushnir123 Jun 27, 2023
e6e07d1
Merge branch 'master' into drop-37
skushnir123 Jun 27, 2023
7cd30b5
Merge branch 'master' into drop-37
skushnir123 Jun 28, 2023
078ea82
Removed 3.8 as well
skushnir123 Jun 28, 2023
5b7f497
changing some more 3.8's to 3.9's
skushnir123 Jun 28, 2023
bc0a9fe
reformat
skushnir123 Jun 28, 2023
351e48f
Update pyproject.toml
skushnir123 Jun 28, 2023
d6d0ff8
Update setup.py
skushnir123 Jun 28, 2023
8816a5d
changing notebook python versions
skushnir123 Jun 28, 2023
40b9631
Update setup.py
skushnir123 Jun 28, 2023
e570ef9
testing
skushnir123 Jun 28, 2023
c941c3c
Update packaging_test.sh
skushnir123 Jun 28, 2023
57ae7c7
Update packaging_test.sh
skushnir123 Jun 28, 2023
fc2ab78
Update packaging_test.sh
skushnir123 Jun 28, 2023
142197a
adding 311
skushnir123 Jun 28, 2023
67e0159
updating formatter
skushnir123 Jun 28, 2023
0fb46e0
Merge branch 'master' into drop-37
skushnir123 Jun 29, 2023
ed1a979
Bump Python version for CI actions to 3.9
pavoljuhas Jun 29, 2023
f902d80
Remove code specific to Python <= 3.8 only
pavoljuhas Jun 29, 2023
362d884
Drop redundant python_version checks from requirement files
pavoljuhas Jun 29, 2023
084903e
Fix required Python version in the installation doc
pavoljuhas Jun 29, 2023
c3eaedb
Clean redundant assertion
pavoljuhas Jun 29, 2023
68f9113
Skip coverage for code run in subprocess
pavoljuhas Jun 29, 2023
ba8c533
Suggest a more recent cirq for old pythons
pavoljuhas Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: pip install -r dev_tools/requirements/isolated-base.env.txt
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Misc
run: check/misc
Expand All @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: pip install -r dev_tools/requirements/deps/packaging.txt
Expand All @@ -46,7 +46,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: pip install -r dev_tools/requirements/deps/format.txt
Expand All @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install mypy
run: pip install -r dev_tools/requirements/mypy.env.txt
Expand All @@ -74,7 +74,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install changed files test dependencies
run: dev_tools/conf/pip-install-minimal-for-pytest-changed-files.sh
Expand All @@ -87,7 +87,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install pylint
run: pip install -r dev_tools/requirements/pylint.env.txt
Expand All @@ -102,7 +102,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: pip install -r dev_tools/requirements/dev.env.txt
Expand All @@ -117,7 +117,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: pip install -r dev_tools/requirements/deps/tensorflow-docs.txt
Expand All @@ -139,7 +139,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: pip install -r dev_tools/requirements/isolated-base.env.txt
Expand All @@ -149,7 +149,7 @@ jobs:
name: Pytest Ubuntu
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.9', '3.10' ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: pip install pip-tools
Expand All @@ -192,7 +192,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: |
Expand All @@ -208,7 +208,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: |
Expand All @@ -224,7 +224,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- uses: actions/cache@v2
with:
Expand All @@ -244,7 +244,7 @@ jobs:
name: Pytest Windows
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.9', '3.10' ]
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
Expand All @@ -269,7 +269,7 @@ jobs:
name: Pytest MacOS
strategy:
matrix:
python-version: [ '3.7.16', '3.8', '3.9', '3.10' ]
python-version: [ '3.9', '3.10' ]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -302,7 +302,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: pip install -r dev_tools/requirements/isolated-base.env.txt
Expand All @@ -320,7 +320,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: pip install -r dev_tools/requirements/notebooks.env.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
build:
image: latest
python:
version: 3.8
version: 3.9
install:
- requirements: rtd_docs/requirements.txt
sphinx:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-slim AS cirq_base
FROM python:3.9-slim AS cirq_base

# Install dependencies.
# rm -rf /var/lib/apt/lists/* cleans up apt cache. See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
Expand Down
2 changes: 1 addition & 1 deletion asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dvcs": "git",
"environment_type": "virtualenv",
"show_commit_url": "https://github.com/quantumlib/Cirq/commit/",
"pythons": ["3.8"],
"pythons": ["3.9"],
"matrix": {"env_nobuild": {"PYTHONOPTIMIZE": ["-O", ""]}},
"benchmark_dir": "benchmarks",
"env_dir": ".asv/env",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To run all benchmarks, navigate to the root Cirq directory at the command line a

You can also pass arguments to the script, which would be forwarded to the `asv run` command. For eg:
```bash
./check/asv_run --quick --bench bench_examples --python 3.8
./check/asv_run --quick --bench bench_examples --python 3.9
```

Please refer [Running Benchmarks guide by ASV](https://asv.readthedocs.io/en/stable/using.html#running-benchmarks) for more information.
Expand Down
2 changes: 1 addition & 1 deletion cirq-aqt/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
url='http://github.com/quantumlib/cirq',
author='The Cirq Developers',
author_email='cirq-dev@googlegroups.com',
python_requires=('>=3.7.0'),
python_requires=('>=3.9.0'),
install_requires=requirements,
license='Apache 2',
description=description,
Expand Down
15 changes: 3 additions & 12 deletions cirq-core/cirq/_compat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
import collections
import dataclasses
import importlib
import importlib.metadata
import logging
import multiprocessing
import os
Expand Down Expand Up @@ -722,21 +722,12 @@ def test_metadata_search_path():
subprocess_context(_test_metadata_search_path_inner)()


def _test_metadata_search_path_inner():
def _test_metadata_search_path_inner(): # pragma: no cover
# initialize the DeprecatedModuleFinders
# pylint: disable=unused-import
import cirq.testing._compat_test_data.module_a

try:
# importlib.metadata for python 3.8+
# coverage: ignore
import importlib.metadata as m
except: # coverage: ignore
# coverage: ignore
# importlib_metadata for python <3.8
m = pytest.importorskip("importlib_metadata")

assert m.metadata('flynt')
assert importlib.metadata.metadata('flynt')


def test_metadata_distributions_after_deprecated_submodule():
Expand Down
10 changes: 5 additions & 5 deletions cirq-core/cirq/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
# 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.7+"""
and warn users that the latest version of cirq uses python 3.9+"""

import sys

if sys.version_info < (3, 7, 0):
if sys.version_info < (3, 9, 0):
# coverage: ignore
raise SystemError(
"You installed the latest version of cirq but aren't on python 3.7+.\n"
"You installed the latest version of cirq but aren't on python 3.9+.\n"
'To fix this error, you need to either:\n'
'\n'
'A) Update to python 3.7 or later.\n'
'A) Update to python 3.9 or later.\n'
'- OR -\n'
'B) Explicitly install an older deprecated-but-compatible version '
'of cirq (e.g. "python -m pip install cirq==0.5.*")'
'of cirq (e.g. "python -m pip install cirq==1.1.*")'
)

__version__ = "1.2.0.dev"
4 changes: 2 additions & 2 deletions cirq-core/cirq/protocols/json_serialization_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class _ModuleDeprecation:


# pyQuil 3.0, necessary for cirq_rigetti module requires
# python >= 3.7
if sys.version_info < (3, 7): # pragma: no cover
# python >= 3.9
if sys.version_info < (3, 9): # pragma: no cover
del TESTED_MODULES['cirq_rigetti']


Expand Down
5 changes: 0 additions & 5 deletions cirq-core/cirq/study/resolver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Tests for parameter resolvers."""

import fractions
import sys

import numpy as np
import pytest
Expand Down Expand Up @@ -243,10 +242,6 @@ def _resolved_value_(self):
assert r.value_of(b) == 'Baz'


# sympy 1.12 does not support Python 3.7
@pytest.mark.xfail(
condition=sys.version_info < (3, 8, 0), reason='this test requires sympy 1.12', strict=True
)
def test_custom_value_not_implemented():
class Bar:
def _resolved_value_(self):
Expand Down
3 changes: 0 additions & 3 deletions cirq-core/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Runtime requirements for the python 3 version of cirq.

# functools.cached_property was introduced in python 3.8
backports.cached_property~=1.0.1; python_version < '3.8'

duet~=0.2.8
matplotlib~=3.0
networkx>=2.4
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
url='http://github.com/quantumlib/cirq',
author='The Cirq Developers',
author_email='cirq-dev@googlegroups.com',
python_requires=('>=3.7.0'),
python_requires=('>=3.9.0'),
install_requires=requirements,
extras_require={'contrib': contrib_requirements},
license='Apache 2',
Expand Down
2 changes: 1 addition & 1 deletion cirq-ft/cirq_ft/algos/and_gate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
3 changes: 0 additions & 3 deletions cirq-ft/cirq_ft/infra/gate_with_registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
# limitations under the License.

import abc
import sys
from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union, overload

import attr
import cirq
import numpy as np

assert sys.version_info > (3, 6), "https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep468"


@attr.frozen
class Register:
Expand Down
2 changes: 1 addition & 1 deletion cirq-ft/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
url='http://github.com/quantumlib/cirq',
author='The Cirq Developers',
author_email='cirq-dev@googlegroups.com',
python_requires='>=3.7.0',
python_requires='>=3.9.0',
install_requires=requirements,
license='Apache 2',
description=description,
Expand Down
10 changes: 5 additions & 5 deletions cirq-google/cirq_google/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
# 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.7+"""
and warn users that the latest version of cirq uses python 3.9+"""

import sys

if sys.version_info < (3, 7, 0):
if sys.version_info < (3, 9, 0):
# coverage: ignore
raise SystemError(
"You installed the latest version of cirq but aren't on python 3.7+.\n"
"You installed the latest version of cirq but aren't on python 3.9+.\n"
'To fix this error, you need to either:\n'
'\n'
'A) Update to python 3.7 or later.\n'
'A) Update to python 3.9 or later.\n'
'- OR -\n'
'B) Explicitly install an older deprecated-but-compatible version '
'of cirq (e.g. "python -m pip install cirq==0.5.*")'
'of cirq (e.g. "python -m pip install cirq==1.1.*")'
)

__version__ = "1.2.0.dev"
Loading