Skip to content

Commit

Permalink
Merge branch 'main' into version_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 10, 2023
2 parents 1e250e1 + 0b9997f commit 54fddf0
Show file tree
Hide file tree
Showing 67 changed files with 408 additions and 1,297 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ environment:
- PYTHON: C:/Python311
ARCHITECTURE: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
- PYTHON: C:/Python37-x64
- PYTHON: C:/Python38-x64
ARCHITECTURE: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

Expand All @@ -31,7 +31,7 @@ install:
- path c:\nasm-2.15.05;C:\Program Files\gs\gs10.00.0\bin;%PATH%
- cd c:\pillow\winbuild\
- ps: |
c:\python37\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\
c:\python38\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\
c:\pillow\winbuild\build\build_dep_all.cmd
$host.SetShouldExit(0)
- path C:\pillow\winbuild\build\bin;%PATH%
Expand Down
2 changes: 1 addition & 1 deletion .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if [[ $(uname) != CYGWIN* ]]; then
# PyQt6 doesn't support PyPy3
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
sudo apt-get -qq install libegl1 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0
python3 -m pip install pyqt6
python3 -m pip install pyqt6 PyQt6-Qt6!=6.5.0
fi

# webp
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ jobs:
python3${{ matrix.python-minor-version }}-numpy
python3${{ matrix.python-minor-version }}-sip
python3${{ matrix.python-minor-version }}-tkinter
qt5-devel-tools
wget
xorg-server-extra
zlib-devel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev"]
architecture: ["x86", "x64"]
include:
# PyPy 7.3.4+ only ships 64-bit binaries for Windows
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ jobs:
"3.10",
"3.9",
"3.8",
"3.7",
]
include:
- python-version: "3.7"
- python-version: "3.9"
PYTHONOPTIMIZE: 1
REVERSE: "--reverse"
- python-version: "3.8"
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
args: [--target-version=py37]
args: [--target-version=py38]
# Only .py files, until https://github.com/psf/black/issues/402 resolved
files: \.py$
types: []
Expand All @@ -14,7 +14,7 @@ repos:
- id: isort

- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
rev: 1.7.5
hooks:
- id: bandit
args: [--severity-level=high]
Expand All @@ -26,10 +26,10 @@ repos:
- id: yesqa

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
rev: v1.5.1
hooks:
- id: remove-tabs
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.gd$|\.opt$)

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
Expand Down Expand Up @@ -57,7 +57,7 @@ repos:
- id: sphinx-lint

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 0.6.1
rev: 1.0.0
hooks:
- id: tox-ini-fmt

Expand Down
5 changes: 5 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

python:
install:
- method: pip
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Changelog (Pillow)
==================

10.0.0 (unreleased)
-------------------

- Remove deprecations for Pillow 10.0.0 #7059
[hugovk, radarhere]

- Drop support for soon-EOL Python 3.7 #7058
[hugovk, radarhere]

9.5.0 (2023-04-01)
------------------

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ debug:

.PHONY: release-test
release-test:
python3 Tests/check_release_notes.py
python3 -m pip install -e .[tests]
python3 selftest.py
python3 -m pytest Tests
Expand Down Expand Up @@ -123,5 +124,5 @@ lint:
lint-fix:
python3 -c "import black" > /dev/null 2>&1 || python3 -m pip install black
python3 -c "import isort" > /dev/null 2>&1 || python3 -m pip install isort
python3 -m black --target-version py37 .
python3 -m black --target-version py38 .
python3 -m isort .
6 changes: 6 additions & 0 deletions Tests/check_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys
from pathlib import Path

