Skip to content

build(windows): package and validate PyPI wheels#1118

Open
IvanaGyro wants to merge 3 commits into
codex/windows-pixi-devfrom
codex/windows-pypi-wheels
Open

build(windows): package and validate PyPI wheels#1118
IvanaGyro wants to merge 3 commits into
codex/windows-pixi-devfrom
codex/windows-pypi-wheels

Conversation

@IvanaGyro

@IvanaGyro IvanaGyro commented Jul 23, 2026

Copy link
Copy Markdown
Member

Stack

#1109 → #1110 → #1116 → #1117 → #1118 → #1119 → #1113

Depends on #1117 and contains the Windows wheel packaging/runtime layer.

Summary

  • add locked OpenBLAS wheel-cpu and wheel-cuda environments;
  • install the pybind11 MODULE target through CMake's portable LIBRARY artifact rule into the relocatable cytnx package;
  • locate CUDA/cuTENSOR DLLs from exact installed PyPI distributions with os.add_dll_directory, since Windows has no ELF-style RUNPATH;
  • bundle non-CUDA dependencies with delvewheel while keeping CUDA/cuTENSOR in their declared PyPI packages;
  • validate clean installed CPU/CUDA wheels.

Linux and macOS

CMake classifies MODULE targets as LIBRARY artifacts on every platform, so the single relative install rule preserves the existing Linux/macOS behavior while also installing the Windows .pyd. The previous full stack passed both macOS wheel jobs and both Ubuntu architectures; fresh checks are running for this smaller layer.

Validation

  • both wheel environments install from the lock;
  • fresh wheel-cpu doctor and import-library layout checks pass;
  • incremental Windows/OpenBLAS CMake reconfiguration passes after the portable MODULE install correction;
  • the generated install script places cytnx.cp311-win_amd64.pyd under the relative cytnx package with component libraries;
  • loader, repair, and validation scripts pass Python syntax checks;
  • repository-pinned pre-commit hooks pass.

Part of #1114.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c05b40b7eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
Comment on lines +168 to +170
before-build = "python -m pip install delvewheel==1.13.0 && python ./tools/cibuildwheel_before_build.py"
repair-wheel-command = "python {project}/tools/repair_windows_wheel.py --wheel {wheel} --dest-dir {dest_dir}"
test-command = "python {project}/tools/validate_windows_wheel.py"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Wire the Windows wheel config into release workflows

These Windows hooks are currently unreachable: a repository-wide workflow search shows that .github/workflows/release_pypi.yml still runs only Ubuntu and macOS, while .github/workflows/release_pypi_cuda.yml runs only Ubuntu. Consequently neither new Pixi wheel environment is activated, no win_amd64 wheel is built or published, and this repair/validation configuration never executes; add Windows release jobs that enter wheel-cpu and wheel-cuda and invoke cibuildwheel.

Useful? React with 👍 / 👎.

Comment on lines +86 to +87
if is_cuda:
command.extend(["--exclude", ";".join(CUDA_DLL_PATTERNS)])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Declare Windows CUDA dependencies before excluding their DLLs

When a cytnx-cuda Windows wheel is repaired, this removes every CUDA/cuTENSOR DLL from the wheel, but tools/prepare_cuda_release.py declares all corresponding runtime dependencies only under sys_platform == 'linux'. A clean Windows pip install cytnx-cuda therefore installs none of the distributions that cytnx/__init__.py searches, so the extension cannot resolve its excluded DLLs; add Windows dependency markers for the runtime packages before externalizing them.

Useful? React with 👍 / 👎.

Comment thread cytnx/__init__.py
import os,sys,warnings


def _distribution_directory(distribution_name, relative_path):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Rename the new helpers to avoid leading underscores

The newly added _distribution_directory begins a broader set of new leading-underscore identifiers here and in both Windows wheel tools, including _has_distribution, _register_windows_dll_directories, _wheel_distribution_name, _installed_distribution, and _clear_development_roots. The repository contract strictly prohibits leading underscores in new code, so rename these helpers and the new module-level handle accordingly. CLAUDE.mdL62-L64

Useful? React with 👍 / 👎.

IvanaGyro and others added 3 commits July 23, 2026 10:24
Add isolated OpenBLAS wheel environments, relocatable extension installs, Windows DLL discovery, and delvewheel repair plus clean-install validation while leaving CUDA runtimes in their declared PyPI distributions.

Co-Authored-By: OpenAI Codex <codex@openai.com>
CMake classifies MODULE targets as LIBRARY artifacts on every platform. Keep the wheel install destination relative while using the portable artifact kind so Windows configuration succeeds.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Conda-forge BLAS and LAPACK DLLs contain export forwarders to the literal openblas.dll basename. Tell delvewheel not to mangle that DLL so clean wheel imports can resolve the forwarded symbols.

Co-Authored-By: OpenAI Codex <codex@openai.com>
@IvanaGyro
IvanaGyro force-pushed the codex/windows-pypi-wheels branch from c05b40b to 2d71696 Compare July 23, 2026 02:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d7169602b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
# compiler runtimes found in the activated Pixi prefix. The repair helper keeps
# CUDA/cuTENSOR DLLs external for cytnx-cuda wheels because those are supplied
# by the wheel's declared NVIDIA PyPI dependencies.
before-build = "python -m pip install delvewheel==1.13.0 && python ./tools/cibuildwheel_before_build.py"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prepare Windows import libraries before building wheels

When cibuildwheel is run from either new Windows wheel environment, this hook never invokes tools/prepare_windows_import_libraries.py; Pixi activation does not automatically execute the existing prepare-windows/prepare-cuda tasks. The repository's Windows preparation script documents that conda-forge ARPACK lacks an MSVC import library and that the NVIDIA math wheels also omit several required .lib files, so the CPU build cannot link ARPACK and the CUDA build additionally cannot link its CUDA libraries. Chain the preparation script into the wheel build, using --cuda for the CUDA variant, before CMake configures.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant