From 8e3bccf597a9c8981aa5f4b1c3bc44d7ee6b49d1 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 30 Jan 2026 23:32:22 +1100 Subject: [PATCH 1/3] Run Lint against multiple Python versions --- .github/workflows/lint.yml | 16 ++++++++++++++-- pyproject.toml | 1 - 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e2f8bf47ac4..b60182d08ad 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,14 +16,26 @@ concurrency: jobs: lint: runs-on: ubuntu-latest - name: Lint + + strategy: + fail-fast: false + matrix: + python-version: [ + "3.14", + "3.13", + "3.12", + "3.11", + "3.10", + ] + + name: Lint ${{ matrix.python-version }} steps: - uses: actions/checkout@v6 with: persist-credentials: false - uses: actions/setup-python@v6 with: - python-version: "3.x" + python-version: ${{ matrix.python-version }} - name: Install uv uses: astral-sh/setup-uv@v7 - name: Lint diff --git a/pyproject.toml b/pyproject.toml index cc616bc547c..82428974c2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -214,7 +214,6 @@ testpaths = [ ] [tool.mypy] -python_version = "3.10" pretty = true disallow_any_generics = true disallow_untyped_defs = true From 03840645a193e34a1eb81fd7de0d7f8ad313dc5f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 30 Jan 2026 23:38:46 +1100 Subject: [PATCH 2/3] Convert buffer to bytes --- Tests/test_image.py | 2 +- src/PIL/GifImagePlugin.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/test_image.py b/Tests/test_image.py index 32c79919595..1e0377c0a05 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -202,7 +202,7 @@ class FP(io.BytesIO): from collections.abc import Buffer def write(self, data: Buffer) -> int: - return len(data) + return len(bytes(data)) else: diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 76a0d4ab99f..b1c7485ab49 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -1189,6 +1189,7 @@ class Collector(BytesIO): data = [] def write(self, data: Buffer) -> int: + data = bytes(data) self.data.append(data) return len(data) From 0e3c8b40dd2d2b02a1d509c2e9f217b565a48cd0 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 31 Jan 2026 22:28:18 +1100 Subject: [PATCH 3/3] Split typing into separate job --- .github/mergify.yml | 1 + .github/workflows/lint.yml | 18 ++----------- .github/workflows/typing.yml | 52 ++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/typing.yml diff --git a/.github/mergify.yml b/.github/mergify.yml index 14222db1094..63508de3428 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -4,6 +4,7 @@ pull_request_rules: - "#approved-reviews-by>=1" - label=automerge - status-success=Lint + - status-success=Typing Successful - status-success=Test Successful - status-success=Docker Test Successful - status-success=Windows Test Successful diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b60182d08ad..f9325a9eefb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,29 +16,15 @@ concurrency: jobs: lint: runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - python-version: [ - "3.14", - "3.13", - "3.12", - "3.11", - "3.10", - ] - - name: Lint ${{ matrix.python-version }} + name: Lint steps: - uses: actions/checkout@v6 with: persist-credentials: false - uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} + python-version: "3.x" - name: Install uv uses: astral-sh/setup-uv@v7 - name: Lint run: uvx --with tox-uv tox -e lint - - name: Mypy - run: uvx --with tox-uv tox -e mypy diff --git a/.github/workflows/typing.yml b/.github/workflows/typing.yml new file mode 100644 index 00000000000..bb4bd90190c --- /dev/null +++ b/.github/workflows/typing.yml @@ -0,0 +1,52 @@ +name: Typing + +on: [push, pull_request, workflow_dispatch] + +permissions: {} + +env: + FORCE_COLOR: 1 + PREK_COLOR: always + RUFF_OUTPUT_FORMAT: github + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + typing: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: [ + "3.14", + "3.13", + "3.12", + "3.11", + "3.10", + ] + + name: Typing Python ${{ matrix.python-version }} + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - uses: actions/setup-python@v6 + with: + python-version: "3.x" + - name: Install uv + uses: astral-sh/setup-uv@v7 + - name: Typing + run: uvx --with tox-uv tox -e mypy -- --python-version=${{ matrix.python-version }} + + success: + permissions: + contents: none + needs: typing + runs-on: ubuntu-latest + name: Typing Successful + steps: + - name: Success + run: echo Typing Successful