forked from rte-france/pallas-slenderpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_uvenv.ps1
More file actions
48 lines (39 loc) · 1.43 KB
/
create_uvenv.ps1
File metadata and controls
48 lines (39 loc) · 1.43 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
# -- env name
$DEF_NAME = "pallas-slenderpy-uv"
# $PYTHON_VERSION = "--python-preference=system"
# $PYTHON_VERSION = "--python 3.11"
# $PYTHON_VERSION="--python 3.11"
# $PYTHON_VERSION="--python 3.12"
# $PYTHON_VERSION="--python 3.13"
$PYTHON_VERSION="--python 3.14"
# -----------------------------------------------------------------------------
# -- dir for all envs
$ENV_DIR = "$HOME\ENV"
if (-not (Test-Path $ENV_DIR)) {
New-Item -ItemType Directory -Path $ENV_DIR | Out-Null
}
# -- check uv install, update if necessary
if (-not (Get-Command uv -ErrorAction SilentlyContinue)) {
Write-Host "uv not found; installing ..." -ForegroundColor Cyan
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
} else {
uv self update
Write-Host "uv already installed ($((uv --version)))" -ForegroundColor Green
}
# -- setup uv env
$VENV_PATH = Join-Path $ENV_DIR $DEF_NAME
Invoke-Expression "uv venv --clear $VENV_PATH $PYTHON_VERSION"
# -- env activation
. "$VENV_PATH\Scripts\Activate.ps1"
# -- upgrade pip
uv pip install --upgrade pip
# -- install local package
if (Test-Path "build") { Remove-Item -Recurse -Force "build" }
uv pip install .[examples,dev]
# -- end text
Write-Host "---"
Write-Host "to start the environment, type :"
Write-Host ". $VENV_PATH\Scripts\Activate.ps1" -ForegroundColor Yellow
Write-Host ""
Write-Host "to stop the environment, type :"
Write-Host "deactivate" -ForegroundColor Yellow