From 51e28fa3dbaf0e829cc5ee86be6fb377038a3732 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sun, 24 Aug 2025 14:15:19 -0500 Subject: [PATCH 1/2] pre-commit: update versions Signed-off-by: Benjamin Gilbert --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e01c82a..b5cbd84 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: '^(COPYING\.LESSER|examples/deepzoom/static/.*\.js)$' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-merge-conflict @@ -16,7 +16,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 + rev: v3.20.0 hooks: - id: pyupgrade name: Modernize python code @@ -47,21 +47,21 @@ repos: additional_dependencies: [flake8-bugbear, Flake8-pyproject] - repo: https://github.com/PyCQA/flake8 - rev: 7.2.0 + rev: 7.3.0 hooks: - id: flake8 name: Lint python code with flake8 additional_dependencies: [flake8-bugbear, Flake8-pyproject] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.17.1 hooks: - id: mypy name: Check Python types additional_dependencies: [flask, openslide-bin, pillow, types-setuptools] - repo: https://github.com/rstcheck/rstcheck - rev: v6.2.4 + rev: v6.2.5 hooks: - id: rstcheck name: Validate reStructuredText syntax From d2c8708bbc83ebe8afb1d6d28d206461b6959c9d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sun, 24 Aug 2025 14:58:19 -0500 Subject: [PATCH 2/2] Autogenerate Markdown file with release checklist links GitHub removed the feature allowing Markdown issue templates without front matter to be used in the `template` query argument. Adding front matter would cause the template to appear in the user-facing issue template chooser, degrading the issue UX a bit. However, we can still autofill the issue body by including it inline in the `body` query argument. Move maintainer templates to a separate directory and autogenerate a README.md that embeds them. Signed-off-by: Benjamin Gilbert --- .github/maintainer/README.md | 6 +++++ .github/maintainer/mkmaintainer.py | 27 +++++++++++++++++++ .../{ISSUE_TEMPLATE => maintainer}/release.md | 7 +++++ .../update-python.md} | 7 +++++ .pre-commit-config.yaml | 9 ++++++- 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/maintainer/README.md create mode 100755 .github/maintainer/mkmaintainer.py rename .github/{ISSUE_TEMPLATE => maintainer}/release.md (92%) rename .github/{ISSUE_TEMPLATE/python-bump.md => maintainer/update-python.md} (80%) diff --git a/.github/maintainer/README.md b/.github/maintainer/README.md new file mode 100644 index 0000000..9cf0872 --- /dev/null +++ b/.github/maintainer/README.md @@ -0,0 +1,6 @@ + + +## Maintainer issue templates + +- [Release checklist](https://github.com/openslide/openslide-python/issues/new?title=Release+X.Y.Z&body=%23+OpenSlide+Python+release+process%0A%0A-+%5B+%5D+Update+%60CHANGELOG.md%60+and+version+in+%60openslide%2F_version.py%60%0A-+%5B+%5D+Create+and+push+signed+tag%0A-+%5B+%5D+Find+the+%5Bworkflow+run%5D%28https%3A%2F%2Fgithub.com%2Fopenslide%2Fopenslide-python%2Factions%2Fworkflows%2Fpython.yml%29+for+the+tag%0A++-+%5B+%5D+Once+the+build+finishes%2C+approve+deployment+to+PyPI%0A++-+%5B+%5D+Download+the+docs+artifact%0A-+%5B+%5D+Verify+that+the+workflow+created+a+%5BPyPI+release%5D%28https%3A%2F%2Fpypi.org%2Fp%2Fopenslide-python%29+with+a+description%2C+source+tarball%2C+and+wheels%0A-+%5B+%5D+Verify+that+the+workflow+created+a+%5BGitHub+release%5D%28https%3A%2F%2Fgithub.com%2Fopenslide%2Fopenslide-python%2Freleases%29+with+release+notes%2C+source+tarballs%2C+and+wheels%0A-+%5B+%5D+%60cd%60+into+website+checkout%3B+%60rm+-r+api%2Fpython+%26%26+unzip+%2Fpath%2Fto%2Fdownloaded%2Fopenslide-python-docs.zip+%26%26+mv+openslide-python-docs-%2A+api%2Fpython%60%0A-+%5B+%5D+Update+website%3A+%60_data%2Freleases.yaml%60%2C+%60_includes%2Fnews.md%60%0A-+%5B+%5D+Start+a+%5BCI+build%5D%28https%3A%2F%2Fgithub.com%2Fopenslide%2Fopenslide.github.io%2Factions%2Fworkflows%2Fretile.yml%29+of+the+demo+site%0A-+%5B+%5D+Update+Ubuntu+PPA%0A-+%5B+%5D+Update+Fedora+and+possibly+EPEL+packages%0A-+%5B+%5D+Check+that+%5BCopr+package%5D%28https%3A%2F%2Fcopr.fedorainfracloud.org%2Fcoprs%2Fg%2Fopenslide%2Fopenslide%2Fbuilds%2F%29+built+successfully%0A-+%5B+%5D+Send+mail+to+-announce+and+-users%0A-+%5B+%5D+Post+to+%5Bforum.image.sc%5D%28https%3A%2F%2Fforum.image.sc%2Fc%2Fannouncements%2F10%29%0A-+%5B+%5D+Update+MacPorts+package&labels=release) +- [Update checklist for a Python minor release](https://github.com/openslide/openslide-python/issues/new?title=Add+Python+X.Y&body=%23+Adding+a+new+Python+release%0A%0A-+Update+Git+main%0A++-+%5B+%5D+%60git+checkout+main%60%0A++-+%5B+%5D+In+%60pyproject.toml%60%2C+add+classifier+for+new+Python+version+and+update+%60tool.black.target-version%60%0A++-+%5B+%5D+In+%60.github%2Fworkflows%2Fpython.yml%60%2C+update+hardcoded+Python+versions+and+add+new+version+to+lists%0A++-+%5B+%5D+Commit+and+open+a+PR%0A++-+%5B+%5D+Merge+the+PR+when+CI+passes%0A++-+%5B+%5D+Add+new+Python+jobs+to+%5Bbranch+protection+required+checks%5D%28https%3A%2F%2Fgithub.com%2Fopenslide%2Fopenslide-python%2Fsettings%2Fbranches%29%0A-+%5B+%5D+Update+MacPorts+package%0A-+%5B+%5D+Update+website%3A+Python+3+versions+in+%60download%2Findex.md%60&labels=release) diff --git a/.github/maintainer/mkmaintainer.py b/.github/maintainer/mkmaintainer.py new file mode 100755 index 0000000..f399f13 --- /dev/null +++ b/.github/maintainer/mkmaintainer.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +from __future__ import annotations + +from pathlib import Path +from urllib.parse import urlencode + +import yaml + +dir = Path(__file__).parent +with open(dir / 'README.md', 'w') as fh: + fh.write('\n\n') + fh.write('## Maintainer issue templates\n\n') + for path in sorted(dir.iterdir()): + if path.name == 'README.md' or path.suffix != '.md': + continue + _, front, body = path.read_text().split('---\n', 2) + info = yaml.safe_load(front) + args = urlencode( + { + 'title': info['title'], + 'body': body.strip(), + 'labels': ','.join(info.get('labels', [])), + } + ) + url = f"https://github.com/{info['repo']}/issues/new?{args}" + fh.write(f"- [{info['link-text']}]({url})\n") diff --git a/.github/ISSUE_TEMPLATE/release.md b/.github/maintainer/release.md similarity index 92% rename from .github/ISSUE_TEMPLATE/release.md rename to .github/maintainer/release.md index c4d29a1..0295013 100644 --- a/.github/ISSUE_TEMPLATE/release.md +++ b/.github/maintainer/release.md @@ -1,3 +1,10 @@ +--- +link-text: Release checklist +repo: openslide/openslide-python +title: Release X.Y.Z +labels: [release] +--- + # OpenSlide Python release process - [ ] Update `CHANGELOG.md` and version in `openslide/_version.py` diff --git a/.github/ISSUE_TEMPLATE/python-bump.md b/.github/maintainer/update-python.md similarity index 80% rename from .github/ISSUE_TEMPLATE/python-bump.md rename to .github/maintainer/update-python.md index 8da37b2..c1a8080 100644 --- a/.github/ISSUE_TEMPLATE/python-bump.md +++ b/.github/maintainer/update-python.md @@ -1,3 +1,10 @@ +--- +link-text: Update checklist for a Python minor release +repo: openslide/openslide-python +title: Add Python X.Y +labels: [release] +--- + # Adding a new Python release - Update Git main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5cbd84..93bffda 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-setuptools] + additional_dependencies: [flask, openslide-bin, pillow, types-PyYAML, types-setuptools] - repo: https://github.com/rstcheck/rstcheck rev: v6.2.5 @@ -82,6 +82,13 @@ repos: - repo: local hooks: + - id: mkmaintainer + name: Sync maintainer issue templates + entry: .github/maintainer/mkmaintainer.py + files: .github/maintainer/ + language: python + additional_dependencies: [PyYAML] + - id: annotations name: Require "from __future__ import annotations" language: pygrep