Skip to content

feat: support macOS pyvsag wheel builds#2411

Open
jac0626 wants to merge 2 commits into
antgroup:mainfrom
jac0626:codex/macos-pyvsag-wheel-builds
Open

feat: support macOS pyvsag wheel builds#2411
jac0626 wants to merge 2 commits into
antgroup:mainfrom
jac0626:codex/macos-pyvsag-wheel-builds

Conversation

@jac0626

@jac0626 jac0626 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Change Type

  • Bug fix
  • New feature
  • Improvement/Refactor
  • Documentation
  • CI/Build/Infra

Linked Issue

What Changed

  • Add macOS pyvsag wheel builds for supported CPython 3.10-3.14 on Apple Silicon (arm64) and Intel (x86_64) runners.
  • Configure macOS Python wheels to use bundled dependencies, a macOS 11.0 deployment target, and @loader_path loading for packaged libvsag.dylib.
  • Keep macOS x86_64 OpenBLAS on a conservative baseline while preserving VSAG runtime SIMD dispatch.
  • Disable OpenMP only for macOS Python wheels so PyPI installs do not depend on Homebrew libomp.dylib at import time.
  • Disable SOVERSION only for macOS Python wheels so each wheel packages a single libvsag.dylib instead of three copied version aliases.
  • Keep Linux wheel behavior unchanged and document the macOS support surface.

Test Evidence

  • make fmt
  • make lint
  • make test
  • make cov, run tests, and collect coverage
  • Other (describe below)

Test details:

make fmt
Using clang-format version 15 (required: 15)
Code formatting completed with /opt/homebrew/opt/llvm@15/bin/clang-format

CMAKE_BUILD_PARALLEL_LEVEL=18 VSAG_USE_SYSTEM_DEPS=OFF MACOSX_DEPLOYMENT_TARGET=11.0 bash scripts/python/local_build_wheel.sh 3.10
Successfully built pyvsag-0.19.0.dev359-cp310-cp310-macosx_11_0_arm64.whl
84 passed in 17.58s

Clean venv smoke test from /tmp:
import pyvsag, build a brute_force index, run knn_search: passed

GitHub Actions on db54f0c1:
- 28640462364: Build and Publish Wheels, python=3.10, arch=arm64: success
- 28640462424: Build and Publish Wheels, python=3.10, arch=x86_64: success

Artifact checks from the latest macOS 3.10 wheels:
- arm64 wheel size: 9.9M; contains pyvsag/libvsag.dylib and _pyvsag only
- x86_64 wheel size: 6.2M; contains pyvsag/libvsag.dylib and _pyvsag only
- _pyvsag links @loader_path/libvsag.dylib on both architectures
- LC_BUILD_VERSION minos is 11.0 on both architectures

Compatibility Impact

  • API/ABI compatibility: additive packaging support only; no public API changes.
  • Behavior changes: pip install pyvsag can install prebuilt macOS wheels for CPython 3.10-3.14 on arm64 and x86_64. macOS Python wheels do not enable OpenMP to avoid external libomp.dylib runtime dependencies. Linux wheel behavior is unchanged.

Performance and Concurrency Impact

  • Performance impact: macOS Python wheels may have lower OpenMP-level parallelism, which is acceptable for macOS development and demo usage. Linux performance paths are not changed.
  • Concurrency/thread-safety impact: no API-level concurrency changes.

Documentation Impact

  • No docs update needed
  • Updated docs:
    • README.md
    • DEVELOPMENT.md
    • CONTRIBUTING.md
    • Other: docs/docs/en/src/guide/{installation,pyvsag}.md, docs/docs/zh/src/guide/{installation,pyvsag}.md

Risk and Rollback

  • Risk level: medium, because this changes packaging and release workflow behavior.
  • Rollback plan: revert this commit to remove macOS wheel jobs and return Python packaging to the previous Linux-only behavior.

Checklist

  • I have linked the relevant issue (required for kind/bug and kind/feature; see "Linked Issue" above)
  • I have added/updated tests for new behavior or bug fixes
  • I have considered API compatibility impact
  • I have updated docs if behavior/workflow changed
  • My commit messages follow project conventions (Conventional Commits, optional [skip ci] prefix)

Build macOS pyvsag wheels for supported CPython 3.10-3.14 on both arm64 and x86_64 runners with a macOS 11 deployment target.

Use bundled static dependencies for macOS wheels, disable OpenMP in macOS Python packaging, and set @loader_path rpath so installed wheels can load their packaged libvsag dylib on clean machines.

Keep macOS x86_64 OpenBLAS on a conservative baseline target while preserving VSAG runtime SIMD dispatch.

Keep filtered workflow-dispatch validation green by turning empty build matrices into no-op jobs and keeping publish as a non-release no-op.

