Skip to content

Commit 842a9e4

Browse files
authored
chore: stop support py3.9, now support py3.10-3.15 (jxmorris12#182)
1 parent 40897f1 commit 842a9e4

10 files changed

Lines changed: 75 additions & 509 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
# Execute tests on python 3.9-3.14 on ubuntu
21+
# Execute tests on python 3.10-3.15 on ubuntu
2222
# and python 3.14 on macOS and windows
2323
include:
24-
- os: ubuntu-24.04
25-
python-version: "3.9"
2624
- os: ubuntu-24.04
2725
python-version: "3.10"
2826
- os: ubuntu-24.04
@@ -33,6 +31,8 @@ jobs:
3331
python-version: "3.13"
3432
- os: ubuntu-24.04
3533
python-version: "3.14"
34+
- os: ubuntu-24.04
35+
python-version: "3.15.0-beta.2"
3636
- os: macos-26
3737
python-version: "3.14"
3838
- os: windows-2025

‎Makefile‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ ruff-check:
2323
uv run --group quality --locked ruff format --check
2424

2525
mypy-check:
26-
@if uv run --locked python -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 1)'; then \
27-
uv run --group tests --group types --group quality --locked mypy; \
28-
else \
29-
echo "Skipping mypy: Python 3.10 or newer is required."; \
30-
fi
26+
uv run --group tests --group types --group quality --locked mypy
3127

3228
check:
3329
make ruff-check

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Default local download target: LanguageTool `6.8`.
2626

2727
## Requirements
2828

29-
- Python `>=3.9` (tested up to 3.14)
29+
- Python `>=3.10` (tested up to 3.15)
3030
- Java (to run local LanguageTool server):
3131
- LanguageTool `< 6.6`: Java `>=9`
3232
- LanguageTool `>= 6.6` (default): Java `>=17`

‎language_tool_python/_compat.py‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@
66
``typing_extensions.deprecated``.
77
- ``toml_loads``: built-in ``tomllib.loads`` on Python 3.11+, otherwise
88
``tomli.loads``.
9-
- ``TypeGuard``: built-in ``typing.TypeGuard`` on Python 3.10+, otherwise
10-
``typing_extensions.TypeGuard``.
119
"""
1210

1311
import sys
1412

15-
if sys.version_info >= (3, 10):
16-
from typing import TypeGuard
17-
else:
18-
from typing_extensions import TypeGuard
19-
2013
if sys.version_info >= (3, 11):
2114
from tomllib import loads as toml_loads
2215
else:
@@ -27,4 +20,4 @@
2720
else:
2821
from typing_extensions import deprecated
2922

30-
__all__ = ["TypeGuard", "deprecated", "toml_loads"]
23+
__all__ = ["deprecated", "toml_loads"]

‎language_tool_python/api_types.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import TYPE_CHECKING, TypedDict
66

77
if TYPE_CHECKING:
8-
from ._compat import TypeGuard
8+
from typing import TypeGuard
99

1010
__all__ = [
1111
"Category",

‎language_tool_python/config_file.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
from dataclasses import dataclass
1010
from os import PathLike
1111
from pathlib import Path
12-
from typing import TypeVar, Union, cast
12+
from typing import TypeVar, cast
1313

1414
from .exceptions import PathError
1515
from .utils import SupportsBool
1616

17-
# Union here because | not supported by PathLike in py3.9
18-
ConfigValue = Union[PathLike[str], SupportsBool, str, int, float, Iterable[str]]
17+
ConfigValue = PathLike[str] | SupportsBool | str | int | float | Iterable[str]
1918
ConfigValueT = TypeVar("ConfigValueT", bound=ConfigValue)
2019

2120
logger = logging.getLogger(__name__)

‎language_tool_python/match.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections import OrderedDict
88
from collections import OrderedDict as OrderedDictType
99
from functools import total_ordering
10-
from typing import TYPE_CHECKING, Union
10+
from typing import TYPE_CHECKING
1111

1212
from ._compat import deprecated
1313
from .utils import SupportsFloat, SupportsInt
@@ -22,7 +22,7 @@
2222
UTF8_4_BYTE_LENGTH = 4
2323
CONTEXT_PREFIX_SUFFIX_LENGTH = 3
2424
CONTEXT_WITH_ADDITIONS_MIN_LENGTH = 6
25-
MatchValue = Union[str, int, list[str]] # | operator not fully supported by py3.9
25+
MatchValue = str | int | list[str]
2626

2727

2828
def get_match_ordered_dict() -> OrderedDictType[str, type]:

‎make.bat‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ uv run --group quality --locked ruff format --check
4040
exit /b %errorlevel%
4141

4242
:mypy-check
43-
uv run --locked python -c "import operator, sys; raise SystemExit(0 if operator.ge(sys.version_info[:2], (3, 10)) else 1)"
44-
if errorlevel 1 (
45-
echo Skipping mypy: Python 3.10 or newer is required.
46-
exit /b 0
47-
)
48-
4943
uv run --group tests --group types --group quality --locked mypy
5044
exit /b %errorlevel%
5145

‎pyproject.toml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "language_tool_python"
33
version = "3.4.0" # Keep in sync with docs/source/conf.py
4-
requires-python = ">=3.9"
4+
requires-python = ">=3.10"
55
description = "Checks grammar using LanguageTool."
66
readme = { file = "README.md", content-type = "text/markdown" }
77
license = "GPL-3.0-only"
@@ -14,12 +14,12 @@ maintainers = [
1414
]
1515
classifiers = [
1616
"Programming Language :: Python :: 3",
17-
"Programming Language :: Python :: 3.9",
1817
"Programming Language :: Python :: 3.10",
1918
"Programming Language :: Python :: 3.11",
2019
"Programming Language :: Python :: 3.12",
2120
"Programming Language :: Python :: 3.13",
2221
"Programming Language :: Python :: 3.14",
22+
"Programming Language :: Python :: 3.15",
2323
"Operating System :: OS Independent",
2424
"Topic :: Software Development :: Libraries :: Python Modules",
2525
"Topic :: Text Processing :: Linguistic",
@@ -32,9 +32,7 @@ dependencies = [
3232
"packaging",
3333
"psutil",
3434
"tomli; python_version < '3.11'", # only needed for py < 3.11 because tomllib added in 3.11 is used in the codebase, needs a fallback
35-
# needed for py < 3.13 because warnings.deprecated added in 3.13 is used in the codebase
36-
# also needed for py < 3.10 because of the usage of typing.TypeGuard in the codebase, which is backported to typing_extensions for py < 3.10
37-
"typing_extensions; python_version < '3.13'",
35+
"typing_extensions; python_version < '3.13'", # only needed for py < 3.13 because warnings.deprecated added in 3.13 is used in the codebase
3836
]
3937

4038
[project.urls]
@@ -62,7 +60,7 @@ types = [
6260

6361
quality = [
6462
# Keep in sync mypy version with .pre-commit-config.yaml
65-
"mypy==2.1.0; python_version >= '3.10'", # mypy checks must be run with Python >= 3.10
63+
"mypy==2.1.0",
6664
# Keep in sync ruff version with .pre-commit-config.yaml
6765
"ruff==0.15.16",
6866
]

0 commit comments

Comments
 (0)