From 1ff56f2e68173a2e2ea62268b4657110e7f8d6ae Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Tue, 10 Mar 2026 19:36:26 +0100 Subject: [PATCH 1/4] Configuring with plone.meta --- .github/workflows/test-matrix.yml | 2 +- .meta.toml | 2 +- .pre-commit-config.yaml | 6 +++--- news/+meta.internal | 2 ++ pyproject.toml | 4 ++-- tox.ini | 4 ++++ 6 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 news/+meta.internal diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 05872b5..8b2da2b 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -19,7 +19,7 @@ jobs: - ["ubuntu", "ubuntu-latest"] config: # [Python version, visual name, tox env] - - ["3.13", "6.2 on py3.13", "py313-plone62"] + - ["3.14", "6.2 on py3.14", "py314-plone62"] - ["3.10", "6.2 on py3.10", "py310-plone62"] runs-on: ${{ matrix.os[1] }} diff --git a/.meta.toml b/.meta.toml index e190393..7160c30 100644 --- a/.meta.toml +++ b/.meta.toml @@ -3,7 +3,7 @@ # See the inline comments on how to expand/tweak this configuration file [meta] template = "default" -commit-id = "2.2.1" +commit-id = "2.5.1" [tox] test_matrix = {"6.2" = ["*"]} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26c3c6f..2e8482b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,13 +10,13 @@ repos: rev: v3.21.2 hooks: - id: pyupgrade - args: [--py38-plus] + args: [--py310-plus] - repo: https://github.com/pycqa/isort - rev: 7.0.0 + rev: 8.0.1 hooks: - id: isort - repo: https://github.com/psf/black-pre-commit-mirror - rev: 25.12.0 + rev: 26.1.0 hooks: - id: black - repo: https://github.com/collective/zpretty diff --git a/news/+meta.internal b/news/+meta.internal new file mode 100644 index 0000000..c08f539 --- /dev/null +++ b/news/+meta.internal @@ -0,0 +1,2 @@ +Update configuration files. +[plone devs] diff --git a/pyproject.toml b/pyproject.toml index c4a6ae3..5c4082e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ # https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [build-system] -requires = ["setuptools>=68.2,<80", "wheel"] +requires = ["setuptools>=68.2,<83", "wheel"] [tool.towncrier] directory = "news/" @@ -60,7 +60,7 @@ profile = "plone" ## [tool.black] -target-version = ["py38"] +target-version = ["py310"] ## # Add extra configuration options in .meta.toml: diff --git a/tox.ini b/tox.ini index 19a6c95..44bfde4 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ min_version = 4.4.0 envlist = lint test + py314-plone62 py313-plone62 py312-plone62 py311-plone62 @@ -18,6 +19,7 @@ envlist = # Add extra configuration options in .meta.toml: # - to specify a custom testing combination of Plone and python versions, use `test_matrix` # Use ["*"] to use all supported Python versions for this Plone version. +# - to disable the test matrix entirely, set `use_test_matrix = false` # - to specify extra custom environments, use `envlist_lines` # - to specify extra `tox` top-level options, use `config_lines` # [tox] @@ -62,6 +64,7 @@ description = check if the package defines all its dependencies skip_install = true deps = build + setuptools<82.0.0 z3c.dependencychecker==2.14.3 commands = python -m build --sdist @@ -130,6 +133,7 @@ extras = ## # Add extra configuration options in .meta.toml: # [tox] +# skip_test_extra = true # test_extras = """ # tests # widgets From 7e6212d78be16cbfc70019036d19940a5a4e1ffb Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Tue, 10 Mar 2026 19:36:49 +0100 Subject: [PATCH 2/4] chore: pyupgrade --- src/plone/scale/scale.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plone/scale/scale.py b/src/plone/scale/scale.py index 5aac9eb..770b305 100644 --- a/src/plone/scale/scale.py +++ b/src/plone/scale/scale.py @@ -9,7 +9,6 @@ import PIL.ImageSequence import re import sys -import typing import warnings @@ -567,10 +566,10 @@ def _contain_svg_image(root, target_width: int, target_height: int): def scale_svg_image( image: io.BytesIO, - target_width: typing.Union[None, int], - target_height: typing.Union[None, int], + target_width: None | int, + target_height: None | int, mode: str = "contain", -) -> typing.Tuple[bytes, typing.Tuple[int, int]]: +) -> tuple[bytes, tuple[int, int]]: """Scale and crop a SVG image to another display size. This is all about scaling for the display in a web browser. From 17bc44754772ca2f17b8d228790a18e1e567c3a7 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Tue, 10 Mar 2026 19:37:03 +0100 Subject: [PATCH 3/4] chore: isort --- setup.py | 1 - src/plone/scale/scale.py | 1 - src/plone/scale/storage.py | 1 - src/plone/scale/tests/__init__.py | 1 - src/plone/scale/tests/test_scale.py | 1 - src/plone/scale/tests/test_storage.py | 1 - 6 files changed, 6 deletions(-) diff --git a/setup.py b/setup.py index b329c5d..053993e 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ from pathlib import Path from setuptools import setup - version = "5.0.0a4.dev0" long_description = ( diff --git a/src/plone/scale/scale.py b/src/plone/scale/scale.py index 770b305..afa3a6c 100644 --- a/src/plone/scale/scale.py +++ b/src/plone/scale/scale.py @@ -11,7 +11,6 @@ import sys import warnings - try: # Pillow 9.1.0+ LANCZOS = PIL.Image.Resampling.LANCZOS diff --git a/src/plone/scale/storage.py b/src/plone/scale/storage.py index 6c439c7..2595dc7 100644 --- a/src/plone/scale/storage.py +++ b/src/plone/scale/storage.py @@ -13,7 +13,6 @@ import logging import pprint - try: from plone.protect.utils import safeWrite except ImportError: diff --git a/src/plone/scale/tests/__init__.py b/src/plone/scale/tests/__init__.py index ada267e..5023597 100644 --- a/src/plone/scale/tests/__init__.py +++ b/src/plone/scale/tests/__init__.py @@ -1,4 +1,3 @@ from pathlib import Path - TEST_DATA_LOCATION = Path(__file__).parent / "data" diff --git a/src/plone/scale/tests/test_scale.py b/src/plone/scale/tests/test_scale.py index be08641..b24468c 100644 --- a/src/plone/scale/tests/test_scale.py +++ b/src/plone/scale/tests/test_scale.py @@ -11,7 +11,6 @@ import PIL.ImageDraw import warnings - PNG = (TEST_DATA_LOCATION / "logo.png").read_bytes() GIF = (TEST_DATA_LOCATION / "logo.gif").read_bytes() TIFF = (TEST_DATA_LOCATION / "logo.tiff").read_bytes() diff --git a/src/plone/scale/tests/test_storage.py b/src/plone/scale/tests/test_storage.py index 906a362..a8a97c9 100644 --- a/src/plone/scale/tests/test_storage.py +++ b/src/plone/scale/tests/test_storage.py @@ -9,7 +9,6 @@ import zope.annotation.attribute import zope.annotation.interfaces - _marker = object() From 08205c9df283a68ec0f37b8b93c05f57eb5b1f45 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Tue, 10 Mar 2026 19:37:22 +0100 Subject: [PATCH 4/4] chore: black --- src/plone/scale/tests/test_scale.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plone/scale/tests/test_scale.py b/src/plone/scale/tests/test_scale.py index b24468c..15ee2b2 100644 --- a/src/plone/scale/tests/test_scale.py +++ b/src/plone/scale/tests/test_scale.py @@ -27,7 +27,7 @@ class ScalingTests(TestCase): def testNewSizeReturned(self): - (imagedata, format, size) = scaleImage(PNG, 42, 51, "contain") + imagedata, format, size = scaleImage(PNG, 42, 51, "contain") input = StringIO(imagedata) image = PIL.Image.open(input) self.assertEqual(image.size, size) @@ -69,7 +69,7 @@ def testAlphaForcesPNG(self): self.assertEqual(scaleImage(result, 84, 103, "contain")[1], "PNG") def testScaledCMYKIsRGB(self): - (imagedata, format, size) = scaleImage(CMYK, 42, 51, "contain") + imagedata, format, size = scaleImage(CMYK, 42, 51, "contain") input = StringIO(imagedata) image = PIL.Image.open(input) self.assertEqual(image.mode, "RGB") @@ -78,20 +78,20 @@ def testScaledPngImageIsPng(self): self.assertEqual(scaleImage(PNG, 84, 103, "contain")[1], "PNG") def testScaledPreservesProfile(self): - (imagedata, format, size) = scaleImage(PROFILE, 42, 51, "contain") + imagedata, format, size = scaleImage(PROFILE, 42, 51, "contain") input = StringIO(imagedata) image = PIL.Image.open(input) self.assertIsNotNone(image.info.get("icc_profile")) def testScaleWithFewColorsStaysColored(self): - (imagedata, format, size) = scaleImage(PROFILE, 16, None, "contain") + imagedata, format, size = scaleImage(PROFILE, 16, None, "contain") image = PIL.Image.open(StringIO(imagedata)) self.assertEqual(max(image.size), 16) self.assertEqual(image.mode, "RGB") self.assertEqual(image.format, "JPEG") def testScaledWebp(self): - (imagedata, format, size) = scaleImage(PROFILE_WEBP, 120, 120) + imagedata, format, size = scaleImage(PROFILE_WEBP, 120, 120) self.assertEqual(format, "WEBP") self.assertEqual(size, (120, 120)) self.assertTrue(len(imagedata) < len(PROFILE_WEBP)) @@ -106,7 +106,7 @@ def testAutomaticGreyscale(self): draw.line(((0, i), (256, i)), fill=(i, i, i)) result = StringIO() src.save(result, "JPEG") - (imagedata, format, size) = scaleImage(result, 200, None, "contain") + imagedata, format, size = scaleImage(result, 200, None, "contain") image = PIL.Image.open(StringIO(imagedata)) self.assertEqual(max(image.size), 200) self.assertEqual(image.mode, "L") @@ -161,7 +161,7 @@ def testAutomaticPalette(self): self.assertEqual(png.format, "PNG") self.assertIsNone(png.getcolors(maxcolors=256)) # scale it to a size where we get less than 256 colors - (imagedata, format, size) = scaleImage(dst.getvalue(), 24, None, "contain") + imagedata, format, size = scaleImage(dst.getvalue(), 24, None, "contain") image = PIL.Image.open(StringIO(imagedata)) # we should now have an image in palette mode self.assertEqual(image.mode, "P")