Skip to content

build(python): build platform wheels that carry the native library - #42

Merged
SMI-Lab-Inha merged 1 commit into
devfrom
build/python-wheels
Oct 22, 2026
Merged

SMI-Lab-Inha merged 1 commit into
devfrom
build/python-wheels

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Summary

First step towards publishing cabledyn on PyPI (and conda-forge).

The problem. The package was published only as a pure-Python wheel. It loads the CableDyn shared library and runs the standalone driver, but users had to build or download both separately.

What changes:

  • A root pyproject.toml (scikit-build-core) builds the published distribution:
    • wheel contents: the compiled library beside the package modules (where cabledyn._discovery already looks first) and the standalone driver in cabledyn/bin;
    • what CMake builds: only the cabledyn_shared and cabledyn targets, installed through a python install component that is active only under scikit-build; no test programs, and no OpenMP (CABLEDYN_ENABLE_OPENMP off, like the release executables);
    • wheel tag: py3-none-<platform>; the package reaches the library through ctypes, so one wheel per platform serves every supported Python version;
    • sdist: about 3.0 MB. It leaves out the validation records, the manual, the OpenFAST integration and the release tooling, and keeps everything the CMake configuration needs.
  • Driver search: takes the bundled driver after CABLEDYN_DRIVER and before PATH. It accepts either toolchain's name (CableDyn_driver for MSVC-style linkers, cabledyn for GNU).
  • python/pyproject.toml remains the pure package for development against a build tree. tests/test_packaging_metadata.py keeps the two [project] tables identical, except for the readme, the licence files (the wheel also ships NOTICE) and the platform classifiers.
  • Release checks: release/check_release_metadata.py and release/audit_release_tree.py cover the new file.
  • Docs: DEVELOPMENT.md documents local sdist and wheel builds; CHANGELOG entry.

Next PRs:

  • CI wheels for Linux, Windows and macOS, with the runtime and LAPACK bundled by auditwheel / delvewheel / delocate, or static IFX on Windows.
  • Trusted Publishing, TestPyPI first.
  • The 0.3.0 release.
  • The conda-forge recipe.

Verification (local, Windows, conda GNU toolchain)

  • Wheel: pip wheel . gives cabledyn-…-win_amd64.whl containing cabledyn/libcabledyn.dll and cabledyn/bin/cabledyn.exe. Installed into a fresh virtual environment and used from outside the repository, the package:
    • finds the bundled library;
    • selects the bundled driver;
    • runs examples/dynamic_chain_current.dat.
  • sdist: python -m build --sdist produces 523 entries with no bytecode, and a wheel builds from the sdist alone.
  • Tests:
    • new tests for the bundled-driver order (bundled before PATH, CABLEDYN_DRIVER before bundled), both driver names, and the metadata parity;
    • full suite (Windows, gfortran, Release, slow tier included): 296/296;
    • Python: 2051 passed;
    • pre-commit run --all-files and the Sphinx build with -W pass.

Checklist

  • pre-commit run --all-files passes
  • ctest --test-dir build --output-on-failure passes
  • python -m pytest tests python/tests passes (if Python or validation records changed)
  • VALIDATION.md updated if a validation result changed (none changed)
  • CHANGELOG.md updated under [Unreleased] (heading added if missing) for user-visible changes
  • Documentation in doc/ updated for changed inputs, options, or outputs (the user-facing install instructions change with the first PyPI release)
  • Conventional Commit title (feat:, fix:, docs:, ...)
  • Commits are signed off (git commit -s) under the
    Developer Certificate of Origin

The cabledyn package was published only as a pure-Python wheel: it
loads the CableDyn shared library and runs the standalone driver, but
the user had to build or download both separately. This prepares
publication on PyPI.

A root pyproject.toml (scikit-build-core) builds an sdist of the
sources and a platform wheel. CMake builds only the cabledyn_shared and
cabledyn targets, serially, and under scikit-build installs them through
the `python` component: the library beside the package modules, where
cabledyn._discovery already looks first, and the driver in
cabledyn/bin. The wheel is tagged py3-none-<platform>, since the
package reaches the library through ctypes. The sdist leaves out the
validation records, the manual, the OpenFAST integration and the release
tooling, and builds a wheel on its own.

The driver search takes the bundled driver after CABLEDYN_DRIVER and
before PATH, under either toolchain name (CableDyn_driver, cabledyn).
python/pyproject.toml stays the pure package for development against a
build tree; tests/test_packaging_metadata.py keeps the two [project]
tables identical except for the readme, licence files and platform
classifiers, and the release checks cover the new file.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T04:58:47.007379Z b1a2b2f Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #35316022 | 📁 Comparing b1a2b2f against latest (d3ddfeb)

  🔍 Preview build  

9 files changed · ± 9 modified

± Modified

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: b1a2b2f5d9

ℹ️ 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".

@SMI-Lab-Inha
SMI-Lab-Inha merged commit 312179f into dev Oct 22, 2026
15 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the build/python-wheels branch October 22, 2026 06:27
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