Skip to content

Commit 646b4a4

Browse files
authored
Merge branch 'main' into mpo
2 parents 41129ce + 3a66b1d commit 646b4a4

File tree

117 files changed

+13460
-581
lines changed

Some content is hidden

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

117 files changed

+13460
-581
lines changed

.ci/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if [[ $(uname) != CYGWIN* ]]; then
6666
pushd depends && ./install_raqm.sh && popd
6767

6868
# libavif
69-
pushd depends && CMAKE_POLICY_VERSION_MINIMUM=3.5 ./install_libavif.sh && popd
69+
pushd depends && ./install_libavif.sh && popd
7070

7171
# extra test images
7272
pushd depends && ./install_extra_test_images.sh && popd

.ci/requirements-cibw.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cibuildwheel==2.23.3
1+
cibuildwheel==3.0.0

.ci/requirements-mypy.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
mypy==1.15.0
1+
mypy==1.16.1
22
IceSpringPySideStubs-PyQt6
33
IceSpringPySideStubs-PySide6
44
ipython
55
numpy
66
packaging
7+
pyarrow-stubs
78
pytest
89
sphinx
910
types-atheris
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Test Valgrind Memory Leaks
2+
3+
# like the Docker tests, but running valgrind only on *.c/*.h changes.
4+
5+
# this is very expensive. Only run on the pull request.
6+
on:
7+
# push:
8+
# branches:
9+
# - "**"
10+
# paths:
11+
# - ".github/workflows/test-valgrind.yml"
12+
# - "**.c"
13+
# - "**.h"
14+
pull_request:
15+
paths:
16+
- ".github/workflows/test-valgrind.yml"
17+
- "**.c"
18+
- "**.h"
19+
- "depends/docker-test-valgrind-memory.sh"
20+
workflow_dispatch:
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
build:
31+
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
docker: [
37+
ubuntu-22.04-jammy-amd64-valgrind,
38+
]
39+
dockerTag: [main]
40+
41+
name: ${{ matrix.docker }}
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
persist-credentials: false
47+
48+
- name: Build system information
49+
run: python3 .github/workflows/system-info.py
50+
51+
- name: Docker pull
52+
run: |
53+
docker pull pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
54+
55+
- name: Build and Run Valgrind
56+
run: |
57+
# The Pillow user in the docker container is UID 1001
58+
sudo chown -R 1001 $GITHUB_WORKSPACE
59+
docker run --name pillow_container -e "PILLOW_VALGRIND_TEST=true" -v $GITHUB_WORKSPACE:/Pillow pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }} /Pillow/depends/docker-test-valgrind-memory.sh
60+
sudo chown -R runner $GITHUB_WORKSPACE

.github/workflows/test-windows.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ env:
3131

3232
jobs:
3333
build:
34-
runs-on: ${{ matrix.os }}
34+
runs-on: windows-latest
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
python-version: ["pypy3.11", "pypy3.10", "3.10", "3.11", "3.12", "3.13", "3.14"]
38+
python-version: ["pypy3.11", "pypy3.10", "3.10", "3.11", "3.12", ">=3.13.5", "3.14"]
3939
architecture: ["x64"]
40-
os: ["windows-latest"]
4140
include:
4241
# Test the oldest Python on 32-bit
43-
- { python-version: "3.9", architecture: "x86", os: "windows-2019" }
42+
- { python-version: "3.9", architecture: "x86" }
4443

