microsoft/TypeAgent

Public

mirrored fromhttps://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
cfffaac584782c49e9736bfbcee139d1f341b3e0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

python/ta/make.bat

87lines · modecode

1:: Copyright (c) Microsoft Corporation.
2:: Licensed under the MIT License.
3
4:: This is a batch file to run common actions.
5:: It can format the code, check the code, run the tests,
6:: build the package, create a virtual environment, and clean up.
7:: To avoid having to type `./make` all the time,
8:: use `set-alias make ".\make.bat"` in PowerShell.
9
10@echo off
11if "%~1"=="" goto help
12
13if /I "%~1"=="format" goto format
14if /I "%~1"=="check" goto check
15if /I "%~1"=="test" goto test
16if /I "%~1"=="demo" goto demo
17if /I "%~1"=="build" goto build
18if /I "%~1"=="venv" goto venv
19if /I "%~1"=="install-uv" goto install-uv
20if /I "%~1"=="clean" goto clean
21if /I "%~1"=="help" goto help
22
23echo Unknown command: %~1
24goto help
25
26:format
27if not exist ".venv\" call make.bat venv
28echo Formatting code...
29.venv\Scripts\black typeagent test
30goto end
31
32:check
33if not exist ".venv\" call make.bat venv
34echo Running checks...
35.venv\Scripts\pyright --pythonpath .venv\Scripts\python typeagent test
36goto end
37
38:test
39if not exist ".venv\" call make.bat venv
40echo Running tests...
41.venv\Scripts\python -m pytest test
42goto end
43
44:demo
45if not exist ".venv\" call make.bat venv
46echo Running demo...
47.venv\Scripts\python -m tools.utool
48goto end
49
50:build
51if not exist ".venv\" call make.bat venv
52echo Building package...
53.venv\Scripts\python -m build --wheel --installer uv
54goto end
55
56:venv
57echo Creating virtual environment...
58uv sync -q
59.venv\Scripts\python --version
60.venv\Scripts\black --version
61.venv\Scripts\pyright --version
62.venv\Scripts\python -m pytest --version
63goto end
64
65:install-uv
66echo Installing uv requires Administrator mode!
67echo 1. Using PowerShell in Administrator mode:
68echo Invoke-RestMethod https://astral.sh/uv/install.ps1 ^| Invoke-Expression
69echo 2. Add ~/.local/bin to $env:PATH, e.g. by putting
70echo $env:PATH += ";$HOME\.local\bin
71echo in your PowerShell profile ($PROFILE) and restarting PowerShell.
72echo (Sorry, I have no idea how to do that in cmd.exe.)
73goto end
74
75:clean
76if exist build rmdir /s /q build
77if exist dist rmdir /s /q dist
78if exist typeagent.egg-info rmdir /s /q typeagent.egg-info
79if exist .venv rmdir /s /q .venv
80if exist .pytest_cache rmdir /s /q .pytest_cache
81goto end
82
83:help
84echo Usage: .\make [format^|check^|test^|build^|venv^|install-uv^|clean^|help]
85goto end
86
87:end
88