Skip to content

Commit 07831ee

Browse files
authored
Merge pull request #138 from mdevolde/uv
feat (build_and_publish): moved build and publish script in Makefiles, used uv instead of twine
2 parents f17220b + b37e786 commit 07831ee

File tree

9 files changed

+81
-11
lines changed

9 files changed

+81
-11
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Install dependencies & build package
4040
run: |
41-
uv pip install setuptools wheel build pytest pytest-cov pytest-xdist --system
41+
uv pip install setuptools wheel build pytest pytest-cov pytest-rerunfailures pytest-xdist --system
4242
uv build
4343
uv pip install dist/*.whl --system
4444

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ prune tests/
2020

2121
exclude .gitignore
2222
exclude .readthedocs.yaml
23-
exclude build_and_publish.sh
2423
exclude CONTRIBUTING.md
24+
exclude coverage-badge.svg
2525
exclude make.bat
2626
exclude Makefile
2727
exclude pytest.ini

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.PHONY: default check test doc
1+
.PHONY: default check test doc publish
22

33
default:
4-
@echo "Usage: make [check|test|doc]"
4+
@echo "Usage: make [check|test|doc|publish]"
55
@exit 1
66

77
check:
@@ -14,4 +14,10 @@ test:
1414
uvx --with defusedxml genbadge coverage --input-file coverage.xml --silent
1515
doc:
1616
source ./.venv/bin/activate && uv run sphinx-apidoc -o docs/source/references language_tool_python
17-
source ./.venv/bin/activate && cd ./docs && make html
17+
source ./.venv/bin/activate && cd ./docs && make html
18+
19+
publish:
20+
rm -rf dist/ language_tool_python.egg-info/
21+
uv build
22+
uvx twine check dist/*
23+
uv publish

build_and_publish.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

make.bat

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
if "%1"=="check" goto check
44
if "%1"=="test" goto test
55
if "%1"=="doc" goto doc
6+
if "%1"=="publish" goto publish
67

7-
echo Usage: make.bat [check^|test^|doc]
8+
echo Usage: make.bat [check^|test^|doc^|publish]
89
exit /b 1
910

1011
:check
@@ -19,10 +20,29 @@ exit /b %errorlevel%
1920

2021
:test
2122
pytest
23+
if errorlevel 1 exit /b %errorlevel%
24+
2225
uvx --with defusedxml genbadge coverage --input-file coverage.xml --silent
2326
exit /b %errorlevel%
2427

2528
:doc
2629
uv sync --group tests --group docs --group types
30+
2731
call .venv\Scripts\activate && uv run sphinx-apidoc -o docs\source\references language_tool_python
32+
if errorlevel 1 exit /b %errorlevel%
33+
2834
call .venv\Scripts\activate && call docs\make.bat html
35+
exit /b %errorlevel%
36+
37+
:publish
38+
if exist dist\ rmdir /s /q dist\
39+
if exist language_tool_python.egg-info\ rmdir /s /q language_tool_python.egg-info\
40+
41+
uv build
42+
if errorlevel 1 exit /b %errorlevel%
43+
44+
uvx twine check .\dist\*
45+
if errorlevel 1 exit /b %errorlevel%
46+
47+
uv publish
48+
exit /b %errorlevel%

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ tests = [
4343
"pytest",
4444
"pytest-xdist",
4545
"pytest-cov",
46+
"pytest-rerunfailures",
4647
"pytest-runner"
4748
]
4849

tests/test_api_public.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
"""Tests for the public API functionality."""
22

3+
import os
4+
5+
import pytest
6+
37
from language_tool_python.exceptions import RateLimitError
48

9+
pytestmark = pytest.mark.skipif(
10+
os.getenv("GITHUB_ACTIONS") == "true",
11+
reason="Skip public API test on CI (depends on external service).",
12+
)
13+
514

615
def test_remote_es() -> None:
716
"""

tests/test_match.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
from typing import Any, Dict, List
44

5+
import pytest
56

7+
8+
@pytest.mark.flaky(reruns=2) # type: ignore[misc] # Sometimes LT throws NoClassDefFoundError (500)
69
def test_langtool_load() -> None:
710
"""
811
Test the basic functionality of LanguageTool and Match object attributes.

uv.lock

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)