Repository navigation
Expand file tree
/
Copy pathmake.ps1
More file actions
91 lines (77 loc) · 2.92 KB
/
Copy pathmake.ps1
File metadata and controls
91 lines (77 loc) · 2.92 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
#!/usr/bin/env pwsh
# Lanceur de taches du projet (equivalent Makefile — `make` n'est pas present sous Windows).
# Usage: .\make.ps1 <target> [args...]
param(
[Parameter(Position = 0)]
[ValidateSet('setup', 'lint', 'fmt', 'test', 'check', 'envs', 'gui', 'clean', 'help')]
[string]$Target = 'help',
[Parameter(Position = 1, ValueFromRemainingArguments = $true)]
[string[]]$Rest
)
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot
function Invoke-Step($Name, [scriptblock]$Body) {
Write-Host "==> $Name" -ForegroundColor Cyan
& $Body
if ($LASTEXITCODE -ne 0) { throw "$Name a echoue (exit $LASTEXITCODE)" }
}
switch ($Target) {
'setup' {
Invoke-Step 'sync env racine' { uv sync --all-extras --group dev }
Write-Host "OK. Verifie avec: .\make.ps1 check" -ForegroundColor Green
}
'lint' {
Invoke-Step 'ruff check' { uv run ruff check src tests envs }
Invoke-Step 'ruff format --check' { uv run ruff format --check src tests envs }
}
'fmt' {
Invoke-Step 'ruff format' { uv run ruff format src tests envs }
Invoke-Step 'ruff check --fix' { uv run ruff check --fix src tests envs }
}
'test' {
Invoke-Step 'pytest' { uv run pytest }
}
'check' {
& $PSCommandPath lint
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
& $PSCommandPath test
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "check OK" -ForegroundColor Green
}
'envs' {
# Envs backends GPU. Long : telecharge torch + CUDA. Voir docs/compute-budget.md.
foreach ($name in @('da3', 'mapanything')) {
$dir = Join-Path $PSScriptRoot "envs\$name"
if (-not (Test-Path $dir)) { Write-Warning "envs\$name absent, ignore"; continue }
Invoke-Step "sync envs\$name" { uv sync --project $dir }
}
Write-Host "Envs backends prets. Verifie: uv run renderpoc backends" -ForegroundColor Green
}
'gui' {
uv run renderpoc gui @Rest
}
'clean' {
foreach ($p in @('.pytest_cache', '.ruff_cache')) {
if (Test-Path $p) { Remove-Item -Recurse -Force $p }
}
Get-ChildItem -Path src, tests -Recurse -Directory -Filter __pycache__ -EA SilentlyContinue |
Remove-Item -Recurse -Force
Write-Host "clean OK (runs/ conserve — supprime-le a la main si besoin)" -ForegroundColor Green
}
default {
Write-Host @'
Cibles disponibles :
setup Installe l'env racine (aucune dependance GPU)
check lint + test — doit passer sans GPU ni reseau
lint ruff check + format --check
fmt ruff format + check --fix
test pytest
envs Installe les envs backends GPU (da3, mapanything) — long
gui Lance la GUI de benchmark
clean Supprime les caches (conserve runs/)
Pipeline :
uv run renderpoc run <video.mp4> --backends da3,mapanything
uv run renderpoc runs
'@
}
}