Skip to content

Commit 1b58d3a

Browse files
committed
feat: update CI, fix POSIX locale compatibility
- integrated UV and modernized CI actions - added python 3.12, 3.13, 3.14 to CI - handled 'C' and 'POSIX' locales as English fallback - updated license metadata (PEP 639) - fixed inexistant file in MANIFEST.in
1 parent 5eac429 commit 1b58d3a

File tree

4 files changed

+48
-29
lines changed

4 files changed

+48
-29
lines changed

.github/workflows/test.yml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,75 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Test with PyTest
4+
name: language_tool_python CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [ master, test_pipeline ]
99
pull_request:
1010
branches: [ master ]
1111

1212
jobs:
13-
build:
14-
15-
runs-on: ubuntu-22.04
13+
tests:
14+
name: Test on Python ${{ matrix.python-version }}
15+
runs-on: ubuntu-latest
1616
strategy:
17+
fail-fast: false
1718
matrix:
18-
python-version: ["3.9", "3.10", "3.11"]
19+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1920

2021
steps:
21-
- uses: actions/checkout@v2
22+
- name: Clone repository
23+
uses: actions/checkout@v5
2224

2325
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v4
26+
uses: actions/setup-python@v6
2527
with:
2628
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v7
2732

28-
- name: Set up JDK 21
29-
uses: actions/setup-java@v3
33+
- name: Set up JDK 25
34+
uses: actions/setup-java@v5
3035
with:
3136
distribution: 'temurin'
32-
java-version: '21'
33-
34-
- name: Create and activate virtualenv
35-
run: |
36-
python -m venv venv
37-
source venv/bin/activate
38-
python -m pip install --upgrade pip
37+
java-version: '25'
3938

40-
- name: Install dependencies
39+
- name: Install dependencies & build package
4140
run: |
42-
source venv/bin/activate
43-
pip install setuptools wheel build pytest pytest-xdist
44-
python -m build --sdist --wheel
45-
pip install dist/*.whl
41+
uv pip install setuptools wheel build pytest pytest-xdist --system
42+
uv build
43+
uv pip install dist/*.whl --system
4644
4745
- name: Verify installed packages
4846
run: |
49-
source venv/bin/activate
50-
pip list
47+
uv pip list
5148
5249
- name: Import language_tool_python
5350
run: |
54-
source venv/bin/activate
5551
printf "import language_tool_python\n" | python
5652
5753
- name: Test with pytest
5854
run: |
59-
source venv/bin/activate
6055
pytest -vx --dist=loadfile -n auto
6156
6257
- name: Run additional tests in bash scripts for Ubuntu
6358
run: |
64-
source venv/bin/activate
6559
bash tests/test_local.bash
6660
bash tests/test_remote.bash
61+
62+
lint:
63+
name: Lint with Ruff
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Clone repository
67+
uses: actions/checkout@v5
68+
69+
- name: Install uv
70+
uses: astral-sh/setup-uv@v7
71+
72+
- name: Run Ruff Linter
73+
run: |
74+
uvx ruff check .
75+
uvx ruff format --check .

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
include run_doctest.py
21
include tests/test_local.bash
32
include tests/test_remote.bash
43
prune pytest-cache-files-*/

language_tool_python/language_tag.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ def _normalize(self, tag: str) -> str:
8787
languages = {
8888
language.lower().replace("-", "_"): language for language in self.languages
8989
}
90+
91+
# If POSIX, default to English variants
92+
if tag.lower() in {"c", "posix"} or tag.lower().startswith("c."):
93+
for candidate in ("en_us", "en_gb", "en"):
94+
if candidate in languages:
95+
return languages[candidate]
96+
raise ValueError(
97+
f"unsupported language (no default for POSIX locale): {tag!r}"
98+
)
99+
90100
try:
91101
return languages[tag.lower().replace("-", "_")]
92102
except KeyError:

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ version = "2.9.5"
44
requires-python = ">=3.9"
55
description = "Checks grammar using LanguageTool."
66
readme = { file = "README.md", content-type = "text/markdown" }
7-
license = { file = "LICENSE" }
7+
license = "GPL-3.0-only"
8+
license-files = ["LICENSE"]
89
authors = [
910
{ name = "Jack Morris", email = "jxmorris12@gmail.com" }
1011
]

0 commit comments

Comments
 (0)