Skip to content

drop support for Python 3.7 #7110

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

Merged
merged 3 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
332 changes: 39 additions & 293 deletions .circleci/config.yml

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: 2.1

# How to test the Linux jobs:
# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/
# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.7
# - Replace binary_linux_wheel_py3.7 with the name of the job you want to test.
# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8
# - Replace binary_linux_wheel_py3.8 with the name of the job you want to test.
# Job names are 'name:' key.

executors:
Expand Down Expand Up @@ -201,7 +201,7 @@ binary_common: &binary_common
default: ""
# Don't edit these
python_version:
description: "Python version to build against (e.g., 3.7)"
description: "Python version to build against (e.g., 3.8)"
type: string
cu_version:
description: "CUDA version to build against, in CU format (e.g., cpu or cu100)"
Expand Down Expand Up @@ -258,7 +258,7 @@ smoke_test_common: &smoke_test_common
jobs:
circleci_consistency:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
steps:
- checkout
- pip_install:
Expand All @@ -271,7 +271,7 @@ jobs:

lint_python_and_config:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
steps:
- checkout
- pip_install:
Expand All @@ -290,7 +290,7 @@ jobs:

lint_c:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
steps:
- apt_install:
args: libtinfo5
Expand All @@ -312,7 +312,7 @@ jobs:

type_check_python:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
steps:
- checkout
- install_torchvision:
Expand All @@ -326,7 +326,7 @@ jobs:

unittest_torchhub:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
steps:
- checkout
- install_torchvision
Expand All @@ -335,7 +335,7 @@ jobs:

unittest_onnx:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
steps:
- checkout
- install_torchvision
Expand All @@ -347,7 +347,7 @@ jobs:

unittest_extended:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
resource_class: xlarge
steps:
- checkout
Expand Down Expand Up @@ -594,7 +594,7 @@ jobs:
description: "What whl subfolder to upload to, e.g., blank or cu100/ (trailing slash is important)"
type: string
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
steps:
- attach_workspace:
at: ~/workspace
Expand Down Expand Up @@ -1017,7 +1017,7 @@ jobs:
build_docs:
<<: *binary_common
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
resource_class: 2xlarge+
steps:
- attach_workspace:
Expand Down
16 changes: 8 additions & 8 deletions .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from jinja2 import select_autoescape


PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
PYTHON_VERSIONS = ["3.8", "3.9", "3.10"]

RC_PATTERN = r"/v[0-9]+(\.[0-9]+)*-rc[0-9]+/"

Expand Down Expand Up @@ -55,16 +55,16 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
):
fb = "main"
if not fb and (
os_type == "linux" and cu_version == "cpu" and btype == "wheel" and python_version == "3.7"
os_type == "linux" and cu_version == "cpu" and btype == "wheel" and python_version == "3.8"
):
# the fields must match the build_docs "requires" dependency
fb = "/.*/"

# Disable all Linux Wheels Workflows from CircleCI
# since those will now be done through Nova. We'll keep
# around the py3.7 Linux Wheels build since the docs
# around the py3.8 Linux Wheels build since the docs
# job depends on it.
if os_type == "linux" and btype == "wheel" and python_version != "3.7":
if os_type == "linux" and btype == "wheel" and python_version != "3.8":
continue

# Disable all Macos Wheels Workflows from CircleCI.
Expand Down Expand Up @@ -98,7 +98,7 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix=""
)
)

# For the remaining py3.7 Linux Wheels job left around for the docs build,
# For the remaining py3.8 Linux Wheels job left around for the docs build,
# we'll disable uploads.
if os_type == "linux" and btype == "wheel":
upload = False
Expand All @@ -116,9 +116,9 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix=""
def build_doc_job(filter_branch):
job = {
"name": "build_docs",
"python_version": "3.7",
"python_version": "3.8",
"requires": [
"binary_linux_wheel_py3.7_cpu",
"binary_linux_wheel_py3.8_cpu",
],
}

