From 94f63343ef94e86103c5c70ab501bf7aed6555eb Mon Sep 17 00:00:00 2001 From: Typocalypse Date: Thu, 22 Aug 2024 17:13:19 +0000 Subject: [PATCH 1/4] (fix): error message for plugin --- plugin/black.vim | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/plugin/black.vim b/plugin/black.vim index 543184e1cd4..cb8c6cf184a 100644 --- a/plugin/black.vim +++ b/plugin/black.vim @@ -19,16 +19,28 @@ if exists("g:load_black") finish endif -if v:version < 700 || !has('python3') - func! __BLACK_MISSING() - echo "The black.vim plugin requires vim7.0+ with Python 3.6 support." - endfunc - command! Black :call __BLACK_MISSING() - command! BlackUpgrade :call __BLACK_MISSING() - command! BlackVersion :call __BLACK_MISSING() +" check if vim version is too old +if v:version < 700 + echo "The black.vim plugin requires Vim 7.0+." finish endif +" check if Vim has Python 3 support +if !has('python3') + echo "The black.vim plugin requires Vim compiled with Python 3.8+ support." + finish +endif + +" define commands inly if all checks are passed +func! BlackNotSupported() + echo "The black.vim plugin cannot be used with this Vim executable." +endfunc + +command! Black :call BlackNotSupported() +command! BlackUpgrade :call BlackNotSupported() +command! BlackVersion :call BlackNotSupported() + + let g:load_black = "py1.0" if !exists("g:black_virtualenv") if has("nvim") From ac2c9c85d2fb4762a89c50f6ff2da879c8c736c8 Mon Sep 17 00:00:00 2001 From: Typocalypse Date: Fri, 23 Aug 2024 02:07:53 +0000 Subject: [PATCH 2/4] (refactor): define func only if checks fail --- plugin/black.vim | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugin/black.vim b/plugin/black.vim index cb8c6cf184a..813c3235638 100644 --- a/plugin/black.vim +++ b/plugin/black.vim @@ -21,24 +21,24 @@ endif " check if vim version is too old if v:version < 700 - echo "The black.vim plugin requires Vim 7.0+." - finish + func! __BlackNotSupported() + echo "The black.vim plugin requires Vim 7.0+" + endfunc endif " check if Vim has Python 3 support if !has('python3') - echo "The black.vim plugin requires Vim compiled with Python 3.8+ support." - finish + func! __BlackNotSupported() + echo "The black.vim plugin requires Vim compiled with Python 3.8+ support." + endfunc endif -" define commands inly if all checks are passed -func! BlackNotSupported() - echo "The black.vim plugin cannot be used with this Vim executable." -endfunc - -command! Black :call BlackNotSupported() -command! BlackUpgrade :call BlackNotSupported() -command! BlackVersion :call BlackNotSupported() +" Define commands only if __BlackNotSupported is defined +if exists("*__BlackNotSupported") + command! Black :call __BlackNotSupported() + command! BlackUpgrade :call __BlackNotSupported() + command! BlackVersion :call __BlackNotSupported() +endif let g:load_black = "py1.0" From 1a777ca429f9bd553c060549462b3ba230e84b3f Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Mon, 26 Aug 2024 19:07:54 +0200 Subject: [PATCH 3/4] Fully support Python 3.13, including CI testing and wheel building (#4436) --- .github/workflows/fuzz.yml | 3 ++- .github/workflows/pypi_upload.yml | 4 ++-- .github/workflows/release_tests.yml | 2 +- .github/workflows/test.yml | 3 ++- CHANGES.md | 2 ++ pyproject.toml | 1 + 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 42a399fd0aa..b3ea595c318 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -31,6 +31,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install dependencies run: | diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml index 26a2fb4fdc5..7b363d88528 100644 --- a/.github/workflows/pypi_upload.yml +++ b/.github/workflows/pypi_upload.yml @@ -48,7 +48,7 @@ jobs: - uses: actions/checkout@v4 - name: Install cibuildwheel and pypyp run: | - pipx install cibuildwheel==2.19.2 + pipx install cibuildwheel==2.20.0 pipx install pypyp==1 - name: generate matrix if: github.event_name != 'pull_request' @@ -89,7 +89,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: pypa/cibuildwheel@v2.19.2 + - uses: pypa/cibuildwheel@v2.20.0 with: only: ${{ matrix.only }} diff --git a/.github/workflows/release_tests.yml b/.github/workflows/release_tests.yml index 192ba004f81..6d0af004aae 100644 --- a/.github/workflows/release_tests.yml +++ b/.github/workflows/release_tests.yml @@ -25,7 +25,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.12"] + python-version: ["3.13"] os: [macOS-latest, ubuntu-latest, windows-latest] steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb6eb3f1307..036208799fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.9"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9"] os: [ubuntu-latest, macOS-latest, windows-latest] steps: @@ -41,6 +41,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install tox run: | diff --git a/CHANGES.md b/CHANGES.md index af12df0211a..a83a4df0023 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,8 @@ +- Black now officially supports Python 3.13 (#4436) + ### Stable style diff --git a/pyproject.toml b/pyproject.toml index 30e59e107b7..aeab33f8299 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,6 +60,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance", ] From 9d48c4d622c40de691207d1f7b421578a5dbc40a Mon Sep 17 00:00:00 2001 From: Typocalypse Date: Mon, 26 Aug 2024 17:11:03 +0000 Subject: [PATCH 4/4] (chore): improve branching --- plugin/black.vim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugin/black.vim b/plugin/black.vim index 813c3235638..ee178237572 100644 --- a/plugin/black.vim +++ b/plugin/black.vim @@ -19,17 +19,16 @@ if exists("g:load_black") finish endif -" check if vim version is too old +" check if Vim version is too old or Python 3 support is missing if v:version < 700 func! __BlackNotSupported() - echo "The black.vim plugin requires Vim 7.0+" + echo "Vim " . printf("%d.%02d", v:version / 100, v:version % 100) . " is too old." + echo "The black.vim plugin requires Vim 7.0+ with Python 3.8+ support." endfunc -endif - -" check if Vim has Python 3 support -if !has('python3') +elseif !has('python3') func! __BlackNotSupported() - echo "The black.vim plugin requires Vim compiled with Python 3.8+ support." + echo "Python 3 support is not available." + echo "The black.vim plugin requires Vim 7.0+ with Python 3.8+ support." endfunc endif @@ -41,6 +40,7 @@ if exists("*__BlackNotSupported") endif + let g:load_black = "py1.0" if !exists("g:black_virtualenv") if has("nvim")