-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.bat
39 lines (34 loc) · 1.07 KB
/
setup.bat
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
@echo off
setlocal enabledelayedexpansion
:: Check for Python in PATH first
where python >nul 2>&1
if %ERRORLEVEL% equ 0 (
for /f "tokens=*" %%i in ('python -V 2^>^&1') do set "PYTHON_VERSION=%%i"
echo Found %PYTHON_VERSION%
set "PYTHON=python"
goto :setup
)
:: If not in PATH, check WindowsApps directory
for /f "tokens=*" %%i in ('dir /b /ad "%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\Python*" 2^>nul') do (
set "PYTHON=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\%%i\python.exe"
if exist "!PYTHON!" (
for /f "tokens=*" %%v in ('"!PYTHON!" -V 2^>^&1') do set "PYTHON_VERSION=%%v"
echo Found %PYTHON_VERSION%
goto :setup
)
)
echo Python not found
exit /b 1
:setup
:: Create and set up the virtual environment
"%PYTHON%" -m venv venv
:: Activate virtual environment and run commands
call venv\Scripts\activate.bat
python -m pip install uv
python -m uv clean
python -m uv pip install --upgrade pip
python -m uv pip install wheel
python -m uv pip install -r requirements.txt
pre-commit install
deactivate
echo Setup complete.