diff --git a/.appveyor.yml b/.appveyor.yml index 0f5dea9c515..781ad4a4b1d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,3 +1,10 @@ +skip_commits: + files: + - ".github/**/*" + - ".gitmodules" + - "docs/**/*" + - "wheels/**/*" + version: '{build}' clone_folder: c:\pillow init: @@ -6,16 +13,17 @@ init: # Uncomment previous line to get RDP access during the build. environment: + COVERAGE_CORE: sysmon EXECUTABLE: python.exe TEST_OPTIONS: DEPLOY: YES matrix: - - PYTHON: C:/Python312 + - PYTHON: C:/Python313 ARCHITECTURE: x86 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - - PYTHON: C:/Python38-x64 - ARCHITECTURE: x64 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + - PYTHON: C:/Python39-x64 + ARCHITECTURE: AMD64 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 install: @@ -24,13 +32,13 @@ install: - curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip - 7z x pillow-test-images.zip -oc:\ - xcopy /S /Y c:\test-images-main\* c:\pillow\tests\images -- curl -fsSL -o nasm-win64.zip https://raw.githubusercontent.com/python-pillow/pillow-depends/main/nasm-2.16.01-win64.zip +- curl -fsSL -o nasm-win64.zip https://raw.githubusercontent.com/python-pillow/pillow-depends/main/nasm-2.16.03-win64.zip - 7z x nasm-win64.zip -oc:\ -- choco install ghostscript --version=10.0.0.20230317 -- path c:\nasm-2.16.01;C:\Program Files\gs\gs10.00.0\bin;%PATH% +- choco install ghostscript --version=10.4.0 +- path c:\nasm-2.16.03;C:\Program Files\gs\gs10.04.0\bin;%PATH% - cd c:\pillow\winbuild\ - ps: | - c:\python38\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\ + c:\python39\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% @@ -43,11 +51,10 @@ build_script: test_script: - cd c:\pillow -- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov pytest-timeout defusedxml numpy olefile pyroma' +- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov pytest-timeout defusedxml ipython numpy olefile pyroma' - c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\%EXECUTABLE% -- '%PYTHON%\%EXECUTABLE% -c "from PIL import Image"' -- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests' -#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest? +- path %PYTHON%;%PATH% +- .ci\test.cmd after_test: - curl -Os https://uploader.codecov.io/latest/windows/codecov.exe diff --git a/.ci/install.sh b/.ci/install.sh index 30b64349d70..e85e6bdc575 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -21,17 +21,16 @@ set -e if [[ $(uname) != CYGWIN* ]]; then sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\ - ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\ + ghostscript libjpeg-turbo-progs libopenjp2-7-dev\ cmake meson imagemagick libharfbuzz-dev libfribidi-dev\ sway wl-clipboard libopenblas-dev fi python3 -m pip install --upgrade pip python3 -m pip install --upgrade wheel -# TODO Update condition when cffi supports 3.13 -if ! [[ "$GHA_PYTHON_VERSION" == "3.13" ]]; then PYTHONOPTIMIZE=0 python3 -m pip install cffi ; fi python3 -m pip install coverage python3 -m pip install defusedxml +python3 -m pip install ipython python3 -m pip install olefile python3 -m pip install -U pytest python3 -m pip install -U pytest-cov @@ -39,21 +38,17 @@ python3 -m pip install -U pytest-timeout python3 -m pip install pyroma if [[ $(uname) != CYGWIN* ]]; then - # TODO Update condition when NumPy supports 3.13 - if ! [[ "$GHA_PYTHON_VERSION" == "3.13" ]]; then python3 -m pip install numpy ; fi + python3 -m pip install numpy # PyQt6 doesn't support PyPy3 if [[ $GHA_PYTHON_VERSION == 3.* ]]; then sudo apt-get -qq install libegl1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0 - python3 -m pip install pyqt6 + # TODO Update condition when pyqt6 supports free-threading + if ! [[ "$PYTHON_GIL" == "0" ]]; then python3 -m pip install pyqt6 ; fi fi # Pyroma uses non-isolated build and fails with old setuptools - if [[ - $GHA_PYTHON_VERSION == pypy3.9 - || $GHA_PYTHON_VERSION == 3.8 - || $GHA_PYTHON_VERSION == 3.9 - ]]; then + if [[ $GHA_PYTHON_VERSION == 3.9 ]]; then # To match pyproject.toml python3 -m pip install "setuptools>=67.8" fi diff --git a/.ci/requirements-cibw.txt b/.ci/requirements-cibw.txt index dd61634cd31..c4511439ccb 100644 --- a/.ci/requirements-cibw.txt +++ b/.ci/requirements-cibw.txt @@ -1 +1 @@ -cibuildwheel==2.16.2 +cibuildwheel==2.21.3 diff --git a/.ci/requirements-mypy.txt b/.ci/requirements-mypy.txt new file mode 100644 index 00000000000..dcb3996e24e --- /dev/null +++ b/.ci/requirements-mypy.txt @@ -0,0 +1,12 @@ +mypy==1.11.2 +IceSpringPySideStubs-PyQt6 +IceSpringPySideStubs-PySide6 +ipython +numpy +packaging +pytest +sphinx +types-atheris +types-defusedxml +types-olefile +types-setuptools diff --git a/.ci/test.cmd b/.ci/test.cmd new file mode 100644 index 00000000000..aafc9290c80 --- /dev/null +++ b/.ci/test.cmd @@ -0,0 +1,3 @@ +python.exe -c "from PIL import Image" +IF ERRORLEVEL 1 EXIT /B +python.exe -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests diff --git a/.ci/test.sh b/.ci/test.sh index 8ff7c5f6483..3f0ddc350a9 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -4,4 +4,4 @@ set -e python3 -c "from PIL import Image" -python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests $REVERSE +python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests $REVERSE diff --git a/.clang-format b/.clang-format index be32e6d1a8a..143dde82c2c 100644 --- a/.clang-format +++ b/.clang-format @@ -3,12 +3,13 @@ BasedOnStyle: Google AlwaysBreakAfterReturnType: All AllowShortIfStatementsOnASingleLine: false -AlignAfterOpenBracket: AlwaysBreak +AlignAfterOpenBracket: BlockIndent BinPackArguments: false BinPackParameters: false BreakBeforeBraces: Attach ColumnLimit: 88 DerivePointerAlignment: false +IndentGotoLabels: false IndentWidth: 4 Language: Cpp PointerAlignment: Right diff --git a/.coveragerc b/.coveragerc index 46df3f90d27..a94a2567854 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,10 +10,14 @@ exclude_also = if DEBUG: # Don't complain about compatibility code for missing optional dependencies except ImportError + if TYPE_CHECKING: + @abc.abstractmethod + # Empty bodies in protocols or abstract methods + ^\s*def [a-zA-Z0-9_]+\(.*\)(\s*->.*)?:\s*\.\.\.(\s*#.*)?$ + ^\s*\.\.\.(\s*#.*)?$ [run] omit = Tests/32bit_segfault_check.py - Tests/bench_cffi_access.py Tests/check_*.py Tests/createfontdatachunk.py diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e0e6804bfe4..8fc6bd0ad54 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -tidelift: "pypi/Pillow" +tidelift: "pypi/pillow" diff --git a/.github/ISSUE_TEMPLATE/ISSUE_REPORT.md b/.github/ISSUE_TEMPLATE/ISSUE_REPORT.md index 115f6135dfb..ea4c0e92b8e 100644 --- a/.github/ISSUE_TEMPLATE/ISSUE_REPORT.md +++ b/.github/ISSUE_TEMPLATE/ISSUE_REPORT.md @@ -48,6 +48,21 @@ Thank you. * Python: * Pillow: +```text +Please paste here the output of running: + +python3 -m PIL.report +or +python3 -m PIL --report + +Or the output of the following Python code: + +from PIL import report +# or +from PIL import features +features.pilinfo(supported_formats=False) +``` +