From 716a0baf74ec9fa07255ae59d00a339c763616c4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 15 Oct 2021 13:07:53 +0300 Subject: [PATCH] Drop support for EOL Python 3.6 --- .appveyor.yml | 2 +- .github/workflows/test-docker.yml | 4 -- .pre-commit-config.yaml | 2 +- Makefile | 2 +- Tests/test_image.py | 4 -- docs/installation.rst | 64 ++++++++++++++----------------- docs/releasenotes/9.0.0.rst | 5 +++ setup.py | 3 +- src/PIL/Image.py | 30 ++++++--------- src/libImaging/ImPlatform.h | 6 --- tox.ini | 2 +- winbuild/build_prepare.py | 1 - 12 files changed, 50 insertions(+), 75 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6cf40130e..fb19fb7cb 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -13,7 +13,7 @@ environment: - PYTHON: C:/Python39 ARCHITECTURE: x86 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - PYTHON: C:/Python36-x64 + - PYTHON: C:/Python37-x64 ARCHITECTURE: x64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml index 46e9e5f2c..490af5e4b 100644 --- a/.github/workflows/test-docker.yml +++ b/.github/workflows/test-docker.yml @@ -18,12 +18,8 @@ jobs: alpine, amazon-2-amd64, arch, - centos-7-amd64, - centos-8-amd64, - centos-stream-8-amd64, debian-10-buster-x86, fedora-34-amd64, - ubuntu-18.04-bionic-amd64, ubuntu-20.04-focal-amd64, ] dockerTag: [main] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4a0256085..5f1d16709 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: rev: 911470a610e47d9da5ea938b0887c3df62819b85 # frozen: 21.9b0 hooks: - id: black - args: ["--target-version", "py36"] + args: ["--target-version", "py37"] # Only .py files, until https://github.com/psf/black/issues/402 resolved files: \.py$ types: [] diff --git a/Makefile b/Makefile index af3059f34..2d5c3e12e 100644 --- a/Makefile +++ b/Makefile @@ -121,5 +121,5 @@ lint: .PHONY: lint-fix lint-fix: - black --target-version py36 . + black --target-version py37 . isort . diff --git a/Tests/test_image.py b/Tests/test_image.py index c185a1cb4..cf60f42af 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -1,7 +1,6 @@ import io import os import shutil -import sys import tempfile import pytest @@ -782,9 +781,6 @@ class TestImage: 34665: 196, } - @pytest.mark.skipif( - sys.version_info < (3, 7), reason="Python 3.7 or greater required" - ) def test_categories_deprecation(self): with pytest.warns(DeprecationWarning): assert hopper().category == 0 diff --git a/docs/installation.rst b/docs/installation.rst index fc5b0e7e9..c19bb2dd1 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -18,7 +18,9 @@ Pillow supports these Python versions. +----------------------+-----+-----+-----+-----+-----+-----+-----+-----+ | Python |3.10 | 3.9 | 3.8 | 3.7 | 3.6 | 3.5 | 3.4 | 2.7 | +======================+=====+=====+=====+=====+=====+=====+=====+=====+ -| Pillow >= 8.3.2 | Yes | Yes | Yes | Yes | Yes | | | | +| Pillow >= 9.0 | Yes | Yes | Yes | Yes | | | | | ++----------------------+-----+-----+-----+-----+-----+-----+-----+-----+ +| Pillow 8.3.2 - 8.4 | Yes | Yes | Yes | Yes | Yes | | | | +----------------------+-----+-----+-----+-----+-----+-----+-----+-----+ | Pillow 8.0 - 8.3.1 | | Yes | Yes | Yes | Yes | | | | +----------------------+-----+-----+-----+-----+-----+-----+-----+-----+ @@ -443,40 +445,32 @@ Continuous Integration Targets These platforms are built and tested for every change. -+----------------------------------+---------------------------------+---------------------+ -| Operating system | Tested Python versions | Tested architecture | -+==================================+=================================+=====================+ -| Alpine | 3.9 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| Amazon Linux 2 | 3.7 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| Arch | 3.9 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| CentOS 7 | 3.6 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| CentOS 8 | 3.6 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| CentOS Stream 8 | 3.6 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| Debian 10 Buster | 3.7 | x86 | -+----------------------------------+---------------------------------+---------------------+ -| Fedora 34 | 3.9 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| macOS 10.15 Catalina | 3.6, 3.7, 3.8, 3.9, 3.10, PyPy3 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| Ubuntu Linux 18.04 LTS (Bionic) | 3.6 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| Ubuntu Linux 20.04 LTS (Focal) | 3.6, 3.7, 3.8, 3.9, 3.10, PyPy3 | x86-64 | -| +---------------------------------+---------------------+ -| | 3.8 | arm64v8, ppc64le, | -| | | s390x | -+----------------------------------+---------------------------------+---------------------+ -| Windows Server 2016 | 3.6 | x86-64 | -+----------------------------------+---------------------------------+---------------------+ -| Windows Server 2019 | 3.6, 3.7, 3.8, 3.9, 3.10, PyPy3 | x86, x86-64 | -| +---------------------------------+---------------------+ -| | 3.9/MinGW | x86, x86-64 | -+----------------------------------+---------------------------------+---------------------+ ++----------------------------------+----------------------------+---------------------+ +| Operating system | Tested Python versions | Tested architecture | ++==================================+============================+=====================+ +| Alpine | 3.9 | x86-64 | ++----------------------------------+----------------------------+---------------------+ +| Amazon Linux 2 | 3.7 | x86-64 | ++----------------------------------+----------------------------+---------------------+ +| Arch | 3.9 | x86-64 | ++----------------------------------+----------------------------+---------------------+ +| Debian 10 Buster | 3.7 | x86 | ++----------------------------------+----------------------------+---------------------+ +| Fedora 34 | 3.9 | x86-64 | ++----------------------------------+----------------------------+---------------------+ +| macOS 10.15 Catalina | 3.7, 3.8, 3.9, 3.10, PyPy3 | x86-64 | ++----------------------------------+----------------------------+---------------------+ +| Ubuntu Linux 20.04 LTS (Focal) | 3.7, 3.8, 3.9, 3.10, PyPy3 | x86-64 | +| +----------------------------+---------------------+ +| | 3.8 | arm64v8, ppc64le, | +| | | s390x | ++----------------------------------+----------------------------+---------------------+ +| Windows Server 2016 | 3.7 | x86-64 | ++----------------------------------+----------------------------+---------------------+ +| Windows Server 2019 | 3.7, 3.8, 3.9, 3.10, PyPy3 | x86, x86-64 | +| +----------------------------+---------------------+ +| | 3.9/MinGW | x86, x86-64 | ++----------------------------------+----------------------------+---------------------+ Other Platforms diff --git a/docs/releasenotes/9.0.0.rst b/docs/releasenotes/9.0.0.rst index 6965b65bf..2652d7fbc 100644 --- a/docs/releasenotes/9.0.0.rst +++ b/docs/releasenotes/9.0.0.rst @@ -4,6 +4,11 @@ Backwards Incompatible Changes ============================== +Python 3.6 +^^^^^^^^^^ + +Pillow has dropped support for Python 3.6, which reached end-of-life on 2021-12-23. + PILLOW_VERSION constant ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/setup.py b/setup.py index 3574c9137..7e8e7c4f0 100755 --- a/setup.py +++ b/setup.py @@ -1000,7 +1000,6 @@ try: "Development Status :: 6 - Mature", "License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)", # noqa: E501 "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", @@ -1014,7 +1013,7 @@ try: "Topic :: Multimedia :: Graphics :: Graphics Conversion", "Topic :: Multimedia :: Graphics :: Viewers", ], - python_requires=">=3.6", + python_requires=">=3.7", cmdclass={"build_ext": pil_build_ext}, ext_modules=ext_modules, include_package_data=True, diff --git a/src/PIL/Image.py b/src/PIL/Image.py index da0bda7ec..0697fc01d 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -51,26 +51,18 @@ from . import ImageMode, TiffTags, UnidentifiedImageError, __version__, _plugins from ._binary import i32le from ._util import deferred_error, isPath -if sys.version_info >= (3, 7): - def __getattr__(name): - categories = {"NORMAL": 0, "SEQUENCE": 1, "CONTAINER": 2} - if name in categories: - warnings.warn( - "Image categories are deprecated and will be removed in Pillow 10 " - "(2023-01-02). Use is_animated instead.", - DeprecationWarning, - stacklevel=2, - ) - return categories[name] - raise AttributeError(f"module '{__name__}' has no attribute '{name}'") - - -else: - # categories - NORMAL = 0 - SEQUENCE = 1 - CONTAINER = 2 +def __getattr__(name): + categories = {"NORMAL": 0, "SEQUENCE": 1, "CONTAINER": 2} + if name in categories: + warnings.warn( + "Image categories are deprecated and will be removed in Pillow 10 " + "(2023-01-02). Use is_animated instead.", + DeprecationWarning, + stacklevel=2, + ) + return categories[name] + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") logger = logging.getLogger(__name__) diff --git a/src/libImaging/ImPlatform.h b/src/libImaging/ImPlatform.h index 9a2060edf..26b49d6d0 100644 --- a/src/libImaging/ImPlatform.h +++ b/src/libImaging/ImPlatform.h @@ -9,12 +9,6 @@ #include "Python.h" -/* Workaround issue #2479 */ -#if PY_VERSION_HEX < 0x03070000 && defined(PySlice_GetIndicesEx) && \ - !defined(PYPY_VERSION) -#undef PySlice_GetIndicesEx -#endif - /* Check that we have an ANSI compliant compiler */ #ifndef HAVE_PROTOTYPES #error Sorry, this library requires support for ANSI prototypes. diff --git a/tox.ini b/tox.ini index cdc2ab881..96d84f933 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ [tox] envlist = lint - py{36,37,38,39,310,py3} + py{37,38,39,310,py3} minversion = 1.9 [testenv] diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 807cbbf27..b62bf8b4e 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -474,7 +474,6 @@ def build_pillow(): cmd_cd("{pillow_dir}"), *prefs["header"], cmd_set("DISTUTILS_USE_SDK", "1"), # use same compiler to build Pillow - cmd_set("MSSdk", "1"), # for PyPy3.6 cmd_set("py_vcruntime_redist", "true"), # use /MD, not /MT r'"{python_dir}\{python_exe}" setup.py build_ext --vendor-raqm --vendor-fribidi %*', # noqa: E501 ]