-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsit.ps1
More file actions
63 lines (53 loc) · 2.14 KB
/
Copy pathsit.ps1
File metadata and controls
63 lines (53 loc) · 2.14 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
#Requires -Version 7.0
<#
============================================================
sit.ps1 (ALL-PY-SRC-REPOS)
============================================================
Updated: 2026-08-15 (uses pyproject.toml [dependency-groups]; uv sync installs dev and docs groups by default)
Situate project dependencies, lint, test, and build docs.
For Python tooling repos only.
Run with:
.\sit.ps1
#>
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# ============================================================
# Precheck: pyproject.toml must use [dependency-groups], not the
# old [project.optional-dependencies]. With the old table, `uv sync`
# succeeds but does NOT install dev/docs, and later steps fail confusingly.
# ============================================================
if (Test-Path "pyproject.toml") {
$pyproject = Get-Content "pyproject.toml" -Raw
if ($pyproject -match '(?m)^\[project\.optional-dependencies\]') {
Write-Host ""
Write-Host "ERROR: pyproject.toml uses the old [project.optional-dependencies] table." -ForegroundColor Red
Write-Host ""
Write-Host "This repo has not been migrated. 'uv sync' would run but NOT install" -ForegroundColor Yellow
Write-Host "the dev and docs dependencies, so linting, tests, and docs would fail." -ForegroundColor Yellow
Write-Host ""
Write-Host "FIX: open pyproject.toml and rename this one line:" -ForegroundColor Cyan
Write-Host " [project.optional-dependencies] -> [dependency-groups]" -ForegroundColor Cyan
Write-Host ""
Write-Host "Then run .\sit.ps1 again." -ForegroundColor Cyan
Write-Host ""
exit 1
}
}
uv self update
uv python install
uv lock --upgrade
uv sync
uv run pre-commit install
uv run pre-commit autoupdate
git add -A
uv run pre-commit run --all-files
# repeat if changes were made
uv run pre-commit run --all-files
# run common chores
uv run ruff format .
uv run ruff check . --fix
uv run ty check
uv run python -m pytest
uv run python -m zensical build
Write-Host "All commands executed successfully."
Write-Host "Run a Python module to verify .venv/ is working correctly."