Expand All @@ -131,7 +131,7 @@ def upload_doc_job(filter_branch):
job = {
"name": "upload_docs",
"context": "org-member",
"python_version": "3.7",
"python_version": "3.8",
"requires": [
"build_docs",
],
Expand Down
2 changes: 1 addition & 1 deletion .circleci/unittest/ios/scripts/binary_ios_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export PATH="~/anaconda/bin:${PATH}"
source ~/anaconda/bin/activate

# install dependencies
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions wget --yes
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests wget --yes
conda install -c conda-forge valgrind --yes
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/prototype-tests-linux-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-linux-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
tests:
strategy:
matrix:
python_version: ["3.7", "3.8", "3.9", "3.10"]
python_version: ["3.8", "3.9", "3.10"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8

- name: Upgrade system packages
run: python -m pip install --upgrade pip setuptools wheel
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ supported Python versions.
+--------------------------+--------------------------+---------------------------------+
| ``torch`` | ``torchvision`` | ``python`` |
+==========================+==========================+=================================+
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.7.2``, ``<=3.10`` |
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.8``, ``<=3.10`` |
+--------------------------+--------------------------+---------------------------------+
| ``1.13.0`` | ``0.14.0`` | ``>=3.7.2``, ``<=3.10`` |
+--------------------------+--------------------------+---------------------------------+
Expand Down
3 changes: 1 addition & 2 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ retry () {
}

# Inputs:
# PYTHON_VERSION (3.7, 3.8, 3.9)
# PYTHON_VERSION (3.8, 3.9, 3.10)
# UNICODE_ABI (bool)
#
# Outputs:
Expand All @@ -169,7 +169,6 @@ setup_wheel_python() {
# Install native CentOS libJPEG, freetype and GnuTLS
yum install -y libjpeg-turbo-devel freetype gnutls
case "$PYTHON_VERSION" in
3.7) python_abi=cp37-cp37m ;;
3.8) python_abi=cp38-cp38 ;;
3.9) python_abi=cp39-cp39 ;;
3.10) python_abi=cp310-cp310 ;;
Expand Down
2 changes: 1 addition & 1 deletion packaging/torchvision/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ c_compiler:
cxx_compiler:
- vs2017 # [win]
python:
- 3.7
- 3.8
# This differs from target_platform in that it determines what subdir the compiler
# will target, not what subdir the compiler package will be itself.
# For example, we need a win-64 vs2008_win-32 package, so that we compile win-32
Expand Down
2 changes: 1 addition & 1 deletion packaging/vs2017/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ c_compiler:
cxx_compiler:
- vs2017 # [win]
python:
- 3.7
- 3.8
# This differs from target_platform in that it determines what subdir the compiler
# will target, not what subdir the compiler package will be itself.
# For example, we need a win-64 vs2008_win-32 package, so that we compile win-32
Expand Down
2 changes: 1 addition & 1 deletion packaging/vs2019/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ c_compiler:
cxx_compiler:
- vs2019 # [win]
python:
- 3.7
- 3.8
# This differs from target_platform in that it determines what subdir the compiler
# will target, not what subdir the compiler package will be itself.
# For example, we need a win-64 vs2008_win-32 package, so that we compile win-32
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ first_party_detection = false
[tool.black]

line-length = 120
target-version = ["py37"]
target-version = ["py38"]

[tool.ufmt]

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def write_version_file():
pytorch_dep += "==" + os.getenv("PYTORCH_VERSION")

requirements = [
"typing_extensions",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only ever used this for Literal, which is available through typing in the standard library for Python >= 3.8.

"numpy",
"requests",
pytorch_dep,
Expand Down Expand Up @@ -546,7 +545,7 @@ def run(self):
"scipy": ["scipy"],
},
ext_modules=get_extensions(),
python_requires=">=3.7.2",
python_requires=">=3.8",
cmdclass={
"build_ext": BuildExtension.with_options(no_python_abi_suffix=True),
"clean": clean,
Expand Down
3 changes: 1 addition & 2 deletions torchvision/prototype/datasets/utils/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import hashlib
import itertools
import pathlib
from typing import Any, Callable, IO, NoReturn, Optional, Sequence, Set, Tuple, Union
from typing import Any, Callable, IO, Literal, NoReturn, Optional, Sequence, Set, Tuple, Union
from urllib.parse import urlparse

from torchdata.datapipes.iter import (
Expand All @@ -23,7 +23,6 @@
download_url,
extract_archive,
)
from typing_extensions import Literal


class OnlineResource(abc.ABC):
Expand Down
4 changes: 1 addition & 3 deletions torchvision/prototype/transforms/_geometry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import math
import numbers
import warnings
from typing import Any, cast, Dict, List, Optional, Sequence, Tuple, Type, Union
from typing import Any, cast, Dict, List, Literal, Optional, Sequence, Tuple, Type, Union

import PIL.Image
import torch
Expand All @@ -11,8 +11,6 @@
from torchvision.prototype.transforms import functional as F, InterpolationMode, Transform
from torchvision.transforms.functional import _get_perspective_coeffs

from typing_extensions import Literal

from ._transform import _RandomApplyTransform
from ._utils import (
_check_padding_arg,
Expand Down
4 changes: 1 addition & 3 deletions torchvision/prototype/transforms/_utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import functools
import numbers
from collections import defaultdict
from typing import Any, Dict, Sequence, Type, TypeVar, Union
from typing import Any, Dict, Literal, Sequence, Type, TypeVar, Union

from torchvision.prototype import datapoints
from torchvision.prototype.datapoints._datapoint import FillType, FillTypeJIT

from torchvision.transforms.transforms import _check_sequence_input, _setup_angle, _setup_size # noqa: F401

from typing_extensions import Literal


def _setup_float_or_seq(arg: Union[float, Sequence[float]], name: str, req_size: int = 2) -> Sequence[float]:
if not isinstance(arg, (float, Sequence)):
Expand Down
3 changes: 1 addition & 2 deletions torchvision/transforms/functional_pil.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import numbers
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
from typing import Any, Dict, List, Literal, Optional, Sequence, Tuple, Union

import numpy as np
import torch
from PIL import Image, ImageEnhance, ImageOps
from typing_extensions import Literal

try:
import accimage
Expand Down