Repository navigation
build: self-contained pip-installable Python wheel - #9
Merged
Merged
Conversation
`pip install ./bindings/python` now builds and bundles the native C ABI — no separate manual C++ build. Closes the last Tier-1 adoption item. - Switch the binding to a scikit-build-core backend that drives the repo-root CMake build during pip install/wheel. - New CYBERFLUIDS_PYTHON_WHEEL CMake path: forces the pinned FetchContent NumPP built static + PIC, links it into libcyberfluids_c, and links libtbb with a DT_NEEDED entry on Linux. The result is a single self-contained shared library (no external libnumpp runtime dependency) installed into the `cyberfluids` package via its own `python` install component (so the fetched NumPP's own install rules stay out of the wheel). - For the wheel build, skip find_package(NumPP) so an installed *shared* NumPP under .deps can't sneak in and break self-containment. - __init__.py loads the bundled library from the installed package first, keeping the build-tree fallback for in-repo development and the $CYBERFLUIDS_LIBRARY override. - Add bindings/python/README.md (PyPI long description) with install + usage. Verified in a clean venv: `pip install ./bindings/python` compiles the C ABI, `import cyberfluids` loads the bundled .so from site-packages, and both a 2D cavity and a 3D wind tunnel run and return NumPy fields. `ldd` confirms no libnumpp dependency. Normal (non-wheel) build + native tests unaffected. Docs/spec kept in sync: build-and-packaging spec gains a "self-contained Python wheel" requirement; getting-started, roadmap, and CHANGELOG updated. openspec validate --all --strict passes (14/14).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes the last Tier-1 adoption item:
pip install ./bindings/pythonnow builds and bundles the native C ABI, soimport cyberfluidsworks with no separate manual C++ build.How
pip install/pip wheel.CYBERFLUIDS_PYTHON_WHEELCMake path:libcyberfluids_c→ a single self-contained.sowith no externallibnumppdependency;libtbbwith aDT_NEEDEDentry on Linux (--no-as-needed);cyberfluidspackage via its ownpythoninstall component, so the fetched NumPP's own install rules stay out of the wheel.find_package(NumPP)is skipped so an installed shared NumPP under.depscan't break self-containment.__init__.pyloads the bundled library from the installed package first (build-tree fallback and$CYBERFLUIDS_LIBRARYoverride retained).bindings/python/README.md(PyPI long description).Verification (clean venv)
lddon the bundled.so: nolibnumpp, no missing deps (only systemlibtbb/libstdc++). The 3 localpython_*ctest failures remain the known Anacondalibstdc++shadow (worked around here withLD_PRELOAD); CI's system Python is unaffected. Normal (non-wheel) build + all native tests unaffected.Docs/spec
build-and-packagingspec gains a "self-contained Python wheel" requirement (+ scenarios);getting-started.md,roadmap.md, andCHANGELOG.mdupdated.openspec validate --all --strict→ 14/14.Follow-up (not in scope)
Publishing a manylinux wheel to PyPI (bundling
libtbb/libstdc++viaauditwheel) is the remaining step forpip install cyberfluidsfrom the index — tracked on the roadmap.