4544
timeout-minutes: 45
4645

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
python-version: [
4444
"pypy3.11",
4545
"pypy3.10",
46+
"3.14t",
4647
"3.14",
4748
"3.13t",
4849
"3.13",
@@ -55,6 +56,7 @@ jobs:
5556
- { python-version: "3.11", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" }
5657
- { python-version: "3.10", PYTHONOPTIMIZE: 2 }
5758
# Free-threaded
59+
- { python-version: "3.14t", disable-gil: true }
5860
- { python-version: "3.13t", disable-gil: true }
5961
# M1 only available for 3.10+
6062
- { os: "macos-13", python-version: "3.9" }

.github/workflows/wheels-dependencies.sh

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ ARCHIVE_SDIR=pillow-depends-main
3939
# Package versions for fresh source builds
4040
FREETYPE_VERSION=2.13.3
4141
HARFBUZZ_VERSION=11.2.1
42-
LIBPNG_VERSION=1.6.48
43-
JPEGTURBO_VERSION=3.1.0
42+
LIBPNG_VERSION=1.6.49
43+
JPEGTURBO_VERSION=3.1.1
4444
OPENJPEG_VERSION=2.5.3
4545
XZ_VERSION=5.8.1
4646
TIFF_VERSION=4.7.0
@@ -51,6 +51,7 @@ LIBWEBP_VERSION=1.5.0
5151
BZIP2_VERSION=1.0.8
5252
LIBXCB_VERSION=1.17.0
5353
BROTLI_VERSION=1.1.0
54+
LIBAVIF_VERSION=1.3.0
5455

5556
function build_pkg_config {
5657
if [ -e pkg-config-stamp ]; then return; fi
@@ -98,6 +99,59 @@ function build_harfbuzz {
9899
touch harfbuzz-stamp
99100
}
100101

102+
function build_libavif {
103+
if [ -e libavif-stamp ]; then return; fi
104+
105+
python3 -m pip install meson ninja
106+
107+
if [[ "$PLAT" == "x86_64" ]] || [ -n "$SANITIZER" ]; then
108+
build_simple nasm 2.16.03 https://www.nasm.us/pub/nasm/releasebuilds/2.16.03
109+
fi
110+
111+
local build_type=MinSizeRel
112+
local lto=ON
113+
114+
local libavif_cmake_flags
115+
116+
if [ -n "$IS_MACOS" ]; then
117+
lto=OFF
118+
libavif_cmake_flags=(
119+
-DCMAKE_C_FLAGS_MINSIZEREL="-Oz -DNDEBUG -flto" \
120+
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Oz -DNDEBUG -flto" \
121+
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,-S,-x,-dead_strip_dylibs" \
122+
)
123+
else
124+
if [[ "$MB_ML_VER" == 2014 ]] && [[ "$PLAT" == "x86_64" ]]; then
125+
build_type=Release
126+
fi
127+
libavif_cmake_flags=(-DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,--strip-all,-z,relro,-z,now")
128+
fi
129+
130+
local out_dir=$(fetch_unpack https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$LIBAVIF_VERSION.tar.gz libavif-$LIBAVIF_VERSION.tar.gz)
131+
# CONFIG_AV1_HIGHBITDEPTH=0 is a flag for libaom (included as a subproject
132+
# of libavif) that disables support for encoding high bit depth images.
133+
(cd $out_dir \
134+
&& cmake \
135+
-DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \
136+
-DCMAKE_INSTALL_LIBDIR=$BUILD_PREFIX/lib \
137+
-DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib \
138+
-DBUILD_SHARED_LIBS=ON \
139+
-DAVIF_LIBSHARPYUV=LOCAL \
140+
-DAVIF_LIBYUV=LOCAL \
141+
-DAVIF_CODEC_AOM=LOCAL \
142+
-DCONFIG_AV1_HIGHBITDEPTH=0 \
143+
-DAVIF_CODEC_AOM_DECODE=OFF \
144+
-DAVIF_CODEC_DAV1D=LOCAL \
145+
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=$lto \
146+
-DCMAKE_C_VISIBILITY_PRESET=hidden \
147+
-DCMAKE_CXX_VISIBILITY_PRESET=hidden \
148+
-DCMAKE_BUILD_TYPE=$build_type \
149+
"${libavif_cmake_flags[@]}" \
150+
. \
151+
&& make install)
152+
touch libavif-stamp
153+
}
154+
101155
function build {
102156
build_xz
103157
if [ -z "$IS_ALPINE" ] && [ -z "$SANITIZER" ] && [ -z "$IS_MACOS" ]; then
@@ -132,6 +186,7 @@ function build {
132186
build_tiff
133187
fi
134188

189+
build_libavif
135190
build_libpng
136191
build_lcms2
137192
build_openjpeg

.github/workflows/wheels-test.ps1

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@ if ("$venv" -like "*\cibw-run-*\pp*-win_amd64\*") {
99
C:\vc_redist.x64.exe /install /quiet /norestart | Out-Null
1010
}
1111
$env:path += ";$pillow\winbuild\build\bin\"
12-
& "$venv\Scripts\activate.ps1"
12+
if (Test-Path $venv\Scripts\pypy.exe) {
13+
$python = "pypy.exe"
14+
} else {
15+
$python = "python.exe"
16+
}
1317
& reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f
1418
if ("$venv" -like "*\cibw-run-*-win_amd64\*") {
15-
& python -m pip install numpy
19+
& $venv\Scripts\$python -m pip install numpy
1620
}
1721
cd $pillow
18-
& python -VV
22+
& $venv\Scripts\$python -VV
1923
if (!$?) { exit $LASTEXITCODE }
20-
& python selftest.py
24+
& $venv\Scripts\$python selftest.py
2125
if (!$?) { exit $LASTEXITCODE }
22-
& python -m pytest -vx Tests\check_wheel.py
26+
& $venv\Scripts\$python -m pytest -vx Tests\check_wheel.py
2327
if (!$?) { exit $LASTEXITCODE }
24-
& python -m pytest -vx Tests
28+
& $venv\Scripts\$python -m pytest -vx Tests
2529
if (!$?) { exit $LASTEXITCODE }

.github/workflows/wheels.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- name: "macOS 10.13 x86_64"
5959
os: macos-13
6060
cibw_arch: x86_64
61-
build: "cp3{12,13}*"
61+
build: "cp3{12,13,14}*"
6262
macosx_deployment_target: "10.13"
6363
- name: "macOS 10.15 x86_64"
6464
os: macos-13
@@ -110,7 +110,6 @@ jobs:
110110
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: ${{ matrix.manylinux }}
111111
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }}
112112
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
113-
CIBW_SKIP: pp39-*
114113
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
115114

116115
- uses: actions/upload-artifact@v4
@@ -160,7 +159,7 @@ jobs:
160159
# Install extra test images
161160
xcopy /S /Y Tests\test-images\* Tests\images
162161
163-
& python.exe winbuild\build_prepare.py -v --no-imagequant --no-avif --architecture=${{ matrix.cibw_arch }}
162+
& python.exe winbuild\build_prepare.py -v --no-imagequant --architecture=${{ matrix.cibw_arch }}
164163
shell: pwsh
165164

166165
- name: Build wheels
@@ -188,7 +187,6 @@ jobs:
188187
CIBW_BEFORE_ALL: "{package}\\winbuild\\build\\build_dep_all.cmd"
189188
CIBW_CACHE_PATH: "C:\\cibw"
190189
CIBW_ENABLE: cpython-prerelease cpython-freethreading pypy
191-
CIBW_SKIP: pp39-*
192190
CIBW_TEST_SKIP: "*-win_arm64"
193191
CIBW_TEST_COMMAND: 'docker run --rm
194192
-v {project}:C:\pillow

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.11.8
3+
rev: v0.11.12
44
hooks:
5-
- id: ruff
5+
- id: ruff-check
66
args: [--exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror
@@ -24,7 +24,7 @@ repos:
2424
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.gd$|\.opt$)
2525

2626
- repo: https://github.com/pre-commit/mirrors-clang-format
27-
rev: v20.1.3
27+
rev: v20.1.5
2828
hooks:
2929
- id: clang-format
3030
types: [c]
@@ -58,7 +58,7 @@ repos:
5858
- id: check-renovate
5959

6060
- repo: https://github.com/woodruffw/zizmor-pre-commit
61-
rev: v1.6.0
61+
rev: v1.9.0
6262
hooks:
6363
- id: zizmor
6464

@@ -68,7 +68,7 @@ repos:
6868
- id: sphinx-lint
6969

7070
- repo: https://github.com/tox-dev/pyproject-fmt
71-
rev: v2.5.1
71+
rev: v2.6.0
7272
hooks:
7373
- id: pyproject-fmt
7474

0 commit comments

Comments
 (0)