Skip to content

Commit b4d6d86

Browse files
authored
Drop Python 3.8 support (#4452)
1 parent ac018c1 commit b4d6d86

File tree

11 files changed

+23
-27
lines changed

11 files changed

+23
-27
lines changed

.github/workflows/diff_shades.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Install diff-shades and support dependencies
2828
run: |
29-
python -m pip install 'click==8.1.3' packaging urllib3
29+
python -m pip install 'click>=8.1.7' packaging urllib3
3030
python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
3131
3232
- name: Calculate run configuration & metadata
@@ -64,7 +64,7 @@ jobs:
6464
- name: Install diff-shades and support dependencies
6565
run: |
6666
python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
67-
python -m pip install 'click==8.1.3' packaging urllib3
67+
python -m pip install 'click>=8.1.7' packaging urllib3
6868
# After checking out old revisions, this might not exist so we'll use a copy.
6969
cat scripts/diff_shades_gha_helper.py > helper.py
7070
git config user.name "diff-shades-gha"

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.4", "3.13"]
25+
python-version: ["3.9", "3.10", "3.11", "3.12.4", "3.13"]
2626

2727
steps:
2828
- uses: actions/checkout@v4

.github/workflows/pypi_upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
| pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})'
7575
} | pyp 'json.dumps(list(map(json.loads, lines)))' > /tmp/matrix
7676
env:
77-
CIBW_BUILD: "cp38-* cp312-*"
77+
CIBW_BUILD: "cp39-* cp312-*"
7878
CIBW_ARCHS_LINUX: x86_64
7979
- id: set-matrix
8080
run: echo "include=$(cat /tmp/matrix)" | tee -a $GITHUB_OUTPUT

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
fail-fast: false
3333
matrix:
34-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.4", "3.13", "pypy-3.9"]
34+
python-version: ["3.9", "3.10", "3.11", "3.12.4", "3.13", "pypy-3.9"]
3535
os: [ubuntu-latest, macOS-latest, windows-latest]
3636

3737
steps:

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Black will issue an error when used with Python 3.12.5, due to an upstream memory
1414
safety issue in Python 3.12.5 that can cause Black's AST safety checks to fail. Please
1515
use Python 3.12.6 or Python 3.12.4 instead. (#4447)
16+
- Black no longer supports running with Python 3.8 (#4452)
1617

1718
### Stable style
1819

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[tool.black]
99
line-length = 88
10-
target-version = ['py38']
10+
target-version = ['py39']
1111
include = '\.pyi?$'
1212
extend-exclude = '''
1313
/(
@@ -34,7 +34,7 @@ build-backend = "hatchling.build"
3434
name = "black"
3535
description = "The uncompromising code formatter."
3636
license = { text = "MIT" }
37-
requires-python = ">=3.8"
37+
requires-python = ">=3.9"
3838
authors = [
3939
{ name = "Łukasz Langa", email = "[email protected]" },
4040
]
@@ -55,7 +55,6 @@ classifiers = [
5555
"Operating System :: OS Independent",
5656
"Programming Language :: Python",
5757
"Programming Language :: Python :: 3 :: Only",
58-
"Programming Language :: Python :: 3.8",
5958
"Programming Language :: Python :: 3.9",
6059
"Programming Language :: Python :: 3.10",
6160
"Programming Language :: Python :: 3.11",
@@ -152,7 +151,7 @@ options = { debug_level = "0" }
152151
build-verbosity = 1
153152

154153
# So these are the environments we target:
155-
# - Python: CPython 3.8+ only
154+
# - Python: CPython 3.9+ only
156155
# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64
157156
# - OS: Linux (no musl), Windows, and macOS
158157
build = "cp3*"
@@ -232,7 +231,7 @@ branch = true
232231
# Specify the target platform details in config, so your developers are
233232
# free to run mypy on Windows, Linux, or macOS and get consistent
234233
# results.
235-
python_version = "3.8"
234+
python_version = "3.9"
236235
mypy_path = "src"
237236
strict = true
238237
# Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place.

src/black/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ def main( # noqa: C901
549549
"""The uncompromising code formatter."""
550550
ctx.ensure_object(dict)
551551

552+
assert sys.version_info >= (3, 9), "Black requires Python 3.9+"
552553
if sys.version_info[:3] == (3, 12, 5):
553554
out(
554555
"Python 3.12.5 has a memory safety issue that can cause Black's "

src/black/cache.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ def write(self, sources: Iterable[Path]) -> None:
139139
with tempfile.NamedTemporaryFile(
140140
dir=str(self.cache_file.parent), delete=False
141141
) as f:
142-
# We store raw tuples in the cache because pickling NamedTuples
143-
# doesn't work with mypyc on Python 3.8, and because it's faster.
142+
# We store raw tuples in the cache because it's faster.
144143
data: Dict[str, Tuple[float, int, str]] = {
145144
k: (*v,) for k, v in self.file_data.items()
146145
}

src/black/files.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,6 @@ def resolves_outside_root_or_cannot_stat(
272272
root directory. Also returns True if we failed to resolve the path.
273273
"""
274274
try:
275-
if sys.version_info < (3, 8, 6):
276-
path = path.absolute() # https://bugs.python.org/issue33660
277275
resolved_path = _cached_resolve(path)
278276
except OSError as e:
279277
if report:

src/black/schema.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import importlib.resources
22
import json
3-
import sys
43
from typing import Any
54

65

@@ -11,10 +10,6 @@ def get_schema(tool_name: str = "black") -> Any:
1110
pkg = "black.resources"
1211
fname = "black.schema.json"
1312

14-
if sys.version_info < (3, 9):
15-
with importlib.resources.open_text(pkg, fname, encoding="utf-8") as f:
16-
return json.load(f)
17-
18-
schema = importlib.resources.files(pkg).joinpath(fname) # type: ignore[unreachable]
13+
schema = importlib.resources.files(pkg).joinpath(fname)
1914
with schema.open(encoding="utf-8") as f:
2015
return json.load(f)

0 commit comments

Comments
 (0)