Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ jobs:
strategy:
fail-fast: false
matrix:
# Execute tests on python 3.9-3.14 on ubuntu
# Execute tests on python 3.10-3.15 on ubuntu
# and python 3.14 on macOS and windows
include:
- os: ubuntu-24.04
python-version: "3.9"
- os: ubuntu-24.04
python-version: "3.10"
- os: ubuntu-24.04
Expand All @@ -33,6 +31,8 @@ jobs:
python-version: "3.13"
- os: ubuntu-24.04
python-version: "3.14"
- os: ubuntu-24.04
python-version: "3.15.0-beta.2"
- os: macos-26
python-version: "3.14"
- os: windows-2025
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ ruff-check:
uv run --group quality --locked ruff format --check

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

check:
make ruff-check
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Default local download target: LanguageTool `6.8`.

## Requirements

- Python `>=3.9` (tested up to 3.14)
- Python `>=3.10` (tested up to 3.15)
- Java (to run local LanguageTool server):
- LanguageTool `< 6.6`: Java `>=9`
- LanguageTool `>= 6.6` (default): Java `>=17`
Expand Down
9 changes: 1 addition & 8 deletions language_tool_python/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@
``typing_extensions.deprecated``.
- ``toml_loads``: built-in ``tomllib.loads`` on Python 3.11+, otherwise
``tomli.loads``.
- ``TypeGuard``: built-in ``typing.TypeGuard`` on Python 3.10+, otherwise
``typing_extensions.TypeGuard``.
"""

import sys

if sys.version_info >= (3, 10):
from typing import TypeGuard
else:
from typing_extensions import TypeGuard

if sys.version_info >= (3, 11):
from tomllib import loads as toml_loads
else:
Expand All @@ -27,4 +20,4 @@
else:
from typing_extensions import deprecated

__all__ = ["TypeGuard", "deprecated", "toml_loads"]
__all__ = ["deprecated", "toml_loads"]
2 changes: 1 addition & 1 deletion language_tool_python/api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import TYPE_CHECKING, TypedDict

if TYPE_CHECKING:
from ._compat import TypeGuard
from typing import TypeGuard

__all__ = [
"Category",
Expand Down
5 changes: 2 additions & 3 deletions language_tool_python/config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
from dataclasses import dataclass
from os import PathLike
from pathlib import Path
from typing import TypeVar, Union, cast
from typing import TypeVar, cast

from .exceptions import PathError
from .utils import SupportsBool

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

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions language_tool_python/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from collections import OrderedDict
from collections import OrderedDict as OrderedDictType
from functools import total_ordering
from typing import TYPE_CHECKING, Union
from typing import TYPE_CHECKING

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


def get_match_ordered_dict() -> OrderedDictType[str, type]:
Expand Down
6 changes: 0 additions & 6 deletions make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ uv run --group quality --locked ruff format --check
exit /b %errorlevel%

:mypy-check
uv run --locked python -c "import operator, sys; raise SystemExit(0 if operator.ge(sys.version_info[:2], (3, 10)) else 1)"
if errorlevel 1 (
echo Skipping mypy: Python 3.10 or newer is required.
exit /b 0
)

uv run --group tests --group types --group quality --locked mypy
exit /b %errorlevel%

Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "language_tool_python"
version = "3.4.0" # Keep in sync with docs/source/conf.py
requires-python = ">=3.9"
requires-python = ">=3.10"
description = "Checks grammar using LanguageTool."
readme = { file = "README.md", content-type = "text/markdown" }
license = "GPL-3.0-only"
Expand All @@ -14,12 +14,12 @@ maintainers = [
]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Linguistic",
Expand All @@ -32,9 +32,7 @@ dependencies = [
"packaging",
"psutil",
"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
# needed for py < 3.13 because warnings.deprecated added in 3.13 is used in the codebase
# 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
"typing_extensions; python_version < '3.13'",
"typing_extensions; python_version < '3.13'", # only needed for py < 3.13 because warnings.deprecated added in 3.13 is used in the codebase
]

[project.urls]
Expand Down Expand Up @@ -62,7 +60,7 @@ types = [

quality = [
# Keep in sync mypy version with .pre-commit-config.yaml
"mypy==2.1.0; python_version >= '3.10'", # mypy checks must be run with Python >= 3.10
"mypy==2.1.0",
# Keep in sync ruff version with .pre-commit-config.yaml
"ruff==0.15.16",
]
Expand Down
Loading
Loading