Repository navigation
build(python): build platform wheels that carry the native library #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # File: pyproject.toml | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University | ||
| # | ||
| # The published distribution: an sdist of the Fortran sources and platform wheels that carry the | ||
| # compiled CableDyn library and the standalone driver inside the `cabledyn` package. The [project] | ||
| # table mirrors python/pyproject.toml (the pure-Python package for development against a CMake | ||
| # build tree); tests/test_packaging_metadata.py keeps the two identical. | ||
| [build-system] | ||
| requires = ["scikit-build-core>=0.10"] | ||
| build-backend = "scikit_build_core.build" | ||
|
|
||
| [project] | ||
| name = "cabledyn" | ||
| version = "0.2.0" | ||
| description = "Python APIs for the CableDyn standalone driver and native coupling library" | ||
| readme = "python/README.md" | ||
| requires-python = ">=3.10" | ||
| license = "Apache-2.0" | ||
| license-files = ["LICENSE", "NOTICE"] | ||
| authors = [{ name = "Jae Hoon Seo", email = "jaehoon.seo@inha.ac.kr" }] | ||
| keywords = [ | ||
| "cable dynamics", | ||
| "dynamic power cable", | ||
| "finite element", | ||
| "floating offshore wind", | ||
| "lazy wave", | ||
| "mooring dynamics", | ||
| "MoorDyn", | ||
| "offshore engineering", | ||
| "OpenFAST", | ||
| ] | ||
| dependencies = ["numpy>=1.24"] | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Science/Research", | ||
| "Intended Audience :: Developers", | ||
| "Natural Language :: English", | ||
| "Operating System :: Microsoft :: Windows", | ||
| "Operating System :: POSIX :: Linux", | ||
| "Operating System :: MacOS", | ||
| "Programming Language :: Fortran", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3 :: Only", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Topic :: Scientific/Engineering", | ||
| "Topic :: Scientific/Engineering :: Physics", | ||
| "Typing :: Typed", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/SMI-Lab-Inha/CableDyn" | ||
| Documentation = "https://cabledyn.readthedocs.io" | ||
| Repository = "https://github.com/SMI-Lab-Inha/CableDyn" | ||
| Issues = "https://github.com/SMI-Lab-Inha/CableDyn/issues" | ||
| Changelog = "https://github.com/SMI-Lab-Inha/CableDyn/blob/main/CHANGELOG.md" | ||
| Releases = "https://github.com/SMI-Lab-Inha/CableDyn/releases" | ||
| Citation = "https://doi.org/10.1016/j.oceaneng.2026.128332" | ||
|
|
||
| [project.scripts] | ||
| cabledyn-run = "cabledyn.cli:main" | ||
| cabledyn-post = "cabledyn.post_cli:main" | ||
| cabledyn-deck = "cabledyn.deck_cli:main" | ||
| cabledyn-study = "cabledyn.study_cli:main" | ||
|
|
||
| [project.optional-dependencies] | ||
| dataframe = ["pandas>=2.0"] | ||
| plot = ["matplotlib>=3.7"] | ||
| post = ["pandas>=2.0", "matplotlib>=3.7"] | ||
| dev = [ | ||
| "pytest>=7", "pytest-cov>=5", "pandas>=2.0", "matplotlib>=3.7", "ruff>=0.15,<0.16", "mypy>=1.10", | ||
| ] | ||
|
|
||
| [tool.scikit-build] | ||
| minimum-version = "build-system.requires" | ||
| cmake.version = ">=3.20" | ||
| cmake.build-type = "Release" | ||
| # Only the products the wheel carries: the C-ABI library and the standalone driver (the test | ||
| # programs are configured but not built), installed into the package by the `python` component. | ||
| build.targets = ["cabledyn_shared", "cabledyn"] | ||
| install.components = ["python"] | ||
| wheel.packages = ["python/cabledyn"] | ||
| # The package reaches the library through ctypes, with no Python extension module: one wheel per | ||
| # platform serves every supported Python version. | ||
| wheel.py-api = "py3" | ||
| # The source distribution: every file git does not ignore except the validation records, the | ||
| # manual, the OpenFAST integration and the release tooling; it keeps the sources, the tests the | ||
| # CMake configuration registers, the examples they run and the Python package (gitignore-style | ||
| # patterns, anchored at the project root). | ||
| sdist.exclude = [ | ||
| "/validation/", "/doc/", "/integration/", "/release/", "/.github/", "/build*/", | ||
| "**/__pycache__/", "*.pyc", | ||
| ] | ||
|
|
||
| [tool.scikit-build.cmake.define] | ||
| # Serial like the release executables: no OpenMP runtime to bundle, and the same results on | ||
| # every machine. | ||
| CABLEDYN_ENABLE_OPENMP = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| """The published distribution (pyproject.toml) and the development package (python/pyproject.toml) | ||
| describe the same project: their [project] tables agree on everything but the readme and licence | ||
| files (paths relative to each file) and the classifiers (the platform wheels name their operating | ||
| systems and Fortran; the pure package is OS independent).""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import unittest | ||
| from pathlib import Path | ||
|
|
||
| try: | ||
| import tomllib | ||
| except ModuleNotFoundError: # Python 3.10 | ||
| try: | ||
| import tomli as tomllib | ||
| except ModuleNotFoundError: | ||
| tomllib = None | ||
|
|
||
| ROOT = Path(__file__).resolve().parents[1] | ||
| PER_FILE = {"readme", "license-files", "classifiers"} | ||
|
|
||
|
|
||
| def _project(path: Path) -> dict: | ||
| with path.open("rb") as fh: | ||
| return tomllib.load(fh)["project"] | ||
|
|
||
|
|
||
| @unittest.skipIf(tomllib is None, "needs tomllib (Python 3.11+) or tomli") | ||
| class PackagingMetadataTest(unittest.TestCase): | ||
| def setUp(self): | ||
| self.published = _project(ROOT / "pyproject.toml") | ||
| self.development = _project(ROOT / "python" / "pyproject.toml") | ||
|
|
||
| def test_the_two_projects_agree(self): | ||
| keys = (set(self.published) | set(self.development)) - PER_FILE | ||
| for key in sorted(keys): | ||
| with self.subTest(key=key): | ||
| self.assertEqual(self.published.get(key), self.development.get(key)) | ||
|
|
||
| def test_per_file_fields_point_at_existing_files(self): | ||
| self.assertTrue((ROOT / self.published["readme"]).is_file()) | ||
| self.assertTrue((ROOT / "python" / self.development["readme"]).is_file()) | ||
| for name in self.published["license-files"]: | ||
| self.assertTrue((ROOT / name).is_file(), name) | ||
| for name in self.development["license-files"]: | ||
| self.assertTrue((ROOT / "python" / name).is_file(), name) | ||
|
|
||
| def test_the_wheel_classifiers_differ_only_in_the_platforms(self): | ||
| published = set(self.published["classifiers"]) | ||
| development = set(self.development["classifiers"]) | ||
| self.assertEqual(development - published, {"Operating System :: OS Independent"}) | ||
| self.assertEqual( | ||
| published - development, | ||
| { | ||
| "Operating System :: Microsoft :: Windows", | ||
| "Operating System :: POSIX :: Linux", | ||
| "Operating System :: MacOS", | ||
| "Programming Language :: Fortran", | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the documented GNU/conda Windows toolchain, CMake enables
CABLEDYN_BLAS_RUNTIME_LOAD, which deliberately removes OpenBLAS from the binaries' imports;src/cabledyn_blas.cinstead loadsopenblas.dllby name at runtime. The newpythoncomponent installs only the two CableDyn binaries, while the existing runtime-DLL installation belongs to a different component. Consequently, ordinary import-table-based wheel repair will not discover this dependency, and the resulting wheel cannot initialize models on a clean Windows machine without OpenBLAS on PATH. Explicitly include this runtime dependency and arrange for both the packaged library and driver to find it rather than relying solely on automatic wheel repair.Useful? React with 👍 / 👎.