jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1335978?usp=email )

Change subject: tests: Skip Pillow on CPython 3.13t
......................................................................

tests: Skip Pillow on CPython 3.13t

Pillow 12.3 no longer provides free-threaded CPython 3.13 wheels.
Pillow is an optional Tkinter dependency, and this CI entry uses
unittest, which skips the GUI tests on GitHub Actions.

Add an aggregate package extra generated from the existing dependency
groups and install it for 3.13t. This retains coverage of the other
optional dependencies without pinning an older Pillow release or
building Pillow from source.

Normalize the CPython requirement and validate requirement entries as
PEP 508 specifiers to prevent inline pip options.

Bug: T432100
Change-Id: Idd5712fc539df3f98088a9989864102f4ef28a7b
---
M .github/workflows/pywikibot-ci.yml
M requirements.txt
M setup.py
M tests/setup_tests.py
4 files changed, 40 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.github/workflows/pywikibot-ci.yml 
b/.github/workflows/pywikibot-ci.yml
index 9de4418..e2fc925 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -86,8 +86,11 @@
           python -m pip install --upgrade pip
           pip --version
           pip install -r dev-requirements.txt
-          pip install -r requirements.txt
-          pip install wikitextparser
+          if [ "${{ matrix.python-version }}" = "3.13t" ]; then
+            pip install '.[all-no-gui]'
+          else
+            pip install -r requirements.txt
+          fi
           pip install requests[socks]
       - name: Install DjVuLibre
         if: runner.os == 'Linux'
diff --git a/requirements.txt b/requirements.txt
index 0798a7f..1fab7e6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -44,11 +44,8 @@

 # GUI
 # Pillow cannot be installed with GraalPy, Python 3.9 or PyPy < 3.11
-# Free-threaded CPython 3.13t has no compatible Pillow wheel yet;
-# prevent falling back to a source build with --only-binary option.
 Pillow>=12.2.0; platform_python_implementation == "PyPy" and python_version >= 
"3.11"
-Pillow>=12.2.0; platform_python_implementation == "CPython" and  
python_version >= "3.10" and python_version < "3.13"
-Pillow>=12.2.0; platform_python_implementation == "CPython" and python_version 
>= "3.13" --only-binary Pillow
+Pillow>=12.2.0; platform_python_implementation == "CPython" and  
python_version >= "3.10"

 # core pagegenerators
 googlesearch-python >= 1.3.0
diff --git a/setup.py b/setup.py
index c79f45d..aa2f694 100755
--- a/setup.py
+++ b/setup.py
@@ -62,6 +62,14 @@
     ],
 }

+# Install every optional dependency except the Tkinter GUI dependencies.
+extra_deps['all-no-gui'] = [
+    requirement
+    for name, requirements in extra_deps.items()
+    if name != 'Tkinter'
+    for requirement in requirements
+]
+

 # ------- setup extra_requires for scripts ------- #
 script_deps = {
diff --git a/tests/setup_tests.py b/tests/setup_tests.py
index 0570802..1e60bbc 100755
--- a/tests/setup_tests.py
+++ b/tests/setup_tests.py
@@ -11,6 +11,7 @@
 import unittest
 from unittest.mock import patch

+from packaging.requirements import Requirement
 from packaging.version import Version

 import pywikibot
@@ -56,6 +57,31 @@
             f'version {newer_version!r}.'
         )

+    def test_requirements_file(self) -> None:
+        """Test that pip requirements use valid dependency specifiers."""
+        with open(setup.path / 'requirements.txt') as f:
+            lines = [line.partition('#')[0].strip() for line in f]
+
+        for requirement in lines:
+            if requirement and not requirement.startswith('-'):
+                with self.subTest(requirement=requirement):
+                    Requirement(requirement)
+
+    def test_all_no_gui_extra(self) -> None:
+        """Test that the all-no-gui extra excludes only Tkinter."""
+        expected = {
+            requirement
+            for name, requirements in setup.extra_deps.items()
+            if name not in {'all-no-gui', 'Tkinter'}
+            for requirement in requirements
+        }
+        self.assertSetEqual(set(setup.extra_deps['all-no-gui']), expected)
+        self.assertNotIn(
+            'pillow',
+            {Requirement(requirement).name.lower()
+             for requirement in setup.extra_deps['all-no-gui']},
+        )
+
     def test_read_desc(self) -> None:
         """Test :func:`setup.read_desc` function."""
         desc = setup.read_desc('README.rst')

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1335978?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Idd5712fc539df3f98088a9989864102f4ef28a7b
Gerrit-Change-Number: 1335978
Gerrit-PatchSet: 4
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to