-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathmake.bat
More file actions
82 lines (63 loc) · 2.05 KB
/
make.bat
File metadata and controls
82 lines (63 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@echo off
where uv >nul 2>nul
if errorlevel 1 (
echo uv not found. Install uv to use make.bat targets:
echo powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
exit /b 1
)
if "%1"=="install" goto install
if "%1"=="format" goto format
if "%1"=="fix" goto fix
if "%1"=="ruff-check" goto ruff-check
if "%1"=="mypy-check" goto mypy-check
if "%1"=="check" goto check
if "%1"=="test" goto test
if "%1"=="doc" goto doc
if "%1"=="publish" goto publish
echo Usage: make.bat [install^|format^|fix^|ruff-check^|mypy-check^|check^|test^|doc^|publish]
exit /b 1
:install
uv sync --all-groups --locked
exit /b %errorlevel%
:format
uv run --group quality --locked ruff format language_tool_python tests
exit /b %errorlevel%
:fix
uv run --group quality --locked ruff check --fix language_tool_python tests
exit /b %errorlevel%
:ruff-check
uv run --group quality --locked ruff check language_tool_python tests
if errorlevel 1 exit /b %errorlevel%
uv run --group quality --locked ruff format --check language_tool_python tests
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%
:check
call :ruff-check
if errorlevel 1 exit /b %errorlevel%
call :mypy-check
exit /b %errorlevel%
:test
uv run --group tests --locked pytest
if errorlevel 1 exit /b %errorlevel%
uvx --with defusedxml genbadge coverage --input-file coverage.xml --silent
exit /b %errorlevel%
:doc
call uv run --group docs --locked sphinx-apidoc -o docs\source\references language_tool_python
if errorlevel 1 exit /b %errorlevel%
call uv run --group docs --locked sphinx-build -M html docs/source docs/build
exit /b %errorlevel%
:publish
if exist dist\ rmdir /s /q dist\
uv build
if errorlevel 1 exit /b %errorlevel%
uvx twine check .\dist\*
if errorlevel 1 exit /b %errorlevel%
uv publish
exit /b %errorlevel%