From 9077c2c018a1e37ea898929c205013fdb6e9e6f0 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sat, 7 Feb 2026 16:10:46 -0800 Subject: [PATCH 1/3] ImageFile context manager value is typed in Pillow >= 12.1.0 Signed-off-by: Benjamin Gilbert --- .pre-commit-config.yaml | 2 +- openslide/__init__.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5d6c68..cc1b8a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,7 +58,7 @@ repos: hooks: - id: mypy name: Check Python types - additional_dependencies: [flask, openslide-bin, pillow, types-PyYAML, types-setuptools] + additional_dependencies: [flask, openslide-bin, pillow >= 12.1.0, types-PyYAML, types-setuptools] - repo: https://github.com/rstcheck/rstcheck rev: v6.2.5 diff --git a/openslide/__init__.py b/openslide/__init__.py index 09bc03d..9332d24 100644 --- a/openslide/__init__.py +++ b/openslide/__init__.py @@ -394,9 +394,7 @@ def detect_format(cls, filename: lowlevel.Filename) -> str | None: If the file format is not recognized, return None.""" try: with Image.open(filename) as img: - # img currently resolves as Any - # https://github.com/python-pillow/Pillow/pull/8362 - return img.format # type: ignore[no-any-return] + return img.format except OSError: return None From a5baf3ccdae1733ca4f0f8ea0652308fe0eb1de7 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sat, 7 Feb 2026 16:02:04 -0800 Subject: [PATCH 2/3] mkmaintainer: properly use venv managed by pre-commit Signed-off-by: Benjamin Gilbert --- .github/maintainer/mkmaintainer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/maintainer/mkmaintainer.py b/.github/maintainer/mkmaintainer.py index f399f13..0fba403 100755 --- a/.github/maintainer/mkmaintainer.py +++ b/.github/maintainer/mkmaintainer.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python from __future__ import annotations From 591a9e1bbe964f3dd2d4adfef687b791c7834fd4 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sat, 7 Feb 2026 15:20:34 -0800 Subject: [PATCH 3/3] workflows: switch small jobs to ubuntu-slim Save some resources. Signed-off-by: Benjamin Gilbert --- .github/workflows/python.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 8617fc3..db31092 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -16,7 +16,7 @@ env: jobs: pre-commit: name: Rerun pre-commit checks - runs-on: ubuntu-latest + runs-on: ubuntu-slim outputs: dist-base: ${{ steps.paths.outputs.dist }} docs-base: ${{ steps.paths.outputs.docs }} @@ -252,7 +252,7 @@ jobs: docs: name: Docs needs: pre-commit - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Check out repo uses: actions/checkout@v5 @@ -279,7 +279,7 @@ jobs: name: pypi url: https://pypi.org/p/openslide-python needs: [pre-commit, tests, windows] - runs-on: ubuntu-latest + runs-on: ubuntu-slim concurrency: release-${{ github.ref }} permissions: contents: write