Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
32 changes: 7 additions & 25 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,16 @@ jobs:
with:
python-version: "3.11"

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install uv
- name: Install cibuildwheel and build dependencies
run: |
python -m pip install --upgrade pip
# Install these on the host so cibuildwheel can resolve the paths
python -m pip install cibuildwheel scipy-openblas delvewheel

- name: Cache vcpkg
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: C:\\vcpkg\\installed
key: vcpkg-openblas-${{ runner.os }}

- name: Install cibuildwheel
run: python -m pip install --upgrade pip cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- name: Build wheels
env:
CIBW_ENVIRONMENT_MACOS: EASYSBA_USE_ACCELERATE=1 EASYSBA_LAPACK_LIBS=
# Use the pre-installed vcpkg location for speed and reliability
CIBW_BEFORE_ALL_WINDOWS: >-
vcpkg install openblas:x64-windows

CIBW_ENVIRONMENT_WINDOWS: >-
EASYSBA_LAPACK_LIBS="libopenblas"
EASYSBA_INCLUDE_DIRS="C:/vcpkg/installed/x64-windows/include"
EASYSBA_LIBRARY_DIRS="C:/vcpkg/installed/x64-windows/lib"
INCLUDE="C:/vcpkg/installed/x64-windows/include;$INCLUDE"
LIB="C:/vcpkg/installed/x64-windows/lib;$LIB"
run: python -m cibuildwheel --output-dir wheelhouse

- name: Upload wheels
Expand Down
19 changes: 9 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ build-backend = "setuptools.build_meta"
name = "easysba"
version = "0.1.0"
description = "Python bindings for easySBA"
Comment thread
alexlib marked this conversation as resolved.
readme = "README.md"
requires-python = ">=3.11"
dependencies = ["numpy>=1.20"]

[tool.cibuildwheel]
build-frontend = "build"
skip = "*-musllinux* *-win32"
test-skip = "*"

# Default environment for Linux
environment = { EASYSBA_LAPACK_LIBS = "openblas" }

[tool.cibuildwheel.linux]
Expand All @@ -22,14 +23,12 @@ before-all = "yum -y install openblas-devel lapack-devel"
[tool.cibuildwheel.macos]
environment = { EASYSBA_USE_ACCELERATE = "1", EASYSBA_LAPACK_LIBS = "" }

# [tool.cibuildwheel.windows]
# environment = { EASYSBA_LAPACK_LIBS = "openblas" }

[tool.cibuildwheel.windows]
# Install delvewheel to bundle the DLL into the wheel
before-build = "pip install delvewheel"
repair-wheel-command = "delvewheel repair --add-path C:\\vcpkg\\installed\\x64-windows\\bin -w {dest_dir} {wheel}"
# 1. Install scipy-openblas (the lib) and delvewheel (to bundle the DLL)
before-build = "pip install scipy-openblas delvewheel"
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The before-build step installs third-party packages scipy-openblas and delvewheel via pip without any version pinning, creating a supply-chain risk in the automated build pipeline. If either package (or one of their transitive dependencies) is compromised, an attacker could execute code during the wheel build and inject malicious payloads into the produced artifacts. To mitigate this, pin these dependencies to immutable versions or hashes (and ideally verify integrity) so that build-time code execution cannot be silently altered by upstream changes.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback


# 2. Extract paths from scipy-openblas and set them for the compiler
environment = { EASYSBA_LAPACK_LIBS="openblas", INCLUDE="$(python -c \"import scipy_openblas; print(scipy_openblas.get_include_dir())\");$INCLUDE", LIB="$(python -c \"import scipy_openblas; print(scipy_openblas.get_lib_dir())\");$LIB" }
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shell command substitution syntax $(...) used in the environment variables will not work correctly on Windows. On Windows, cibuildwheel executes commands in PowerShell or cmd.exe, which use different syntax for command substitution. PowerShell uses $(...) but it needs to be properly escaped in TOML, and the semicolon separator should be a semicolon for Windows paths (which is correct here). However, the $() syntax in TOML environment variable values is not processed by the shell before being set as environment variables. Consider using CIBW_BEFORE_BUILD_WINDOWS to set these variables dynamically, or use a script file that cibuildwheel can execute.

Copilot uses AI. Check for mistakes.

[tool.cibuildwheel.windows.environment]
# Match the filename vcpkg actually produces: libopenblas
EASYSBA_LAPACK_LIBS = "libopenblas"
# 3. Repair the wheel: this bundles openblas.dll into the .whl file
repair-wheel-command = "delvewheel repair --add-path $(python -c \"import scipy_openblas; print(scipy_openblas.get_lib_dir())\") -w {dest_dir} {wheel}"
Comment thread
alexlib marked this conversation as resolved.
Outdated