Skip to content

Commit 2ef7a51

Browse files
authored
Merge branch 'main' into main
2 parents 7188a65 + 51c577d commit 2ef7a51

File tree

197 files changed

+3301
-2177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+3301
-2177
lines changed

.appveyor.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ install:
3434
- xcopy /S /Y c:\test-images-main\* c:\pillow\tests\images
3535
- curl -fsSL -o nasm-win64.zip https://raw.githubusercontent.com/python-pillow/pillow-depends/main/nasm-2.16.03-win64.zip
3636
- 7z x nasm-win64.zip -oc:\
37-
- choco install ghostscript --version=10.3.1
38-
- path c:\nasm-2.16.03;C:\Program Files\gs\gs10.03.1\bin;%PATH%
37+
- choco install ghostscript --version=10.4.0
38+
- path c:\nasm-2.16.03;C:\Program Files\gs\gs10.04.0\bin;%PATH%
3939
- cd c:\pillow\winbuild\
4040
- ps: |
4141
c:\python39\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\
@@ -51,11 +51,10 @@ build_script:
5151

5252
test_script:
5353
- cd c:\pillow
54-
- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov pytest-timeout defusedxml numpy olefile pyroma'
54+
- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov pytest-timeout defusedxml ipython numpy olefile pyroma'
5555
- c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\%EXECUTABLE%
56-
- '%PYTHON%\%EXECUTABLE% -c "from PIL import Image"'
57-
- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests'
58-
#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest?
56+
- path %PYTHON%;%PATH%
57+
- .ci\test.cmd
5958

6059
after_test:
6160
- curl -Os https://uploader.codecov.io/latest/windows/codecov.exe

.ci/install.sh

+4-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set -e
2121

2222
if [[ $(uname) != CYGWIN* ]]; then
2323
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
24-
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
24+
ghostscript libjpeg-turbo-progs libopenjp2-7-dev\
2525
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
2626
sway wl-clipboard libopenblas-dev
2727
fi
@@ -30,19 +30,15 @@ python3 -m pip install --upgrade pip
3030
python3 -m pip install --upgrade wheel
3131
python3 -m pip install coverage
3232
python3 -m pip install defusedxml
33+
python3 -m pip install ipython
3334
python3 -m pip install olefile
3435
python3 -m pip install -U pytest
3536
python3 -m pip install -U pytest-cov
3637
python3 -m pip install -U pytest-timeout
3738
python3 -m pip install pyroma
3839

3940
if [[ $(uname) != CYGWIN* ]]; then
40-
# TODO Update condition when NumPy supports free-threading
41-
if [[ "$PYTHON_GIL" == "0" ]]; then
42-
python3 -m pip install numpy --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
43-
else
44-
python3 -m pip install numpy
45-
fi
41+
python3 -m pip install numpy
4642

4743
# PyQt6 doesn't support PyPy3
4844
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
@@ -52,10 +48,7 @@ if [[ $(uname) != CYGWIN* ]]; then
5248
fi
5349

5450
# Pyroma uses non-isolated build and fails with old setuptools
55-
if [[
56-
$GHA_PYTHON_VERSION == pypy3.9
57-
|| $GHA_PYTHON_VERSION == 3.9
58-
]]; then
51+
if [[ $GHA_PYTHON_VERSION == 3.9 ]]; then
5952
# To match pyproject.toml
6053
python3 -m pip install "setuptools>=67.8"
6154
fi

.ci/requirements-cibw.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cibuildwheel==2.19.2
1+
cibuildwheel==2.21.2

.ci/requirements-mypy.txt

+12-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
mypy==1.10.1
1+
mypy==1.11.2
2+
IceSpringPySideStubs-PyQt6
3+
IceSpringPySideStubs-PySide6
4+
ipython
5+
numpy
6+
packaging
7+
pytest
8+
sphinx
9+
types-atheris
10+
types-defusedxml
11+
types-olefile
12+
types-setuptools

.ci/test.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
python.exe -c "from PIL import Image"
2+
IF ERRORLEVEL 1 EXIT /B
3+
python.exe -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests

.ci/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ set -e
44

55
python3 -c "from PIL import Image"
66

7-
python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests $REVERSE
7+
python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests $REVERSE

