From 8c0e776259512e4a7bc4373e8ce69db56c4fd7ee Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 14 Nov 2023 22:50:55 -0600 Subject: [PATCH 1/2] pre-commit: move black settings to pyproject.toml Also stop explicitly specifying that black should be run under Python 3; it's redundant. Signed-off-by: Benjamin Gilbert --- .pre-commit-config.yaml | 2 -- pyproject.toml | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 503c9f78..c6cf8563 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,8 +32,6 @@ repos: hooks: - id: black name: Format python code with black - language_version: python3 - args: ["--skip-string-normalization"] - repo: https://github.com/asottile/blacken-docs rev: 1.16.0 diff --git a/pyproject.toml b/pyproject.toml index 53914a58..943358a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,9 @@ packages = ["openslide"] [tool.setuptools.dynamic] version = {attr = "openslide._version.__version__"} +[tool.black] +skip-string-normalization = true + [tool.isort] profile = "black" force_sort_within_sections = true From 0c4a99c16031e1900ddcf93f2f9c41b8eed7d29c Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 14 Nov 2023 22:52:34 -0600 Subject: [PATCH 2/2] pre-commit: specify Python target versions to black Signed-off-by: Benjamin Gilbert --- .github/ISSUE_TEMPLATE/python-bump.md | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/python-bump.md b/.github/ISSUE_TEMPLATE/python-bump.md index 0b0f6b25..6daf89ea 100644 --- a/.github/ISSUE_TEMPLATE/python-bump.md +++ b/.github/ISSUE_TEMPLATE/python-bump.md @@ -2,7 +2,7 @@ - Update Git main - [ ] `git checkout main` - - [ ] Add classifier for new Python version to `pyproject.toml' + - [ ] In `pyproject.toml`, add classifier for new Python version and update `tool.black.target-version` - [ ] Add new Python version to lists in `.github/workflows/python.yml` - [ ] Commit and open a PR - [ ] Merge the PR when CI passes diff --git a/pyproject.toml b/pyproject.toml index 943358a0..699b5925 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ version = {attr = "openslide._version.__version__"} [tool.black] skip-string-normalization = true +target-version = ["py38", "py39", "py310", "py311", "py312"] [tool.isort] profile = "black"