diff --git a/.github/workflows/diff_shades.yml b/.github/workflows/diff_shades.yml index 64486a2421f..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: | @@ -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 @@ -178,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/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 }} 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..8ef67737997 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: | diff --git a/docs/faq.md b/docs/faq.md index a0316593c43..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, 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/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: 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 diff --git a/src/black/__init__.py b/src/black/__init__.py index 0cfed9d5282..4b1cb31ddb8 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -8,11 +8,10 @@ from collections.abc import ( Collection, Generator, - Iterator, 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 +1639,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":