Skip to content

Commit

Permalink
Merge pull request #754 from akaihola/drop-py38
Browse files Browse the repository at this point in the history
Drop support for Python 3.8
  • Loading branch information
akaihola authored Jan 7, 2025
2 parents 0f459f6 + c3e6598 commit ef39771
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 30 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ jobs:
- windows-latest
- macos-latest
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
Expand All @@ -105,7 +104,7 @@ jobs:
python-version: '3.13-dev'
include:
- os: ubuntu-latest
python-version: '3.8'
python-version: '3.9'
constraints: '--constraint constraints-oldest.txt'
- os: ubuntu-latest
python-version: '3.12'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pyupgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
from pyupgrade._main import main
from glob import glob
files = glob('**/*.py', recursive=True)
sys.exit(main(files + ['--py38-plus']))
sys.exit(main(files + ['--py39-plus']))
" || ( git diff ; false )
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ An example ``pyproject.toml`` configuration file:
line-length = 88 # Overridden by [tool.darker] above
skip-magic-trailing-comma = false
skip-string-normalization = false
target-version = ["py38", "py39", "py310", "py311", "py312"] # Overridden above
target-version = ["py39", "py310", "py311", "py312"] # Overridden above
exclude = "test_*\.py"
extend_exclude = "/generated/"
force_exclude = ".*\.pyi"
Expand Down
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = ["setuptools", "wheel"] # PEP 508 specifications.
# Darker makes Black read its configuration from the file indicated by the `--config`
# option, so we need to mirror the same configuration here and in `check-darker.toml`.
skip-string-normalization = false
target-version = ["py38", "py39", "py310", "py311", "py312"]
target-version = ["py39", "py310", "py311", "py312"]

[tool.isort]
# Darker makes isort read its configuration from the file indicated by the `--config`
Expand Down Expand Up @@ -37,7 +37,7 @@ src = ["."]
disable = ["wrong-import-order"]

[tool.ruff]
target-version = "py38"
target-version = "py39"

[tool.ruff.lint]
select = ["ALL"]
Expand All @@ -47,10 +47,6 @@ ignore = [
"D203", # One blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D400", # First line should end with a period (duplicates D415)

# Remove these when support for Python 3.8 is dropped:
"UP006", # Use `xyz` instead of `Xyz` for type annotation
"UP007", # Use `X | Y` for type annotations
]

[tool.ruff.lint.per-file-ignores]
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ description = Apply Black formatting only in regions changed since last commit
long_description_content_type = text/x-rst
classifiers =
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Expand All @@ -33,7 +32,7 @@ install_requires =
typing_extensions>=4.0.1
# NOTE: remember to keep `.github/workflows/python-package.yml` in sync
# with the minimum required Python version
python_requires = >=3.8
python_requires = >=3.9

[options.packages.find]
where = src
Expand Down
21 changes: 3 additions & 18 deletions src/darker/concurrency.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
"""Concurrency helpers for enhancing the performance of Darker"""

import sys
from concurrent.futures import Executor, Future, ProcessPoolExecutor
from typing import Any, Callable, Generic, TypeVar, cast
from typing import Any, Callable, TypeVar

T = TypeVar("T") # pylint: disable=invalid-name

if sys.version_info < (3, 9):

class FutureType(Generic[T]):
"""For Python <3.9 compatibility"""

def set_exception(self, exc_info: BaseException) -> None:
"Dummy method for typing"

def set_result(self, result: Any) -> None:
"Dummy method for typing"

else:
FutureType = Future


class DummyExecutor(Executor):
"""Dummy synchronous executor to use with ``--workers=1``
Expand All @@ -31,7 +16,7 @@ class DummyExecutor(Executor):
# pylint: disable=arguments-differ,unsubscriptable-object,broad-except
def submit( # type: ignore[override]
self, fn: Callable[..., T], *args: Any, **kwargs: Any
) -> FutureType[T]:
) -> Future[T]:
"""Submits "a callable to be executed with the given arguments.
Executes the callable immediately as ``fn(*args, **kwargs)`` and returns a
Expand All @@ -43,7 +28,7 @@ def submit( # type: ignore[override]
:return: A `Future` representing the given call
"""
future = cast(FutureType[T], Future())
future: Future[T] = Future()
try:
result = fn(*args, **kwargs)
except BaseException as exc_info: # noqa: B036
Expand Down

0 comments on commit ef39771

Please sign in to comment.