Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
64636a0
Regenerate doc tests and prune stale generated files
ciaranra May 13, 2026
0f58884
Auto-include CUDA Python packages when toolkit and NVIDIA GPU detected
ciaranra May 13, 2026
9740a15
Merge remote-tracking branch 'origin/dev' into cleanup
ciaranra May 14, 2026
6a55986
Surface CUDA Python packages in pecos setup summary
ciaranra May 14, 2026
1f525cc
Stop pytest from shelling out to cargo, fix shadowed slr_tests module…
ciaranra May 14, 2026
7cbcb5c
Sanitize generated doc test paths and fix cmake-setup example
ciaranra May 14, 2026
8796251
Introduce VariableState; fix SLR linearity bugs at use-after-unpack s…
ciaranra May 14, 2026
40b668d
Plumb profile through build-selene, python build, and rust test
ciaranra May 15, 2026
8c4f974
Fix pyo3 cargo test linking and void-main entry-point dispatch
ciaranra May 15, 2026
7e98e38
Keep Go cgo -L for direct go test and include extension-module in --f…
ciaranra May 15, 2026
b9281eb
Guard empty arrays for bash 3.2 in clean/build-selene, exclude all py…
ciaranra May 15, 2026
e4c0d59
Restore check/clippy coverage for pyo3 cdylibs by splitting test-only…
ciaranra May 15, 2026
a879159
Move pecos-rslib-cuda to FFI_CRATES so default check doesnt trigger e…
ciaranra May 15, 2026
1af738f
Update --include-ffi help text to list pecos-rslib-cuda and flag its …
ciaranra May 15, 2026
f347e1f
Merge origin/cleanup, resolving python_cmd.rs Build arm by combining …
ciaranra May 15, 2026
6df6aac
Apply just lint auto-fixes (clippy doc_markdown backticks; black dict…
ciaranra May 15, 2026
4c57d2f
Pin black target-version to py310 to match requires-python floor
ciaranra May 15, 2026
b0cceee
Pick newest installed MSVC toolset on Windows CI to match VsDevCmd LI…
ciaranra May 15, 2026
9f07d67
Exclude LIB/INCLUDE/LIBPATH from MSYS2 path conversion so the MSVC en…
ciaranra May 16, 2026
3bebcb0
Bake MSVC LIB/INCLUDE into cargo [env] with force=true so rustc/link.…
ciaranra May 16, 2026
f1a825b
Add through-just MSVC LIB diagnostic to localize where the env is los…
ciaranra May 16, 2026
9face90
Experiment: drop MSVC linker pin + config.toml LIB/INCLUDE on python-…
ciaranra May 16, 2026
9da21df
Revert "Experiment: drop MSVC linker pin + config.toml LIB/INCLUDE on…
ciaranra May 16, 2026
d2ef0aa
Run Windows cargo/just CI steps under shell:pwsh so GitHub Actions do…
ciaranra May 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,21 @@ jobs:
# On Windows, Git Bash's /usr/bin/link.exe shadows MSVC's link.exe.
# Create .cargo/config.toml with the explicit MSVC linker path so cargo
# uses the correct linker inside cibuildwheel (which runs on the host).
# Must pick the NEWEST installed MSVC toolset to match VsDevCmd.bat's
# LIB/INCLUDE env (see scripts/ci/setup-msvc.ps1 for the same rationale);
# picking the lexically-first link.exe selects the OLDEST toolset and
# produces LNK1181 against the newer SDK's LIB paths.
- name: Configure MSVC linker for Cargo (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vsWhere -latest -property installationPath
$linkPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "link.exe" |
Where-Object { $_.FullName -like "*\bin\Hostx64\x64\*" } |
Select-Object -First 1 -ExpandProperty FullName
$latestMsvcDir = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Directory |
Sort-Object { try { [version]$_.Name } catch { [version]"0.0" } } -Descending |
Select-Object -First 1 -ExpandProperty FullName
$linkPath = if ($latestMsvcDir) { Join-Path $latestMsvcDir "bin\Hostx64\x64\link.exe" } else { $null }
if ($linkPath -and -not (Test-Path $linkPath)) { $linkPath = $null }

if ($linkPath) {
$escapedPath = $linkPath.Replace('\', '/')
Expand Down Expand Up @@ -195,7 +201,7 @@ jobs:
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm-14
CMAKE=$HOME/.pecos/deps/cmake-${{ env.PECOS_CMAKE_VERSION }}/bin/cmake
CUDA_PATH=/usr/local/cuda-12.6
MATURIN_PEP517_ARGS=--features=mwpf
MATURIN_PEP517_ARGS=--features=extension-module,mwpf
CIBW_BEFORE_ALL_LINUX: |
curl -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
Expand Down Expand Up @@ -228,7 +234,7 @@ jobs:
CMAKE=$HOME/.pecos/deps/cmake-${{ env.PECOS_CMAKE_VERSION }}/CMake.app/Contents/bin/cmake
MACOSX_DEPLOYMENT_TARGET=13.2
SDKROOT=$(xcrun --show-sdk-path)
MATURIN_PEP517_ARGS=--features=mwpf
MATURIN_PEP517_ARGS=--features=extension-module,mwpf
CIBW_BEFORE_ALL_MACOS: |
curl -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
Expand All @@ -248,7 +254,7 @@ jobs:
PATH="C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14\\bin;C:\\Users\\runneradmin\\.pecos\\deps\\cmake-${{ env.PECOS_CMAKE_VERSION }}\\bin;$PATH"
LLVM_SYS_140_PREFIX="C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14"
CMAKE="C:\\Users\\runneradmin\\.pecos\\deps\\cmake-${{ env.PECOS_CMAKE_VERSION }}\\bin\\cmake.exe"
MATURIN_PEP517_ARGS=--features=mwpf
MATURIN_PEP517_ARGS=--features=extension-module,mwpf
CIBW_BEFORE_ALL_WINDOWS: >
echo "=== Installing LLVM using pecos ===" &&
rustup update &&
Expand Down
84 changes: 52 additions & 32 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ jobs:
- name: Set up Visual Studio environment on Windows
if: runner.os == 'Windows'
shell: pwsh
run: ./scripts/ci/setup-msvc.ps1 -Arch x64 -HostArch x64
# -NoPinLinker: the cargo/just steps below run as `shell: pwsh`, so git's
# /usr/bin never shadows MSVC link.exe; rustc's own vswhere detection
# finds the linker and sets up LIB/INCLUDE itself -- no pin, no
# .cargo/config.toml LIB/INCLUDE surgery needed.
run: ./scripts/ci/setup-msvc.ps1 -Arch x64 -HostArch x64 -NoPinLinker

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
Expand Down Expand Up @@ -127,55 +131,45 @@ jobs:
path: ~/.pecos/deps/llvm-14
key: llvm-${{ env.LLVM_VERSION }}-${{ runner.os }}-${{ runner.arch }}-v2

# Configure MSVC linker BEFORE any cargo build (Git's link.exe conflicts with MSVC's)
- name: Configure MSVC linker (Windows)
# No linker pin / no LIB/INCLUDE surgery. The Windows cargo/just steps run
# as `shell: pwsh` (below), so GitHub Actions does NOT prepend git's
# /usr/bin to PATH (that only happens for `shell: bash` steps -- see
# github.com/ilammy/msvc-dev-cmd). `just` then spawns non-login `bash -cu`
# (which doesn't re-add /usr/bin), so rustc's own vswhere MSVC detection
# finds the real link.exe AND sets up its LIB/INCLUDE itself -- exactly
# like a correctly-configured local Windows build. We only need the .cargo
# dir to exist for the LLVM_SYS_140_PREFIX written next.
- name: Prepare .cargo dir (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vsWhere -latest -property installationPath
$linkPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "link.exe" |
Where-Object { $_.FullName -like "*\bin\Hostx64\x64\*" } |
Select-Object -First 1 -ExpandProperty FullName
if ($linkPath) {
New-Item -ItemType Directory -Force -Path .cargo | Out-Null
$escapedPath = $linkPath.Replace('\', '/')
"[target.x86_64-pc-windows-msvc]`nlinker = `"$escapedPath`"" | Out-File -FilePath ".cargo\config.toml" -Encoding UTF8
} else {
Write-Error "Could not find MSVC link.exe"
exit 1
}
run: New-Item -ItemType Directory -Force -Path .cargo | Out-Null

# Windows cargo/just steps use `shell: pwsh` so GitHub Actions does not
# prepend git's /usr/bin to PATH (which would shadow MSVC's link.exe with
# GNU coreutils' link). The `run:` is a single shell-agnostic command, so
# running it under pwsh is identical on Linux/macOS.
- name: Ensure LLVM ${{ env.LLVM_VERSION }}
shell: pwsh
run: just ci-env

# Only LLVM_SYS_140_PREFIX goes in .cargo/config.toml -- a single path with
# no semicolons (mangling-safe) that inkwell-using crates genuinely need.
# No linker pin, no LIB/INCLUDE: rustc auto-detects MSVC (vswhere) and sets
# those up itself, which only works because the cargo steps are pwsh (no
# git PATH pollution) -- see "Prepare .cargo dir (Windows)" above.
- name: Configure LLVM environment (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# Rewrite .cargo/config.toml with both linker and LLVM config
# (`pecos env --github-actions` sets LLVM_SYS_140_PREFIX for following steps.)
$env:PECOS_LLVM = $env:LLVM_SYS_140_PREFIX

# Rewrite .cargo/config.toml with both linker and LLVM config
# (pecos install llvm may have already written this, so overwrite cleanly)
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vsWhere -latest -property installationPath
$linkPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "link.exe" |
Where-Object { $_.FullName -like "*\bin\Hostx64\x64\*" } |
Select-Object -First 1 -ExpandProperty FullName
$escapedLinker = $linkPath.Replace('\', '/')
$escapedLLVM = $env:LLVM_SYS_140_PREFIX.Replace('\', '/')
@"
[target.x86_64-pc-windows-msvc]
linker = "$escapedLinker"

[env]
LLVM_SYS_140_PREFIX = { value = "$escapedLLVM", force = true }
"@ | Out-File -FilePath ".cargo\config.toml" -Encoding UTF8

# Now install CLI (LLVM env is set, inkwell can find it)
- name: Install PECOS CLI
shell: pwsh
run: cargo install --path crates/pecos-cli --force

# macOS: prevent Homebrew library path issues
Expand All @@ -199,8 +193,31 @@ jobs:
export LIBRARY_PATH=/usr/lib
just build-debug

# Two-level diagnostic to localize where the MSVC LIB is lost (the
# step-level bash sees a correct LIB, but cold build-script links inside
# `just` were failing on kernel32.lib). (1) step-level bash, (2) through the
# exact `just -> #!/usr/bin/env bash` chain build-selene uses. Comparing the
# two pinpoints whether `just`/the shebang layer drops or mangles LIB.
# Non-fatal on the through-just side so we still capture the build failure
# context; the step-level side fails fast on a clear regression.
- name: Diagnose MSVC LIB across the just chain (Windows)
if: runner.os == 'Windows'
run: |
echo "=== step-level bash ==="
echo "MSYS2_ENV_CONV_EXCL=${MSYS2_ENV_CONV_EXCL:-<unset>}"
echo "LIB=${LIB:-<unset>}"
case "${LIB:-}" in
*"Windows Kits"*"um"*) echo "OK: Windows SDK um lib dir present in step-level LIB" ;;
*) echo "ERROR: step-level LIB lacks a Windows SDK 'um' lib directory" >&2; exit 1 ;;
esac
echo "=== through just -> shebang-bash (build-selene's exact chain) ==="
just _win-msvc-env-debug || true

- name: Build PECOS
if: runner.os != 'macOS'
# pwsh on Windows (avoid git /usr/bin PATH shadowing of MSVC link.exe);
# single shell-agnostic command so identical on Linux.
shell: pwsh
run: just build-debug

- name: Verify macOS extension module
Expand Down Expand Up @@ -232,4 +249,7 @@ jobs:
run: just pytest-slow

- name: Run linting
# pwsh so cargo clippy on Windows isn't subject to git /usr/bin PATH
# shadowing; single shell-agnostic command, identical on Linux/macOS.
shell: pwsh
run: just lint check
17 changes: 13 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ clap_complete = "4.5"
cargo_metadata = "0.23"

# --- Python bindings ---
pyo3 = { version = "0.28", features = ["extension-module"] }
# Note: `extension-module`/`abi3-py310`/`generate-import-lib` are intentionally
# NOT enabled at the workspace level. They tell pyo3 to skip linking libpython
# at build time, which is what we want when maturin builds the cdylib but is
# fatal for plain `cargo test`. Each pecos-rslib* crate gates them behind its
# own `extension-module` feature; maturin opts in via pyproject.toml.
pyo3 = "0.28"

# --- C/C++ FFI & build ---
bindgen = "0.72"
Expand Down Expand Up @@ -238,9 +243,13 @@ inherits = "release"
strip = false
debug = 1 # line tables only — minimal size impact

# Native profile: release + CPU-specific optimizations
# Use with: cargo build --profile native
# Build scripts detect this via PROFILE=native env var and add --march=native for C++ code
# Native profile: release + CPU-specific optimizations.
# Use with: cargo build --profile native (or just <recipe> native).
# Build scripts detect this via PROFILE=native env var and add --march=native for C++ code.
# Rust code gets -C target-cpu=native via RUSTFLAGS supplied by the caller (Justfile
# recipes, pecos python build --profile native, etc.). Setting it here as
# `profile.native.rustflags` would be cleaner but that field is still unstable in
# stable cargo as of 1.93.
[profile.native]
inherits = "release"

Expand Down
Loading
Loading