From 7c0ab495ebca93123da099de5c9b8f7b3951222c Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Sun, 9 Nov 2025 21:14:36 -0600 Subject: [PATCH 1/9] Add paths for doc and fuzz workflows Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- .github/workflows/doc.yml | 7 ++++++- .github/workflows/fuzz.yml | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 0bb8c9320e0..bf1b1364561 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -1,6 +1,11 @@ name: Documentation -on: [push, pull_request] +on: + push: + paths: ["docs/**", "pyproject.toml", ".github/workflows/*"] + + pull_request: + paths: ["docs/**", "pyproject.toml", ".github/workflows/*"] permissions: contents: read diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 8ff3f108c3e..8466aba6d05 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -1,6 +1,15 @@ name: Fuzz -on: [push, pull_request] +on: + push: + paths-ignore: + - "docs/**" + - "*.md" + + pull_request: + paths-ignore: + - "docs/**" + - "*.md" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} From 0a3eb78bce43e7aebd0a468bd3275f16c2e1fc9f Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:47:57 -0600 Subject: [PATCH 2/9] Run diff-shades compare even if files failed Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- .github/workflows/diff_shades.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/diff_shades.yml b/.github/workflows/diff_shades.yml index 64486a2421f..482a240e7b8 100644 --- a/.github/workflows/diff_shades.yml +++ b/.github/workflows/diff_shades.yml @@ -163,6 +163,7 @@ jobs: compare: name: compare / ${{ matrix.mode }} needs: ["configure", "analysis-base", "analysis-target"] + if: !cancelled() runs-on: ubuntu-latest strategy: fail-fast: false From dade4c6a2dfafbef10c1420236cad0d1d2ae54ec Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:10:06 -0600 Subject: [PATCH 3/9] Remove ignored path now that we format for 3.10 Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4f2c6726492..b8852f6c5e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,6 @@ extend-exclude = ''' # The following are specific to Black, you probably don't want those. tests/data/ | profiling/ - | scripts/generate_schema.py # Uses match syntax ) ''' # We use the unstable style for formatting Black itself. If you From f58b6840b10826210d1b782eb94e74652c6a19f6 Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:10:16 -0600 Subject: [PATCH 4/9] format gallery/gallery.py Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- gallery/gallery.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gallery/gallery.py b/gallery/gallery.py index d7fb3f6441f..ae6a6a9d26f 100755 --- a/gallery/gallery.py +++ b/gallery/gallery.py @@ -103,9 +103,7 @@ def download_and_extract(package: str, version: str | None, directory: Path) -> return directory / result_dir -def get_package( - package: str, version: str | None, directory: Path -) -> Path | None: +def get_package(package: str, version: str | None, directory: Path) -> Path | None: try: return download_and_extract(package, version, directory) except Exception: From 803dcf6924606d67a16f0017233341aeecbf5c52 Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Sun, 16 Nov 2025 21:33:01 -0600 Subject: [PATCH 5/9] Remove some 3.7 code & update docs for removing 3.9 Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- docs/faq.md | 4 ++-- src/black/__init__.py | 11 +---------- tests/test_black.py | 19 +++++++------------ 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index a0316593c43..4f1504c9b25 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -95,8 +95,8 @@ also be removed some time in the future without a deprecation period. `await`/`async` as soft keywords/indentifiers are no longer supported as of 25.9.0. -Runtime support for 3.6 was removed in version 22.10.0, for 3.7 in version 23.7.0, and -for 3.8 in version 24.10.0. +Runtime support for 3.6 was removed in version 22.10.0, for 3.7 in version 23.7.0, +for 3.8 in version 24.10.0, and for 3.9 in version 25.12.0. ## Why does my linter or typechecker complain after I format my code? diff --git a/src/black/__init__.py b/src/black/__init__.py index 0cfed9d5282..92d3fc73c91 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -12,7 +12,7 @@ MutableMapping, Sequence, ) -from contextlib import contextmanager +from contextlib import nullcontext from dataclasses import replace from datetime import datetime, timezone from enum import Enum @@ -1640,15 +1640,6 @@ def assert_stable( ) from None -@contextmanager -def nullcontext() -> Iterator[None]: - """Return an empty context manager. - - To be used like `nullcontext` in Python 3.7. - """ - yield - - def patched_main() -> None: # PyInstaller patches multiprocessing to need freeze_support() even in non-Windows # environments so just assume we always need to call it if frozen. diff --git a/tests/test_black.py b/tests/test_black.py index 9927a126c21..32ed3b27a5c 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -428,9 +428,7 @@ def test_python37(self) -> None: _, source, expected = read_data_from_file(source_path) actual = fs(source) self.assertFormatEqual(expected, actual) - major, minor = sys.version_info[:2] - if major > 3 or (major == 3 and minor >= 7): - black.assert_equivalent(source, actual) + black.assert_equivalent(source, actual) black.assert_stable(source, actual, DEFAULT_MODE) # ensure black can parse this when the target is 3.7 self.invokeBlack([str(source_path), "--target-version", "py37"]) @@ -1758,16 +1756,13 @@ def test_bpo_33660_workaround(self) -> None: if system() == "Windows": return - # https://bugs.python.org/issue33660 - # Can be removed when we drop support for Python 3.8.5 root = Path("/") - with change_directory(root): - path = Path("workspace") / "project" - report = black.Report(verbose=True) - resolves_outside = black.resolves_outside_root_or_cannot_stat( - path, root, report - ) - self.assertIs(resolves_outside, False) + path = Path("workspace") / "project" + report = black.Report(verbose=True) + resolves_outside = black.resolves_outside_root_or_cannot_stat( + path, root, report + ) + self.assertIs(resolves_outside, False) def test_normalize_path_ignore_windows_junctions_outside_of_root(self) -> None: if system() != "Windows": From eb0dbbee7824bc849ef6b25ffb8c6e4021a8003f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 19:31:27 +0000 Subject: [PATCH 6/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/faq.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 4f1504c9b25..d2b49ae35ed 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -95,8 +95,8 @@ also be removed some time in the future without a deprecation period. `await`/`async` as soft keywords/indentifiers are no longer supported as of 25.9.0. -Runtime support for 3.6 was removed in version 22.10.0, for 3.7 in version 23.7.0, -for 3.8 in version 24.10.0, and for 3.9 in version 25.12.0. +Runtime support for 3.6 was removed in version 22.10.0, for 3.7 in version 23.7.0, for +3.8 in version 24.10.0, and for 3.9 in version 25.12.0. ## Why does my linter or typechecker complain after I format my code? From 019036e118c27e1d4b5eb81ed43e81de25ba58b0 Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:32:46 -0600 Subject: [PATCH 7/9] Remove unused import Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- src/black/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/black/__init__.py b/src/black/__init__.py index 92d3fc73c91..4b1cb31ddb8 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -8,7 +8,6 @@ from collections.abc import ( Collection, Generator, - Iterator, MutableMapping, Sequence, ) From af1cfc32dcd71383ce14df629750830f6003f227 Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:02:54 -0600 Subject: [PATCH 8/9] Run workflows on 3.13 Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- .github/workflows/diff_shades.yml | 8 ++++---- .github/workflows/diff_shades_comment.yml | 2 +- .github/workflows/release_tests.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/diff_shades.yml b/.github/workflows/diff_shades.yml index 482a240e7b8..3e3013196ad 100644 --- a/.github/workflows/diff_shades.yml +++ b/.github/workflows/diff_shades.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Install diff-shades and support dependencies run: | @@ -60,7 +60,7 @@ jobs: - uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Install diff-shades run: | @@ -113,7 +113,7 @@ jobs: - uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Install diff-shades run: | @@ -179,7 +179,7 @@ jobs: - uses: actions/setup-python@v6 with: - python-version: "3.11" + python-version: "3.13" - name: Install diff-shades and support dependencies run: | diff --git a/.github/workflows/diff_shades_comment.yml b/.github/workflows/diff_shades_comment.yml index 54d49c7a86e..f282c8a9d4b 100644 --- a/.github/workflows/diff_shades_comment.yml +++ b/.github/workflows/diff_shades_comment.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: - python-version: "*" + python-version: "3.13" - name: Install support dependencies run: | diff --git a/.github/workflows/release_tests.yml b/.github/workflows/release_tests.yml index ae533a9e43f..b0e266ad081 100644 --- a/.github/workflows/release_tests.yml +++ b/.github/workflows/release_tests.yml @@ -25,8 +25,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.13"] - os: [macOS-latest, ubuntu-latest, windows-latest, windows-11-arm] + python-version: ["3.12", "3.13", "3.14"] + os: [macOS-latest, ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f569ff1e03..d22a74ab3de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12.10", "3.13", "3.14", "pypy-3.11"] - os: [ubuntu-latest, macOS-latest, windows-latest, windows-11-arm] + os: [ubuntu-latest, ubuntu-24.04-arm, macOS-latest, windows-latest, windows-11-arm] exclude: # setup-python only supports CPython 3.11+ on arm64 windows - os: windows-11-arm @@ -105,7 +105,7 @@ jobs: - name: Set up latest Python uses: actions/setup-python@v6 with: - python-version: "3.12.4" + python-version: "3.13" - name: Install black with uvloop run: | From c67aa099868f78ee4912f71e786159e2f447a77a Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:07:58 -0600 Subject: [PATCH 9/9] Run workflows on 3.13 Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d22a74ab3de..8ef67737997 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12.10", "3.13", "3.14", "pypy-3.11"] - os: [ubuntu-latest, ubuntu-24.04-arm, macOS-latest, windows-latest, windows-11-arm] + os: [ubuntu-latest, macOS-latest, windows-latest, windows-11-arm] exclude: # setup-python only supports CPython 3.11+ on arm64 windows - os: windows-11-arm