Skip to content

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

Draft
IvanaGyro wants to merge 11 commits into
masterfrom
codex/windows-pypi-wheels
Draft

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

Conversation

@IvanaGyro

@IvanaGyro IvanaGyro commented Jul 23, 2026

Copy link
Copy Markdown
Member

Stack

master → #1110 → codex/windows-msvc-cuda-stack (#1116 patch) → #1117 → #1118 → #1119 → #1113

Depends on #1117 and contains the Windows wheel packaging/runtime layer. Runtime dependency metadata is isolated in #1119; workflow invocation is isolated in #1113.

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 the 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;
  • use repository-compliant snake_case helper names without leading underscores.

Released users do not need CUDA_PATH, CUTENSOR_ROOT, CUQUANTUM_ROOT, or CONDA_PREFIX. Development roots are not used as a fallback for installed wheels, avoiding accidental binding to an unrelated system CUDA.

Integration layers

Linux and macOS

CMake classifies MODULE targets as LIBRARY artifacts on every platform, so the relative install rule preserves Linux/macOS behavior while also installing the Windows .pyd. Existing macOS conda prefixes from master are retained.

Validation

  • both wheel environments install from the lock;
  • OpenBLAS discovery and import-library layout checks pass;
  • an actual CPU wheel repaired with forced openblas.dll inclusion contains cytnx.libs/openblas.dll;
  • the generated install script places the .pyd under the relative cytnx package;
  • loader, repair, and validation scripts pass syntax and focused CLI 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 thread tools/repair_windows_wheel.py
Comment thread cytnx/__init__.py Outdated
@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
IvanaGyro and others added 10 commits July 29, 2026 15:46
Keep Linux, macOS, and MinGW behavior unchanged while adding native MSVC compiler, dependency, export, and test configuration. Configure LAPACKE complex types before MSVC consumes the OpenBLAS headers.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Map host complex types to CUDA-native storage ids and replace the two-variant std::visit expansion with dtype-indexed template dispatch. This preserves promotion semantics while avoiding cudafe++ failures on Windows.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Provision Python 3.10, MSVC activation, MKL, and optional PyPI CUDA tooling in locked default and cuda environments. Keep release-wheel dependencies out of the contributor environments.

Co-Authored-By: OpenAI Codex <codex@openai.com>
CUDA 13 device LTO makes nvlink search bin/x64, while the PyPI NVVM wheel installs its DLL below bin/x86_64. Create an idempotent hard-link or copy in the canonical directory during CUDA preparation.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
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>
Co-Authored-By: OpenAI Codex <codex@openai.com>
@IvanaGyro
IvanaGyro force-pushed the codex/windows-pypi-wheels branch from 2d71696 to d0521d7 Compare July 29, 2026 09:04

@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: d0521d71c0

ℹ️ 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 tools/repair_windows_wheel.py
Force delvewheel to vendor openblas.dll because PE export-forwarder strings are not discoverable from import tables. Keep its basename stable so libblas.dll and liblapack.dll forwarders remain valid.

Co-Authored-By: OpenAI Codex <codex@openai.com>
@IvanaGyro
IvanaGyro changed the base branch from codex/windows-pixi-dev to master July 30, 2026 16:21
@IvanaGyro
IvanaGyro marked this pull request as draft July 31, 2026 18:19
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