Skip to content

Commit 7e50570

Browse files
authored
Merge pull request #2327 from PyCQA/python3.8
Remove support for Python 3.8
2 parents 7a2631e + 064cfd7 commit 7e50570

File tree

13 files changed

+32
-45
lines changed

13 files changed

+32
-45
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
20+
python-version: ["3.9", "3.10", "3.11", "3.12"]
2121
os: [ubuntu-latest, macos-latest, windows-latest]
2222

2323
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ isort is a Python utility / library to sort imports alphabetically and
2323
automatically separate into sections and by type. It provides a command line
2424
utility, Python library and [plugins for various
2525
editors](https://github.com/pycqa/isort/wiki/isort-Plugins) to
26-
quickly sort all your imports. It requires Python 3.8+ to run but
26+
quickly sort all your imports. It requires Python 3.9+ to run but
2727
supports formatting Python 2 code too.
2828

2929
- [Try isort now from your browser!](https://pycqa.github.io/isort/docs/quick_start/0.-try.html)

docs/configuration/black_compatibility.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ language: python
3434
python:
3535
- "3.10"
3636
- "3.9"
37-
- "3.8"
3837

3938
install:
4039
- pip install -r requirements-dev.txt

docs/configuration/github_action.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- uses: actions/checkout@v2
5252
- uses: actions/setup-python@v2
5353
with:
54-
python-version: 3.8
54+
python-version: 3.9
5555
- uses: isort/isort-action@master
5656
with:
5757
requirementsFiles: "requirements.txt requirements-test.txt"

docs/contributing/1.-contributing-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Account Requirements:
1414

1515
Base System Requirements:
1616

17-
- Python3.8+
17+
- Python3.9+
1818
- poetry
1919
- bash or a bash compatible shell (should be auto-installed on Linux / Mac)
2020
- WSL users running Ubuntu may need to install Python's venv module even after installing Python.

isort/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ def _file_output_stream_context(filename: Union[str, Path], source_file: File) -
363363
yield output_stream
364364

365365

366+
# Ignore DeepSource cyclomatic complexity check for this function. It is one
367+
# the main entrypoints so sort of expected to be complex.
368+
# skipcq: PY-R1000
366369
def sort_file(
367370
filename: Union[str, Path],
368371
extension: Optional[str] = None,
@@ -466,12 +469,9 @@ def sort_file(
466469
if not config.quiet:
467470
print(f"Fixing {source_file.path}")
468471
finally:
469-
try: # Python 3.8+: use `missing_ok=True` instead of try except.
470-
if not config.overwrite_in_place: # pragma: no branch
471-
tmp_file = _tmp_file(source_file)
472-
tmp_file.unlink()
473-
except FileNotFoundError:
474-
pass # pragma: no cover
472+
if not config.overwrite_in_place: # pragma: no branch
473+
tmp_file = _tmp_file(source_file)
474+
tmp_file.unlink(missing_ok=True)
475475
else:
476476
changed = sort_stream(
477477
input_stream=source_file.stream,

isort/settings.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,7 @@ class _Config:
252252
def __post_init__(self) -> None:
253253
py_version = self.py_version
254254
if py_version == "auto": # pragma: no cover
255-
if sys.version_info.major == 2 and sys.version_info.minor <= 6:
256-
py_version = "2"
257-
elif sys.version_info.major == 3 and (
258-
sys.version_info.minor <= 5 or sys.version_info.minor >= 12
259-
):
260-
py_version = "3"
261-
else:
262-
py_version = f"{sys.version_info.major}{sys.version_info.minor}"
255+
py_version = f"{sys.version_info.major}{sys.version_info.minor}"
263256

264257
if py_version not in VALID_PY_TARGETS:
265258
raise ValueError(

isort/setuptools_commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from typing import Any, Dict, Iterator, List
55
from warnings import warn
66

7-
import setuptools # type: ignore
7+
import setuptools
88

99
from . import api
1010
from .settings import DEFAULT_CONFIG
1111

1212

13-
class ISortCommand(setuptools.Command): # type: ignore
13+
class ISortCommand(setuptools.Command):
1414
"""The :class:`ISortCommand` class is used by setuptools to perform
1515
imports checks on registered modules.
1616
"""

poetry.lock

Lines changed: 13 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ classifiers = [
2020
"License :: OSI Approved :: MIT License",
2121
"Programming Language :: Python",
2222
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.8",
2423
"Programming Language :: Python :: 3.9",
2524
"Programming Language :: Python :: 3.10",
2625
"Programming Language :: Python :: 3.11",
@@ -40,7 +39,7 @@ include = [
4039
]
4140

4241
[tool.poetry.dependencies]
43-
python = ">=3.8.0"
42+
python = ">=3.9.0"
4443
colorama = {version = ">=0.4.6", optional = true}
4544

4645
[tool.poetry.extras]
@@ -80,7 +79,7 @@ mypy-extensions = ">=0.4.3"
8079
pre-commit = ">=2.13.0"
8180
pytest-benchmark = ">=3.4.1"
8281
toml = ">=0.10.2"
83-
types-pkg-resources = ">=0.1.2"
82+
types-setuptools = ">=70.0.0.20240523"
8483
types-colorama = ">=0.4.2"
8584
types-toml = ">=0.1.3"
8685
vulture = ">=1.0"
@@ -138,7 +137,7 @@ requires = ["poetry-core>=1.0.0"]
138137
build-backend = "poetry.core.masonry.api"
139138

140139
[tool.mypy]
141-
python_version = 3.8
140+
python_version = 3.9
142141
strict = true
143142
follow_imports = "silent"
144143
exclude = "isort/_vendored|tests/unit/example_projects|tests/unit/example_crlf_file.py"

scripts/docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -ux
33

44
result=0
55

6-
for ver in {3.8,3.9,3.10}; do
6+
for ver in {3.9,3.10}; do
77
# latest tag will override after each build, leaving only the newest python version tagged
88
docker build ./ --build-arg VERSION=$ver -t "isort:$ver" -t "isort:latest" && docker run "isort:$ver"
99
result=$(( $? + $result ))

scripts/lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -euxo pipefail
33

44
poetry run cruft check
55
poetry run mypy -p isort -p tests
6-
poetry run black --target-version py38 --check .
6+
poetry run black --target-version py39 --check .
77
poetry run isort --profile hug --check --diff isort/ tests/
88
poetry run isort --profile hug --check --diff example_*/
99
poetry run flake8 isort/ tests/

tests/unit/test_setuptools_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def test_isort_command_smoke(src_dir):
55
"""A basic smoke test for the setuptools_commands command"""
6-
from distutils.dist import Distribution
6+
from setuptools.dist import Distribution
77

88
command = setuptools_commands.ISortCommand(Distribution())
99
command.distribution.packages = ["isort"]

0 commit comments

Comments
 (0)