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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Remove support for Python 3.8 #2327

wants to merge 3 commits into from

Conversation

DanielNoord
Copy link
Member

Closes #2307

Deciding to take it a bit slower and merge stuff in smaller chunks.

@matthewhughes934 I cherry picked your change from #2325 as without it poetry lock --no-update doesn't work.
I need some more time to look into the other changes, which I hope to do tomorrow after merging this.

@mayty You mentioned that you couldn't get stuff to work without removing Python 3.8 in #2306 so let's first merge that and worry about Python 3.13 afterwards. That seems like a better procedure :)

Perhaps any of you or @hugovk could have a look at this? :)

Note that I'm taking it slow as some concern was raised in PyCQA/meta#64 that my efforts to merge some PRs might not be welcomed by the original maintainers of the library/package. Therefore I want to make extra sure I don't merge any bugs/issues and only merge stuff that is definitely okay.

DanielNoord and others added 2 commits January 9, 2025 23:48
The inspiration for this change was the following warning from `poetry`:

    Warning: The locked version 0.1.3 for types-pkg-resources is a yanked
    version. Reason for being yanked: Use types-setuptools instead

Following that, adding `types-setuptools` allowed the removal of some
`type: ignore` comments, which then lead to a single issue needing to be
fixed:

    tests/unit/test_setuptools_command.py:8: error: Argument 1 to "ISortCommand" has incompatible type "distutils.dist.Distribution"; expected "setuptools.dist.Distribution"  [arg-type]

Co-authored-by: Matthew Hughes <matthewhughes934@gmail.com>
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.12%. Comparing base (0d43980) to head (9abe8d7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2327      +/-   ##
==========================================
- Coverage   99.12%   99.12%   -0.01%     
==========================================
  Files          39       39              
  Lines        3096     3094       -2     
  Branches      787      787              
==========================================
- Hits         3069     3067       -2     
  Misses         15       15              
  Partials       12       12              

@hugovk
Copy link
Contributor

hugovk commented Jan 10, 2025

Looks good!

Here's a couple more updates we can make:

diff --git a/isort/settings.py b/isort/settings.py
index 7f66dc47..f8bab979 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -252,11 +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
-            ):
+            if sys.version_info.major == 3 and sys.version_info.minor >= 12:
                 py_version = "3"
             else:
                 py_version = f"{sys.version_info.major}{sys.version_info.minor}"
diff --git a/scripts/lint.sh b/scripts/lint.sh
index 3d938a9a..e9118ff0 100755
--- a/scripts/lint.sh
+++ b/scripts/lint.sh
@@ -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/

Perhaps sys.version_info.minor >= 12 should also be sys.version_info.minor >= 13 now? I didn't look up the intent of this check.

Plus we could also run pyupgrade:

pip install pyupgrade
pyupgrade **/**.py --py39-plus

And this will upgrade a lot of typing things, like using dict and tuple directly instead of typing.Dict and typing.Tuple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop Python 3.8 support due to EOL
2 participants