-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathmake.bat
More file actions
94 lines (79 loc) · 2.38 KB
/
make.bat
File metadata and controls
94 lines (79 loc) · 2.38 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
83
84
85
86
87
88
89
90
91
92
93
94
:: Copyright (c) Microsoft Corporation.
:: Licensed under the MIT License.
:: This is a batch file to run common actions.
:: It can format the code, check the code, run the tests,
:: build the package, create a virtual environment, and clean up.
:: To avoid having to type `./make` all the time,
:: use `set-alias make ".\make.bat"` in PowerShell.
@echo off
if "%~1"=="" goto help
if /I "%~1"=="format" goto format
if /I "%~1"=="check" goto check
if /I "%~1"=="test" goto test
if /I "%~1"=="demo" goto demo
if /I "%~1"=="build" goto build
if /I "%~1"=="venv" goto venv
if /I "%~1"=="sync" goto sync
if /I "%~1"=="install-uv" goto install-uv
if /I "%~1"=="clean" goto clean
if /I "%~1"=="help" goto help
echo Unknown command: %~1
goto help
:format
if not exist ".venv\" call make.bat venv
echo Formatting code...
.venv\Scripts\isort src tests tools examples
.venv\Scripts\black src tests tools examples
goto end
:check
if not exist ".venv\" call make.bat venv
echo Running type checks...
.venv\Scripts\pyright --pythonpath .venv\Scripts\python src tests tools examples
goto end
:test
if not exist ".venv\" call make.bat venv
echo Running unit tests...
.venv\Scripts\python -m pytest
goto end
:demo
if not exist ".venv\" call make.bat venv
echo Running query tool...
.venv\Scripts\python -m tools.query
goto end
:build
if not exist ".venv\" call make.bat venv
echo Building package...
uv build
goto end
:venv
echo Creating virtual environment...
uv sync -q
.venv\Scripts\python --version
.venv\Scripts\black --version
.venv\Scripts\pyright --version
.venv\Scripts\python -m pytest --version
goto end
:sync
uv sync
goto end
:install-uv
echo Installing uv requires Administrator mode!
echo 1. Using PowerShell in Administrator mode:
echo Invoke-RestMethod https://astral.sh/uv/install.ps1 ^| Invoke-Expression
echo 2. Add ~/.local/bin to $env:PATH, e.g. by putting
echo $env:PATH += ";$HOME\.local\bin
echo in your PowerShell profile ($PROFILE) and restarting PowerShell.
echo (Sorry, I have no idea how to do that in cmd.exe.)
goto end
:clean
echo Cleaning out build and dev artifacts...
if exist build rmdir /s /q build
if exist dist rmdir /s /q dist
if exist typeagent.egg-info rmdir /s /q typeagent.egg-info
if exist .venv rmdir /s /q .venv
if exist .pytest_cache rmdir /s /q .pytest_cache
goto end
:help
echo Usage: .\make [format^|check^|test^|build^|venv^|sync^|install-uv^|clean^|help]
goto end
:end