forked from bluemoonfoundry/daz-script-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotebook.ps1
More file actions
48 lines (40 loc) · 1.52 KB
/
Copy pathnotebook.ps1
File metadata and controls
48 lines (40 loc) · 1.52 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
#!/usr/bin/env pwsh
# Launch Jupyter notebook for dazpy interactive work.
# Installs required packages if missing.
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function Test-PythonPackage {
param([string]$Package)
$result = python -c "import $Package" 2>$null
return $?
}
Write-Host "==> Checking Python..." -ForegroundColor Cyan
try {
$pyVersion = python --version 2>&1
Write-Host " $pyVersion"
} catch {
Write-Error "Python not found. Install Python 3.9+ and ensure it is on PATH."
exit 1
}
Write-Host "==> Installing/verifying dazpy SDK (editable)..." -ForegroundColor Cyan
pip install -e . --quiet
if (-not $?) { Write-Error "Failed to install dazpy"; exit 1 }
Write-Host "==> Checking for Jupyter..." -ForegroundColor Cyan
if (-not (Test-PythonPackage "jupyter_server")) {
Write-Host " Installing notebook..." -ForegroundColor Yellow
pip install notebook --quiet
if (-not $?) { Write-Error "Failed to install notebook"; exit 1 }
} else {
Write-Host " Jupyter already installed."
}
$notebooksDir = Join-Path $PSScriptRoot "notebooks"
if (-not (Test-Path $notebooksDir)) {
New-Item -ItemType Directory -Path $notebooksDir | Out-Null
Write-Host "==> Created notebooks/ directory."
}
Write-Host ""
Write-Host "==> Starting Jupyter Notebook..." -ForegroundColor Green
Write-Host " DAZ Studio must be running with the DazScriptServer plugin active."
Write-Host " Default server: http://127.0.0.1:18811"
Write-Host ""
jupyter notebook --notebook-dir="$notebooksDir"