Use the existing PyPI publish action ref so skipped release-only publish steps do not break workflow-dispatch runs.

Keep local macOS wheel builds on the same dependency policy and pass the configured parallel job count through to third-party builds.

Document the macOS wheel support surface for PyPI users.

Signed-off-by: jac0626 <jac0626@users.noreply.github.com>
Assisted-by: Codex:GPT-5
Copilot AI review requested due to automatic review settings July 3, 2026 05:55
@jac0626 jac0626 added kind/feature Brand-new functionality or capabilities 引入全新的功能、新特性或新能力 version/0.18 module/python labels Jul 3, 2026
@mergify

mergify Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 3 merge protections satisfied — ready to merge.

Show 3 satisfied protections

🟢 Require kind label

  • label~=^kind/

🟢 Require version label

  • label~=^version/

🟢 Require linked issue for feature/bug PRs

  • body~=(?im)(?:^|[\s\-\*])(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s+(?:#\d+|[\w.\-]+/[\w.\-]+#\d+|https?://github\.com/[\w.\-]+/[\w.\-]+/issues/\d+)

@jac0626 jac0626 changed the title [codex] support macOS pyvsag wheel builds feat: support macOS pyvsag wheel builds Jul 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces macOS support for building and packaging pyvsag wheels, refactors OpenMP configuration to be conditionally enabled via ENABLE_OPENMP, and updates dependency handling (such as fmt and OpenBLAS) for better compatibility on macOS. Key feedback includes: wrapping vsag_src_common in $<BUILD_INTERFACE:...> for vsag_static to prevent CMake export errors; avoiding pip install --user failures in active virtual environments and preventing path corruption from uv python install output in local_build_wheel.sh; using IN_LIST instead of STREQUAL for checking CMAKE_OSX_ARCHITECTURES in openblas.cmake; and removing redundant raw compiler include flags (-I, -iquote) in fmt.cmake in favor of standard CMake target include directories.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/CMakeLists.txt
Comment thread scripts/python/local_build_wheel.sh
Comment thread scripts/python/local_build_wheel.sh
Comment thread extern/openblas/openblas.cmake
Comment thread extern/fmt/fmt.cmake
@jac0626 jac0626 marked this pull request as ready for review July 3, 2026 05:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds macOS wheel build support for pyvsag across Apple Silicon and Intel, while adjusting build/linking behavior (notably OpenMP and dependency bundling) and documenting the new support surface.

Changes:

  • Add macOS wheel builds to CI matrix (CPython 3.10–3.14; arm64 + x86_64) and update local wheel build scripts.
  • Introduce OpenMP toggling helpers and macOS-specific wheel build configuration (disable OpenMP, adjust rpath/loader behavior).
  • Update docs to reflect macOS wheel availability and supported versions/targets.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/build_release_wheel.yml Adds macOS build matrix/jobs and modifies publish gating logic.
python/pyproject.toml Splits cibuildwheel config by platform, adds macOS before-build hook.
python/setup.py Adds macOS-specific CMake configuration for wheel builds; controls parallelism/flags.
scripts/python/local_build_wheel.sh Adds macOS-local wheel build path and Python resolution/venv management.
scripts/python/prepare_python_build.sh Uses an isolated venv for setuptools_scm version generation.
scripts/deps/install_deps_macos.sh Adds uv installation and prints its prefix.
cmake/VSAGHelpers.cmake Adds vsag_enable_openmp_* helpers and gates OpenMP on ENABLE_OPENMP.
cmake/DarwinDep.cmake Makes OpenMP configuration conditional and adds clearer disabled path.
cmake/VSAGPythonBindings.cmake Applies OpenMP helper and sets @loader_path rpath for _pyvsag on macOS.
extern/openblas/openblas.cmake Adds macOS-specific OpenBLAS build args (x86_64 baseline vs arm64 dynamic arch).
extern/fmt/fmt.cmake Adjusts fmt header handling on macOS to prefer bundled includes.
src/omp.h Adds an OpenMP shim header for builds without OpenMP available/enabled.
docs/docs/**/guide/{installation,pyvsag}.md Documents macOS wheel availability and the supported macOS/Python range.
(various CMakeLists.txt) Replaces raw -fopenmp flags with OpenMP helper functions and adds gating definitions.
Comments suppressed due to low confidence (1)

python/pyproject.toml:1

  • before-all is currently defined at the global [tool.cibuildwheel] level, but it contains CentOS/yum-specific commands. With macOS wheel jobs added, cibuildwheel will attempt to run this on macOS too, which will fail. Move this before-all block under [tool.cibuildwheel.linux] (or split per-platform) so macOS builds don't execute Linux-only setup.
[build-system]

Comment thread .github/workflows/build_release_wheel.yml
Comment thread cmake/DarwinDep.cmake
Comment thread extern/fmt/fmt.cmake
Copilot AI review requested due to automatic review settings July 3, 2026 16:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 26 changed files in this pull request and generated 4 comments.

Comment thread src/omp.h
Comment thread cmake/VSAGOptions.cmake
Comment thread scripts/python/local_build_wheel.sh
Comment thread scripts/python/local_build_wheel.sh
@jac0626 jac0626 force-pushed the codex/macos-pyvsag-wheel-builds branch from b2d4e81 to 685e76b Compare July 4, 2026 07:34
Copilot AI review requested due to automatic review settings July 4, 2026 08:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 6 comments.

Comment thread python/setup.py
Comment thread python/setup.py
Comment thread src/omp.h
Comment thread cmake/VSAGDependencyTargets.cmake
Comment thread scripts/python/local_build_wheel.sh
Comment thread scripts/python/local_build_wheel.sh
Copilot AI review requested due to automatic review settings July 4, 2026 08:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 4 comments.

Comment thread scripts/python/local_build_wheel.sh
Comment thread scripts/python/local_build_wheel.sh
Comment thread python/setup.py Outdated
Comment thread scripts/python/local_build_wheel.sh
Copilot AI review requested due to automatic review settings July 6, 2026 05:25
@jac0626 jac0626 force-pushed the codex/macos-pyvsag-wheel-builds branch from c180d6d to 1c6f1b9 Compare July 6, 2026 05:25
@vsag-bot

vsag-bot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

/label S-waiting-on-review
/waiting-on reviewer
/request-review @jiaweizone
/request-review @wxyucs
/request-review @inabao
/request-review @LHT129

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/build_release_wheel.yml Outdated
@jac0626 jac0626 force-pushed the codex/macos-pyvsag-wheel-builds branch from 1c6f1b9 to ec16d23 Compare July 6, 2026 05:47
Signed-off-by: jc543239 <jc543239@antgroup.com>
Assisted-by: Codex:GPT-5
Copilot AI review requested due to automatic review settings July 6, 2026 06:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 26 changed files in this pull request and generated 19 comments.

Comment on lines +12 to +15
join_versions() {
local IFS=", "
echo "$*"
}
Comment on lines +45 to 50
if command -v brew >/dev/null 2>&1; then
echo " - Installing uv with Homebrew..." >&2
brew install uv
command -v uv
return 0
fi
Comment on lines +52 to +54
echo " - Installing uv to manage missing local Python versions..." >&2
python3 -m pip install --user --timeout 60 -q uv

Comment on lines +97 to +101
uv_bin=$(ensure_uv)
echo " - Python ${py_version} not found locally; installing with uv..." >&2
"${uv_bin}" python install "${py_version}"
"${uv_bin}" python find "${py_version}"
return 0
Comment on lines +227 to 229
if ${use_uvx}; then
python3 -m pip install -q uv 2>/dev/null || true
CIBW_BUILD="${cibw_build_pattern}" \
echo "modern_matrix=$(matrix_or_skip "$modern_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "macos_matrix=$(matrix_or_skip "$macos_matrix" macos-15)" >> $GITHUB_OUTPUT
echo "legacy_matrix=$(matrix_or_skip "$legacy_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "py36_matrix=$(matrix_or_skip "$py36_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
else
modern_matrix="[]"
fi
echo "modern_matrix=$(matrix_or_skip "$modern_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "modern_matrix=[]" >> $GITHUB_OUTPUT
macos_matrix="[]"
fi
echo "macos_matrix=$(matrix_or_skip "$macos_matrix" macos-15)" >> $GITHUB_OUTPUT
echo "legacy_matrix=[]" >> $GITHUB_OUTPUT
legacy_matrix="[]"
fi
echo "legacy_matrix=$(matrix_or_skip "$legacy_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "py36_matrix=[]" >> $GITHUB_OUTPUT
py36_matrix="[]"
fi
echo "py36_matrix=$(matrix_or_skip "$py36_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
Copilot AI review requested due to automatic review settings July 8, 2026 12:40
@jac0626 jac0626 force-pushed the codex/macos-pyvsag-wheel-builds branch from 14735ee to 640b2dd Compare July 8, 2026 12:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 26 changed files in this pull request and generated 15 comments.

Comment on lines +12 to +15
join_versions() {
local IFS=", "
echo "$*"
}
Comment on lines +45 to 50
if command -v brew >/dev/null 2>&1; then
echo " - Installing uv with Homebrew..." >&2
brew install uv
command -v uv
return 0
fi
Comment on lines +52 to +54
echo " - Installing uv to manage missing local Python versions..." >&2
python3 -m pip install --user --timeout 60 -q uv

Comment on lines +97 to +101
uv_bin=$(ensure_uv)
echo " - Python ${py_version} not found locally; installing with uv..." >&2
"${uv_bin}" python install "${py_version}"
"${uv_bin}" python find "${py_version}"
return 0
if ${HAVE_DOCKER}; then
echo "🛠️ Starting cibuildwheel..."
if ${use_uvx}; then
python3 -m pip install -q uv 2>/dev/null || true
else
modern_matrix="[]"
fi
echo "modern_matrix=$(matrix_or_skip "$modern_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "modern_matrix=[]" >> $GITHUB_OUTPUT
macos_matrix="[]"
fi
echo "macos_matrix=$(matrix_or_skip "$macos_matrix" macos-15)" >> $GITHUB_OUTPUT
echo "legacy_matrix=[]" >> $GITHUB_OUTPUT
legacy_matrix="[]"
fi
echo "legacy_matrix=$(matrix_or_skip "$legacy_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "py36_matrix=[]" >> $GITHUB_OUTPUT
py36_matrix="[]"
fi
echo "py36_matrix=$(matrix_or_skip "$py36_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
Comment thread cmake/DarwinDep.cmake
Comment on lines +61 to +63
message (FATAL_ERROR
"OpenMP not found on macOS. Install dependencies via "
"scripts/deps/install_deps.sh.")
Copilot AI review requested due to automatic review settings July 8, 2026 13:45
@jac0626 jac0626 force-pushed the codex/macos-pyvsag-wheel-builds branch from 640b2dd to 14735ee Compare July 8, 2026 13:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 26 changed files in this pull request and generated 12 comments.

Comment on lines +12 to +15
join_versions() {
local IFS=", "
echo "$*"
}
Comment on lines +45 to +54
if command -v brew >/dev/null 2>&1; then
echo " - Installing uv with Homebrew..." >&2
brew install uv
command -v uv
return 0
fi
fi

# --- Auto-detect Architecture ---
ARCH=$(uname -m)
if [[ "$ARCH" == "arm64" ]]; then
ARCH="aarch64"
fi
echo "✅ Detected local architecture: $ARCH"
echo " - Installing uv to manage missing local Python versions..." >&2
python3 -m pip install --user --timeout 60 -q uv

Comment on lines +98 to +100
echo " - Python ${py_version} not found locally; installing with uv..." >&2
"${uv_bin}" python install "${py_version}"
"${uv_bin}" python find "${py_version}"
if ${HAVE_DOCKER}; then
echo "🛠️ Starting cibuildwheel..."
if ${use_uvx}; then
python3 -m pip install -q uv 2>/dev/null || true
Comment on lines +182 to +185
echo "modern_matrix=$(matrix_or_skip "$modern_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "macos_matrix=$(matrix_or_skip "$macos_matrix" macos-15)" >> $GITHUB_OUTPUT
echo "legacy_matrix=$(matrix_or_skip "$legacy_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "py36_matrix=$(matrix_or_skip "$py36_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "legacy_matrix=[]" >> $GITHUB_OUTPUT
legacy_matrix="[]"
fi
echo "legacy_matrix=$(matrix_or_skip "$legacy_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
echo "py36_matrix=[]" >> $GITHUB_OUTPUT
py36_matrix="[]"
fi
echo "py36_matrix=$(matrix_or_skip "$py36_matrix" ubuntu-latest)" >> $GITHUB_OUTPUT
Comment thread extern/fmt/fmt.cmake
Comment on lines +97 to 98
include_directories (BEFORE "${fmt_SOURCE_DIR}/include")
add_subdirectory (${fmt_SOURCE_DIR} ${fmt_BINARY_DIR} EXCLUDE_FROM_ALL)
Comment thread python/setup.py
Comment on lines +21 to 25
jobs = os.environ.get("CMAKE_BUILD_PARALLEL_LEVEL", str(os.cpu_count() or 4))
release_flags = "-O3 -DNDEBUG"
if sys.platform != "darwin":
release_flags += " -s"

Comment thread python/setup.py
Comment on lines +38 to +49
if sys.platform == "darwin":
cmake_args.extend(
[
"-DCMAKE_IGNORE_PREFIX_PATH=/usr/local;/opt/homebrew",
"-DENABLE_LIBAIO=OFF",
"-DENABLE_LIBCXX=ON",
"-DENABLE_OPENMP=OFF",
"-DENABLE_WERROR=OFF",
"-DCMAKE_C_COMPILER=clang",
"-DCMAKE_CXX_COMPILER=clang++",
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Brand-new functionality or capabilities 引入全新的功能、新特性或新能力 module/docs module/python module/simd module/thirdparty module/tools size/XL version/1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat](pyvsag): publish macOS wheels

4 participants