Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for Python 3.8 #2327

Merged
merged 5 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ isort is a Python utility / library to sort imports alphabetically and
automatically separate into sections and by type. It provides a command line
utility, Python library and [plugins for various
editors](https://github.com/pycqa/isort/wiki/isort-Plugins) to
quickly sort all your imports. It requires Python 3.8+ to run but
quickly sort all your imports. It requires Python 3.9+ to run but
supports formatting Python 2 code too.

- [Try isort now from your browser!](https://pycqa.github.io/isort/docs/quick_start/0.-try.html)
Expand Down
1 change: 0 additions & 1 deletion docs/configuration/black_compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ language: python
python:
- "3.10"
- "3.9"
- "3.8"

install:
- pip install -r requirements-dev.txt
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/github_action.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- uses: isort/isort-action@master
with:
requirementsFiles: "requirements.txt requirements-test.txt"
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/1.-contributing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Account Requirements:

Base System Requirements:

- Python3.8+
- Python3.9+
- poetry
- bash or a bash compatible shell (should be auto-installed on Linux / Mac)
- WSL users running Ubuntu may need to install Python's venv module even after installing Python.
Expand Down
12 changes: 6 additions & 6 deletions isort/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ def _file_output_stream_context(filename: Union[str, Path], source_file: File) -
yield output_stream


# Ignore DeepSource cyclomatic complexity check for this function. It is one
# the main entrypoints so sort of expected to be complex.
# skipcq: PY-R1000
def sort_file(
filename: Union[str, Path],
extension: Optional[str] = None,
Expand Down Expand Up @@ -466,12 +469,9 @@ def sort_file(
if not config.quiet:
print(f"Fixing {source_file.path}")
finally:
try: # Python 3.8+: use `missing_ok=True` instead of try except.
if not config.overwrite_in_place: # pragma: no branch
tmp_file = _tmp_file(source_file)
tmp_file.unlink()
except FileNotFoundError:
pass # pragma: no cover
if not config.overwrite_in_place: # pragma: no branch
tmp_file = _tmp_file(source_file)
tmp_file.unlink(missing_ok=True)
else:
changed = sort_stream(
input_stream=source_file.stream,
Expand Down
9 changes: 1 addition & 8 deletions isort/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,7 @@ class _Config:
def __post_init__(self) -> None:
py_version = self.py_version
if py_version == "auto": # pragma: no cover
if sys.version_info.major == 2 and sys.version_info.minor <= 6:
py_version = "2"
elif sys.version_info.major == 3 and (
sys.version_info.minor <= 5 or sys.version_info.minor >= 12
):
py_version = "3"
else:
py_version = f"{sys.version_info.major}{sys.version_info.minor}"
py_version = f"{sys.version_info.major}{sys.version_info.minor}"

if py_version not in VALID_PY_TARGETS:
raise ValueError(
Expand Down
4 changes: 2 additions & 2 deletions isort/setuptools_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from typing import Any, Dict, Iterator, List
from warnings import warn

import setuptools # type: ignore
import setuptools

from . import api
from .settings import DEFAULT_CONFIG


class ISortCommand(setuptools.Command): # type: ignore
class ISortCommand(setuptools.Command):
"""The :class:`ISortCommand` class is used by setuptools to perform
imports checks on registered modules.
"""
Expand Down
30 changes: 13 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -40,7 +39,7 @@ include = [
]

[tool.poetry.dependencies]
python = ">=3.8.0"
python = ">=3.9.0"
colorama = {version = ">=0.4.6", optional = true}

[tool.poetry.extras]
Expand Down Expand Up @@ -80,7 +79,7 @@ mypy-extensions = ">=0.4.3"
pre-commit = ">=2.13.0"
pytest-benchmark = ">=3.4.1"
toml = ">=0.10.2"
types-pkg-resources = ">=0.1.2"
types-setuptools = ">=70.0.0.20240523"
types-colorama = ">=0.4.2"
types-toml = ">=0.1.3"
vulture = ">=1.0"
Expand Down Expand Up @@ -138,7 +137,7 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.mypy]
python_version = 3.8
python_version = 3.9
strict = true
follow_imports = "silent"
exclude = "isort/_vendored|tests/unit/example_projects|tests/unit/example_crlf_file.py"
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -ux

result=0

for ver in {3.8,3.9,3.10}; do
for ver in {3.9,3.10}; do
# latest tag will override after each build, leaving only the newest python version tagged
docker build ./ --build-arg VERSION=$ver -t "isort:$ver" -t "isort:latest" && docker run "isort:$ver"
result=$(( $? + $result ))
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euxo pipefail

poetry run cruft check
poetry run mypy -p isort -p tests
poetry run black --target-version py38 --check .
poetry run black --target-version py39 --check .
poetry run isort --profile hug --check --diff isort/ tests/
poetry run isort --profile hug --check --diff example_*/
poetry run flake8 isort/ tests/
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_setuptools_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

def test_isort_command_smoke(src_dir):
"""A basic smoke test for the setuptools_commands command"""
from distutils.dist import Distribution
from setuptools.dist import Distribution

command = setuptools_commands.ISortCommand(Distribution())
command.distribution.packages = ["isort"]
Expand Down
Loading