From 2b6ae5d0370eee34f4df21ff6b2e2c9ec4e139c2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 12 Jun 2026 15:10:53 +0300 Subject: [PATCH 1/2] Run pyroma in tox via pre-commit --- .pre-commit-config.yaml | 7 ++++++ Makefile | 1 - Tests/test_pyroma.py | 55 ----------------------------------------- tox.ini | 2 +- 4 files changed, 8 insertions(+), 57 deletions(-) delete mode 100644 Tests/test_pyroma.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7bcb971c18a..45092f6047f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -86,6 +86,13 @@ repos: hooks: - id: tox-ini-fmt + - repo: https://github.com/regebro/pyroma + rev: 5.0.1 + hooks: + - id: pyroma + additional_dependencies: [check-manifest] + stages: [manual] + - repo: meta hooks: - id: check-hooks-apply diff --git a/Makefile b/Makefile index 6e050c715d2..32c0a182fcb 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,6 @@ release-test: python3 -m pytest Tests python3 -m pip install . python3 -m pytest -qq - python3 -m check_manifest python3 -m pyroma . $(MAKE) readme diff --git a/Tests/test_pyroma.py b/Tests/test_pyroma.py deleted file mode 100644 index 915dbe7b685..00000000000 --- a/Tests/test_pyroma.py +++ /dev/null @@ -1,55 +0,0 @@ -from __future__ import annotations - -from importlib.metadata import metadata - -import pytest - -from PIL import __version__ - -TYPE_CHECKING = False - -if TYPE_CHECKING: - from importlib.metadata import PackageMetadata - -pyroma = pytest.importorskip("pyroma", reason="Pyroma not installed") - - -def map_metadata_keys(md: PackageMetadata) -> dict[str, str | list[str] | None]: - # Convert installed wheel metadata into canonical Core Metadata 2.4 format. - # This was a utility method in pyroma 4.3.3; it was removed in 5.0. - # This implementation is constructed from the relevant logic from - # Pyroma 5.0's `build_metadata()` implementation. This has been submitted - # upstream to Pyroma as https://github.com/regebro/pyroma/pull/116, - # so it may be possible to simplify this test in future. - data = {} - for key in set(md): - value = md.get_all(key) - key = pyroma.projectdata.normalize(key) - - if value is not None and len(value) == 1: - first_value = value[0] - if first_value.strip() != "UNKNOWN": - data[key] = first_value - else: - data[key] = value - return data - - -def test_pyroma() -> None: - # Arrange - data = map_metadata_keys(metadata("Pillow")) - - # Act - rating = pyroma.ratings.rate(data) - - # Assert - if "rc" in __version__: - # Pyroma needs to chill about RC versions and not kill all our tests. - assert rating == ( - 9, - ["The package's version number does not comply with PEP-386."], - ) - - else: - # Should have a perfect score - assert rating == (10, []) diff --git a/tox.ini b/tox.ini index aede5fcdc54..5089d3817b7 100644 --- a/tox.ini +++ b/tox.ini @@ -29,7 +29,7 @@ pass_env = PREK_COLOR commands = prek run --all-files --show-diff-on-failure - check-manifest + prek run --all-files --show-diff-on-failure pyroma [testenv:mypy] skip_install = true From 9344159f0dfb3729bb73ef3c6c786ec47aa01559 Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Mon, 15 Jun 2026 08:04:57 +1000 Subject: [PATCH 2/2] Remove pyroma and check-manifest dependencies (#173) Co-authored-by: Andrew Murray --- .ci/install.sh | 1 - .github/workflows/macos-install.sh | 1 - Makefile | 1 - Tests/test_image_access.py | 1 + pyproject.toml | 3 +-- 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.ci/install.sh b/.ci/install.sh index cc104c45f9b..db680db96b6 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -31,7 +31,6 @@ python3 -m pip install olefile python3 -m pip install -U pytest python3 -m pip install -U pytest-cov python3 -m pip install -U pytest-timeout -python3 -m pip install pyroma # optional test dependencies, only install if there's a binary package. python3 -m pip install --only-binary=:all: numpy || true python3 -m pip install --only-binary=:all: pyarrow || true diff --git a/.github/workflows/macos-install.sh b/.github/workflows/macos-install.sh index 603ef5a234d..e95a786d758 100755 --- a/.github/workflows/macos-install.sh +++ b/.github/workflows/macos-install.sh @@ -12,7 +12,6 @@ python3 -m pip install olefile python3 -m pip install -U pytest python3 -m pip install -U pytest-cov python3 -m pip install -U pytest-timeout -python3 -m pip install pyroma # optional test dependencies, only install if there's a binary package. python3 -m pip install --only-binary=:all: numpy || true python3 -m pip install --only-binary=:all: pyarrow || true diff --git a/Makefile b/Makefile index 32c0a182fcb..0ab4651689c 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,6 @@ release-test: python3 -m pytest Tests python3 -m pip install . python3 -m pytest -qq - python3 -m pyroma . $(MAKE) readme .PHONY: sdist diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 6470ac9fc6f..5a2dc664a7f 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -260,6 +260,7 @@ class TestEmbeddable: @pytest.mark.xfail(not (sys.version_info >= (3, 13)), reason="failing test") @pytest.mark.skipif(not is_win32(), reason="requires Windows") def test_embeddable(self) -> None: + pytest.importorskip("setuptools", reason="setuptools not installed") import ctypes from setuptools.command import build_ext diff --git a/pyproject.toml b/pyproject.toml index 903c107fb87..a3140388129 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,17 +63,16 @@ optional-dependencies.test-arrow = [ "pyarrow", ] optional-dependencies.tests = [ - "check-manifest", "coverage>=7.4.2", "defusedxml", "markdown2", "olefile", "packaging", - "pyroma>=5", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", + "setuptools", "trove-classifiers>=2024.10.12", ] optional-dependencies.xmp = [