.github/workflows/cifuzz.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ on:
66
- "**"
77
paths:
88
- ".github/workflows/cifuzz.yml"
9+
- ".github/workflows/wheels-dependencies.sh"
910
- "**.c"
1011
- "**.h"
1112
pull_request:
1213
paths:
1314
- ".github/workflows/cifuzz.yml"
15+
- ".github/workflows/wheels-dependencies.sh"
1416
- "**.c"
1517
- "**.h"
1618
workflow_dispatch:
@@ -24,8 +26,6 @@ concurrency:
2426

2527
jobs:
2628
Fuzzing:
27-
# Disabled until google/oss-fuzz#11419 upgrades Python to 3.9+
28-
if: false
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Build Fuzzers

.github/workflows/macos-install.sh

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -e
44

5+
if [[ "$ImageOS" == "macos13" ]]; then
6+
brew uninstall gradle maven
7+
fi
58
brew install \
69
freetype \
710
ghostscript \
@@ -20,6 +23,7 @@ export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
2023

2124
python3 -m pip install coverage
2225
python3 -m pip install defusedxml
26+
python3 -m pip install ipython
2327
python3 -m pip install olefile
2428
python3 -m pip install -U pytest
2529
python3 -m pip install -U pytest-cov

.github/workflows/test-cygwin.yml

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
perl
7575
python3${{ matrix.python-minor-version }}-cython
7676
python3${{ matrix.python-minor-version }}-devel
77+
python3${{ matrix.python-minor-version }}-ipython
7778
python3${{ matrix.python-minor-version }}-numpy
7879
python3${{ matrix.python-minor-version }}-sip
7980
python3${{ matrix.python-minor-version }}-tkinter

.github/workflows/test-mingw.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ jobs:
8080
- name: Test Pillow
8181
run: |
8282
python3 selftest.py --installed
83-
python3 -c "from PIL import Image"
84-
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
83+
.ci/test.sh
8584
8685
- name: Upload coverage
8786
uses: codecov/codecov-action@v4

.github/workflows/test-windows.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
python-version: ["pypy3.10", "pypy3.9", "3.9", "3.10", "3.11", "3.12", "3.13"]
38+
python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"]
3939

4040
timeout-minutes: 30
4141

@@ -86,8 +86,8 @@ jobs:
8686
choco install nasm --no-progress
8787
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
8888
89-
choco install ghostscript --version=10.3.1 --no-progress
90-
echo "C:\Program Files\gs\gs10.00.0\bin" >> $env:GITHUB_PATH
89+
choco install ghostscript --version=10.4.0 --no-progress
90+
echo "C:\Program Files\gs\gs10.04.0\bin" >> $env:GITHUB_PATH
9191
9292
# Install extra test images
9393
xcopy /S /Y Tests\test-images\* Tests\images
@@ -190,8 +190,8 @@ jobs:
190190
191191
- name: Test Pillow
192192
run: |
193-
path %GITHUB_WORKSPACE%\\winbuild\\build\\bin;%PATH%
194-
python.exe -m pytest -vx -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests
193+
path %GITHUB_WORKSPACE%\winbuild\build\bin;%PATH%
194+
.ci\test.cmd
195195
shell: cmd
196196

197197
- name: Prepare to upload errors

