Skip to content

Commit

Permalink
Clean up Python 3.8 remnants (#4473)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Oct 9, 2024
1 parent 1b2427a commit 32ebb93
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Try it out now using the [Black Playground](https://black.vercel.app). Watch the

### Installation

_Black_ can be installed by running `pip install black`. It requires Python 3.8+ to run.
_Black_ can be installed by running `pip install black`. It requires Python 3.9+ to run.
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.

If you can't wait for the latest _hotness_ and want to install from GitHub, use:
Expand Down
2 changes: 1 addition & 1 deletion autoload/black.vim
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _initialize_black_env(upgrade=False):

pyver = sys.version_info[:3]
if pyver < (3, 8):
print("Sorry, Black requires Python 3.8+ to run.")
print("Sorry, Black requires Python 3.9+ to run.")
return False

from pathlib import Path
Expand Down
11 changes: 6 additions & 5 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,17 @@ See [Using _Black_ with other tools](labels/why-pycodestyle-warnings).

## Which Python versions does Black support?

Currently the runtime requires Python 3.8-3.11. Formatting is supported for files
containing syntax from Python 3.3 to 3.11. We promise to support at least all Python
versions that have not reached their end of life. This is the case for both running
_Black_ and formatting code.
_Black_ generally supports all Python versions supported by CPython (see
[the Python devguide](https://devguide.python.org/versions/) for current information).
We promise to support at least all Python versions that have not reached their end of
life. This is the case for both running _Black_ and formatting code.

Support for formatting Python 2 code was removed in version 22.0. While we've made no
plans to stop supporting older Python 3 minor versions immediately, their support might
also be removed some time in the future without a deprecation period.

Runtime support for 3.7 was removed in version 23.7.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.

## Why does my linter or typechecker complain after I format my code?

Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Also, you can try out _Black_ online for minimal fuss on the

## Installation

_Black_ can be installed by running `pip install black`. It requires Python 3.8+ to run.
_Black_ can be installed by running `pip install black`. It requires Python 3.9+ to run.
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.

If you use pipx, you can install Black with `pipx install black`.
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Configuration:

#### Installation

This plugin **requires Vim 7.0+ built with Python 3.8+ support**. It needs Python 3.8 to
This plugin **requires Vim 7.0+ built with Python 3.9+ support**. It needs Python 3.9 to
be able to run _Black_ inside the Vim process which is much faster than calling an
external command.

Expand Down
8 changes: 4 additions & 4 deletions docs/usage_and_configuration/the_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ See also [the style documentation](labels/line-length).

Python versions that should be supported by Black's output. You can run `black --help`
and look for the `--target-version` option to see the full list of supported versions.
You should include all versions that your code supports. If you support Python 3.8
through 3.11, you should write:
You should include all versions that your code supports. If you support Python 3.11
through 3.13, you should write:

```console
$ black -t py38 -t py39 -t py310 -t py311
$ black -t py311 -t py312 -t py313
```

In a [configuration file](#configuration-via-a-file), you can write:

```toml
target-version = ["py38", "py39", "py310", "py311"]
target-version = ["py311", "py312", "py313"]
```

By default, Black will infer target versions from the project metadata in
Expand Down
9 changes: 4 additions & 5 deletions plugin/black.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif

if v:version < 700 || !has('python3')
func! __BLACK_MISSING()
echo "The black.vim plugin requires vim7.0+ with Python 3.6 support."
echo "The black.vim plugin requires vim7.0+ with Python 3.9 support."
endfunc
command! Black :call __BLACK_MISSING()
command! BlackUpgrade :call __BLACK_MISSING()
Expand Down Expand Up @@ -72,12 +72,11 @@ endif

function BlackComplete(ArgLead, CmdLine, CursorPos)
return [
\ 'target_version=py27',
\ 'target_version=py36',
\ 'target_version=py37',
\ 'target_version=py38',
\ 'target_version=py39',
\ 'target_version=py310',
\ 'target_version=py311',
\ 'target_version=py312',
\ 'target_version=py313',
\ ]
endfunction

Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/context_managers_38.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.8
with \
make_context_manager1() as cm1, \
make_context_manager2() as cm2, \
Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/context_managers_39.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.9
with \
make_context_manager1() as cm1, \
make_context_manager2() as cm2, \
Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/context_managers_autodetect_39.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.9
# This file uses parenthesized context managers introduced in Python 3.9.


Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/pep_570.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.8
def positional_only_arg(a, /):
pass

Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/pep_572.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.8
(a := 1)
(a := a)
if (match := pattern.search(data)) is None:
Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/pep_572_py39.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.9
# Unparenthesized walruses are now allowed in set literals & set comprehensions
# since Python 3.9
{x := 1, 2, 3}
Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/pep_572_remove_parens.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.8
if (foo := 0):
pass

Expand Down
3 changes: 0 additions & 3 deletions tests/data/cases/python37.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# flags: --minimum-version=3.7


def f():
return (i * 2 async for i in arange(42))

Expand Down
3 changes: 0 additions & 3 deletions tests/data/cases/python38.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# flags: --minimum-version=3.8


def starred_return():
my_list = ["value2", "value3"]
return "value1", *my_list
Expand Down
2 changes: 0 additions & 2 deletions tests/data/cases/python39.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flags: --minimum-version=3.9

@relaxed_decorator[0]
def f():
...
Expand Down
1 change: 0 additions & 1 deletion tests/data/cases/remove_with_brackets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flags: --minimum-version=3.9
with (open("bla.txt")):
pass

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
isolated_build = true
envlist = {,ci-}py{38,39,310,311,py3},fuzz,run_self,generate_schema
envlist = {,ci-}py{39,310,311,312,313,py3},fuzz,run_self,generate_schema

[testenv]
setenv =
Expand Down

0 comments on commit 32ebb93

Please sign in to comment.