for rst in Path("docs/releasenotes").glob("[1-9]*.rst"):
if "TODO" in open(rst).read():
sys.exit(f"Error: remove TODO from {rst}")
19 changes: 7 additions & 12 deletions Tests/test_deprecate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
@pytest.mark.parametrize(
"version, expected",
[
(
10,
"Old thing is deprecated and will be removed in Pillow 10 "
r"\(2023-07-01\)\. Use new thing instead\.",
),
(
11,
"Old thing is deprecated and will be removed in Pillow 11 "
Expand Down Expand Up @@ -57,18 +52,18 @@ def test_old_version(deprecated, plural, expected):

def test_plural():
expected = (
r"Old things are deprecated and will be removed in Pillow 10 \(2023-07-01\)\. "
r"Old things are deprecated and will be removed in Pillow 11 \(2024-10-15\)\. "
r"Use new thing instead\."
)
with pytest.warns(DeprecationWarning, match=expected):
_deprecate.deprecate("Old things", 10, "new thing", plural=True)
_deprecate.deprecate("Old things", 11, "new thing", plural=True)


def test_replacement_and_action():
expected = "Use only one of 'replacement' and 'action'"
with pytest.raises(ValueError, match=expected):
_deprecate.deprecate(
"Old thing", 10, replacement="new thing", action="Upgrade to new thing"
"Old thing", 11, replacement="new thing", action="Upgrade to new thing"
)


Expand All @@ -81,16 +76,16 @@ def test_replacement_and_action():
)
def test_action(action):
expected = (
r"Old thing is deprecated and will be removed in Pillow 10 \(2023-07-01\)\. "
r"Old thing is deprecated and will be removed in Pillow 11 \(2024-10-15\)\. "
r"Upgrade to new thing\."
)
with pytest.warns(DeprecationWarning, match=expected):
_deprecate.deprecate("Old thing", 10, action=action)
_deprecate.deprecate("Old thing", 11, action=action)


def test_no_replacement_or_action():
expected = (
r"Old thing is deprecated and will be removed in Pillow 10 \(2023-07-01\)"
r"Old thing is deprecated and will be removed in Pillow 11 \(2024-10-15\)"
)
with pytest.warns(DeprecationWarning, match=expected):
_deprecate.deprecate("Old thing", 10)
_deprecate.deprecate("Old thing", 11)
18 changes: 0 additions & 18 deletions Tests/test_deprecated_imageqt.py

This file was deleted.

10 changes: 0 additions & 10 deletions Tests/test_file_apng.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,3 @@ def test_different_modes_in_later_frames(mode, tmp_path):
im.save(test_file, save_all=True, append_images=[Image.new(mode, (1, 1))])
with Image.open(test_file) as reloaded:
assert reloaded.mode == mode


def test_constants_deprecation():
for enum, prefix in {
PngImagePlugin.Disposal: "APNG_DISPOSE_",
PngImagePlugin.Blend: "APNG_BLEND_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(PngImagePlugin, prefix + name) == enum[name]
13 changes: 1 addition & 12 deletions Tests/test_file_blp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from PIL import BlpImagePlugin, Image
from PIL import Image

from .helper import (
assert_image_equal,
Expand Down Expand Up @@ -72,14 +72,3 @@ def test_crashes(test_file):
with Image.open(f) as im:
with pytest.raises(OSError):
im.load()


def test_constants_deprecation():
for enum, prefix in {
BlpImagePlugin.Format: "BLP_FORMAT_",
BlpImagePlugin.Encoding: "BLP_ENCODING_",
BlpImagePlugin.AlphaEncoding: "BLP_ALPHA_ENCODING_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(BlpImagePlugin, prefix + name) == enum[name]
38 changes: 1 addition & 37 deletions Tests/test_file_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from PIL import FitsImagePlugin, FitsStubImagePlugin, Image
from PIL import FitsImagePlugin, Image

from .helper import assert_image_equal, hopper

Expand Down Expand Up @@ -48,39 +48,3 @@ def test_comment():
image_data = b"SIMPLE = T / comment string"
with pytest.raises(OSError):
FitsImagePlugin.FitsImageFile(BytesIO(image_data))


def test_stub_deprecated():
class Handler:
opened = False
loaded = False

def open(self, im):
self.opened = True

def load(self, im):
self.loaded = True
im.fp.close()
return Image.new("RGB", (1, 1))

handler = Handler()
with pytest.warns(DeprecationWarning):
FitsStubImagePlugin.register_handler(handler)

with Image.open(TEST_FILE) as im:
assert im.format == "FITS"
assert im.size == (128, 128)
assert im.mode == "L"

assert handler.opened
assert not handler.loaded

im.load()
assert handler.loaded

FitsStubImagePlugin._handler = None
Image.register_open(
FitsImagePlugin.FitsImageFile.format,
FitsImagePlugin.FitsImageFile,
FitsImagePlugin._accept,
)
9 changes: 0 additions & 9 deletions Tests/test_file_ftex.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,3 @@ def test_invalid_file():

with pytest.raises(SyntaxError):
FtexImagePlugin.FtexImageFile(invalid_file)


def test_constants_deprecation():
for enum, prefix in {
FtexImagePlugin.Format: "FORMAT_",
}.items():
for name in enum.__members__:
with pytest.warns(DeprecationWarning):
assert getattr(FtexImagePlugin, prefix + name) == enum[name]
6 changes: 0 additions & 6 deletions Tests/test_file_jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,6 @@ def test_save_low_quality_baseline_qtables(self):
assert max(im2.quantization[0]) <= 255
assert max(im2.quantization[1]) <= 255

def test_convert_dict_qtables_deprecation(self):
with pytest.warns(DeprecationWarning):
qtable = {0: [1, 2, 3, 4]}
qtable2 = JpegImagePlugin.convert_dict_qtables(qtable)
assert qtable == qtable2

@pytest.mark.skipif(not djpeg_available(), reason="djpeg not available")
def test_load_djpeg(self):
with Image.open(TEST_FILE) as img:
Expand Down
3 changes: 0 additions & 3 deletions Tests/test_font_pcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ def test_textsize(request, tmp_path):
assert dy == 20
assert dx in (0, 10)
assert font.getlength(chr(i)) == dx
with pytest.warns(DeprecationWarning) as log:
assert font.getsize(chr(i)) == (dx, dy)
assert len(log) == 1
for i in range(len(message)):
msg = message[: i + 1]
assert font.getlength(msg) == len(msg) * 10
Expand Down
18 changes: 0 additions & 18 deletions Tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,25 +929,7 @@ def test_apply_transparency(self):
im.apply_transparency()
assert im.palette.colors[(27, 35, 6, 214)] == 24

def test_categories_deprecation(self):
with pytest.warns(DeprecationWarning):
assert hopper().category == 0

with pytest.warns(DeprecationWarning):
assert Image.NORMAL == 0
with pytest.warns(DeprecationWarning):
assert Image.SEQUENCE == 1
with pytest.warns(DeprecationWarning):
assert Image.CONTAINER == 2

def test_constants(self):
with pytest.warns(DeprecationWarning):
assert Image.LINEAR == Image.Resampling.BILINEAR
with pytest.warns(DeprecationWarning):
assert Image.CUBIC == Image.Resampling.BICUBIC
with pytest.warns(DeprecationWarning):
assert Image.ANTIALIAS == Image.Resampling.LANCZOS

for enum in (
Image.Transpose,
Image.Transform,
Expand Down
7 changes: 0 additions & 7 deletions Tests/test_image_point.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import pytest

from PIL import Image

from .helper import assert_image_equal, hopper


Expand Down Expand Up @@ -62,8 +60,3 @@ def test_f_mode():
im = hopper("F")
with pytest.raises(ValueError):
im.point(None)


def test_coerce_e_deprecation():
with pytest.warns(DeprecationWarning):
assert Image.coerce_e(2).data == 2
Loading

0 comments on commit 54fddf0

Please sign in to comment.