.github/workflows/test.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ jobs:
3737
fail-fast: false
3838
matrix:
3939
os: [
40-
"macos-14",
40+
"macos-latest",
4141
"ubuntu-latest",
4242
]
4343
python-version: [
4444
"pypy3.10",
45-
"pypy3.9",
4645
"3.13",
4746
"3.12",
4847
"3.11",
@@ -57,7 +56,7 @@ jobs:
5756
# M1 only available for 3.10+
5857
- { os: "macos-13", python-version: "3.9" }
5958
exclude:
60-
- { os: "macos-14", python-version: "3.9" }
59+
- { os: "macos-latest", python-version: "3.9" }
6160

6261
runs-on: ${{ matrix.os }}
6362
name: ${{ matrix.os }} Python ${{ matrix.python-version }} ${{ matrix.disable-gil && 'free-threaded' || '' }}
@@ -77,7 +76,7 @@ jobs:
7776
"pyproject.toml"
7877
7978
- name: Set up Python ${{ matrix.python-version }} (free-threaded)
80-
uses: deadsnakes/action@v3.1.0
79+
uses: deadsnakes/action@v3.2.0
8180
if: "${{ matrix.disable-gil }}"
8281
with:
8382
python-version: ${{ matrix.python-version }}

.github/workflows/wheels-dependencies.sh

+20-15
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ ARCHIVE_SDIR=pillow-depends-main
1616

1717
# Package versions for fresh source builds
1818
FREETYPE_VERSION=2.13.2
19-
HARFBUZZ_VERSION=8.5.0
20-
LIBPNG_VERSION=1.6.43
21-
JPEGTURBO_VERSION=3.0.3
19+
HARFBUZZ_VERSION=10.0.1
20+
LIBPNG_VERSION=1.6.44
21+
JPEGTURBO_VERSION=3.0.4
2222
OPENJPEG_VERSION=2.5.2
23-
XZ_VERSION=5.4.5
23+
XZ_VERSION=5.6.3
2424
TIFF_VERSION=4.6.0
2525
LCMS2_VERSION=2.16
2626
if [[ -n "$IS_MACOS" ]]; then
@@ -40,7 +40,7 @@ BROTLI_VERSION=1.1.0
4040

4141
if [[ -n "$IS_MACOS" ]] && [[ "$CIBW_ARCHS" == "x86_64" ]]; then
4242
function build_openjpeg {
43-
local out_dir=$(fetch_unpack https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz openjpeg-${OPENJPEG_VERSION}.tar.gz)
43+
local out_dir=$(fetch_unpack https://github.com/uclouvain/openjpeg/archive/v$OPENJPEG_VERSION.tar.gz openjpeg-$OPENJPEG_VERSION.tar.gz)
4444
(cd $out_dir \
4545
&& cmake -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX -DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib . \
4646
&& make install)
@@ -50,7 +50,7 @@ fi
5050

5151
function build_brotli {
5252
local cmake=$(get_modern_cmake)
53-
local out_dir=$(fetch_unpack https://github.com/google/brotli/archive/v$BROTLI_VERSION.tar.gz brotli-1.1.0.tar.gz)
53+
local out_dir=$(fetch_unpack https://github.com/google/brotli/archive/v$BROTLI_VERSION.tar.gz brotli-$BROTLI_VERSION.tar.gz)
5454
(cd $out_dir \
5555
&& $cmake -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX -DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib . \
5656
&& make install)
@@ -60,6 +60,19 @@ function build_brotli {
6060
fi
6161
}
6262

63+
function build_harfbuzz {
64+
python3 -m pip install meson ninja
65+
66+
local out_dir=$(fetch_unpack https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION/$HARFBUZZ_VERSION.tar.xz harfbuzz-$HARFBUZZ_VERSION.tar.xz)
67+
(cd $out_dir \
68+
&& meson setup build --buildtype=release -Dfreetype=enabled -Dglib=disabled)
69+
(cd $out_dir/build \
70+
&& meson install)
71+
if [[ "$MB_ML_LIBC" == "manylinux" ]]; then
72+
cp /usr/local/lib64/libharfbuzz* /usr/local/lib
73+
fi
74+
}
75+
6376
function build {
6477
if [[ -n "$IS_MACOS" ]] && [[ "$CIBW_ARCHS" == "arm64" ]]; then
6578
sudo chown -R runner /usr/local
@@ -109,15 +122,7 @@ function build {
109122
build_freetype
110123
fi
111124

112-
if [ -z "$IS_MACOS" ]; then
113-
export FREETYPE_LIBS=-lfreetype
114-
export FREETYPE_CFLAGS=-I/usr/local/include/freetype2/
115-
fi
116-
build_simple harfbuzz $HARFBUZZ_VERSION https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION tar.xz --with-freetype=yes --with-glib=no
117-
if [ -z "$IS_MACOS" ]; then
118-
export FREETYPE_LIBS=""
119-
export FREETYPE_CFLAGS=""
120-
fi
125+
build_harfbuzz
121126
}
122127

123128
# Any stuff that you need to do before you start building the wheels

.github/workflows/wheels-test.sh

+1-8
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ else
1313
yum install -y fribidi
1414
fi
1515

16-
if [ "${AUDITWHEEL_POLICY::9}" != "musllinux" ]; then
17-
# TODO Update condition when NumPy supports free-threading
18-
if [ $(python3 -c "import sysconfig;print(sysconfig.get_config_var('Py_GIL_DISABLED'))") == "1" ]; then
19-
python3 -m pip install numpy --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
20-
else
21-
python3 -m pip install numpy
22-
fi
23-
fi
16+
python3 -m pip install numpy
2417

2518
if [ ! -d "test-images-main" ]; then
2619
curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip

.github/workflows/wheels.yml

+19-8
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ jobs:
4848
fail-fast: false
4949
matrix:
5050
python-version:
51-
- pp39
5251
- pp310
5352
- cp3{9,10,11}
5453
- cp3{12,13}
@@ -57,7 +56,6 @@ jobs:
5756
- manylinux_2_28
5857
- musllinux
5958
exclude:
60-
- { python-version: pp39, spec: musllinux }
6159
- { python-version: pp310, spec: musllinux }
6260

6361
steps:
@@ -97,18 +95,30 @@ jobs:
9795
path: ./wheelhouse/*.whl
9896

9997
build-2-native-wheels:
98+
if: github.event_name != 'schedule' || github.repository_owner == 'python-pillow'
10099
name: ${{ matrix.name }}
101100
runs-on: ${{ matrix.os }}
102101
strategy:
103102
fail-fast: false
104103
matrix:
105104
include:
106-
- name: "macOS x86_64"
105+
- name: "macOS 10.10 x86_64"
107106
os: macos-13
108107
cibw_arch: x86_64
108+
build: "cp3{9,10,11}*"
109109
macosx_deployment_target: "10.10"
110+
- name: "macOS 10.13 x86_64"
111+
os: macos-13
112+
cibw_arch: x86_64
113+
build: "cp3{12,13}*"
114+
macosx_deployment_target: "10.13"
115+
- name: "macOS 10.15 x86_64"
116+
os: macos-13
117+
cibw_arch: x86_64
118+
build: "pp310*"
119+
macosx_deployment_target: "10.15"
110120
- name: "macOS arm64"
111-
os: macos-14
121+
os: macos-latest
112122
cibw_arch: arm64
113123
macosx_deployment_target: "11.0"
114124
- name: "manylinux2014 and musllinux x86_64"
@@ -146,10 +156,11 @@ jobs:
146156

147157
- uses: actions/upload-artifact@v4
148158
with:
149-
name: dist-${{ matrix.os }}-${{ matrix.cibw_arch }}${{ matrix.manylinux && format('-{0}', matrix.manylinux) }}
159+
name: dist-${{ matrix.os }}${{ matrix.macosx_deployment_target && format('-{0}', matrix.macosx_deployment_target) }}-${{ matrix.cibw_arch }}${{ matrix.manylinux && format('-{0}', matrix.manylinux) }}
150160
path: ./wheelhouse/*.whl
151161

152162
windows:
163+
if: github.event_name != 'schedule' || github.repository_owner == 'python-pillow'
153164
name: Windows ${{ matrix.cibw_arch }}
154165
runs-on: windows-latest
155166
strategy:
@@ -256,7 +267,7 @@ jobs:
256267
path: dist/*.tar.gz
257268

258269
scientific-python-nightly-wheels-publish:
259-
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
270+
if: github.repository_owner == 'python-pillow' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
260271
needs: [build-2-native-wheels, windows]
261272
runs-on: ubuntu-latest
262273
name: Upload wheels to scientific-python-nightly-wheels
@@ -267,13 +278,13 @@ jobs:
267278
path: dist
268279
merge-multiple: true
269280
- name: Upload wheels to scientific-python-nightly-wheels
270-
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # 0.5.0
281+
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1
271282
with:
272283
artifacts_path: dist
273284
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}
274285

275286
pypi-publish:
276-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
287+
if: github.repository_owner == 'python-pillow' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
277288
needs: [build-1-QEMU-emulated-wheels, build-2-native-wheels, windows, sdist]
278289
runs-on: ubuntu-latest
279290
name: Upload release to PyPI

0 commit comments

Comments
 (0)