build(cmake): only allow to build as python extension - #152
Conversation
|
Docs preview: https://pr-152.monoprop-docs.pages.dev |
a3a3686 to
a8aa7c6
Compare
4e6f1e6 to
afd0488
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #152 +/- ##
===========================================
+ Coverage 84.66% 95.31% +10.64%
===========================================
Files 59 14 -45
Lines 4239 704 -3535
Branches 1497 88 -1409
===========================================
- Hits 3589 671 -2918
+ Misses 254 20 -234
+ Partials 396 13 -383
Flags with carried forward coverage won't be shown. Click here to find out more. |
ddc660a to
d9fd7a3
Compare
|
The PR is still in progress, it's not marked as draft as I need all CI jobs to run on each commit to check I'm not losing functionality. Sorry for the confusion! |
0485838 to
dad84db
Compare
|
this will also need to be merged by bypassing requirements, since the job names changed. Plus a change in required checks in the ruleset. |
|
This is now ready-ready to review |
There was a problem hiding this comment.
Pull request overview
This PR refactors the build/CI tooling to treat monoprop as a scikit-build-core–driven Python extension only, removing the remaining “standalone CMake project” pathways, and reshaping install + test/coverage flows around the editable build trees that uv sync creates.
Changes:
- Make top-level CMake configuration scikit-build-core–centric (with direct-CMake invocation discouraged) and gate C++ unit tests behind a dedicated option.
- Rework CMake install and header handling to use
target_sources(FILE_SET ...), installing artifacts under the Python package layout. - Simplify developer/CI workflows (presets, VS Code tasks, just recipes, GitHub Actions) to build/test via the scikit-build-core editable trees and consolidate coverage.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Removes gcovr and its transitive lock entries from the locked environment. |
pyproject.toml |
Drops gcovr from dev deps; updates cibuildwheel env to explicitly disable C++ unit tests during wheel builds. |
CMakeLists.txt |
Moves to scikit-build-core–first configuration, adds monoprop_ENABLE_CXX_UNIT_TESTS, and gates tests/cpp accordingly. |
src/CMakeLists.txt |
Updates CMake package config install location and version-file generation for the new install layout. |
src/monoprop/CMakeLists.txt |
Switches to FILE_SET-based header installation, adjusts install destinations under the Python package, and reorganizes subdirectories. |
src/monoprop/bindings/CMakeLists.txt |
Removes local Python discovery, updates compile flag handling, and rewrites RPATH logic for the new package layout. |
src/monoprop/algebra/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/core/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/detail/CMakeLists.txt |
Adds explicit header listing via FILE_SET and enumerates detail subdirectories. |
src/monoprop/detail/evolution/CMakeLists.txt |
Adds explicit header listing via FILE_SET and includes layer_build. |
src/monoprop/detail/evolution/layer_build/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/detail/graph/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/detail/graph_encoding/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/detail/monomial_propagator/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/detail/mpi/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/detail/operator/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
src/monoprop/detail/pare/CMakeLists.txt |
Adds explicit header listing and adds PareGraph.cpp as a private source. |
src/monoprop/detail/partition/CMakeLists.txt |
Adds explicit header listing via FILE_SET. |
tests/cpp/CMakeLists.txt |
Ensures CPM is included and configures msgpack-cxx via CPM for the C++ test suite. |
tests/cpp/boostAddTests.cmake |
Labels C++ tests with cxx for CTest filtering/reporting. |
justfile |
Consolidates test recipes and reworks the coverage flow to run via scikit-build-core editable trees. |
CMakePresets.json |
Replaces standalone configure/build/test presets with “adopt existing skbuild tree” presets. |
.vscode/tasks.json |
Switches VS Code tasks to uv sync-based install modes (Release/Debug/Coverage). |
.vscode/settings.json |
Disables CMake Tools auto-reconfigure and enables CTest Explorer integration for adopted build trees. |
.github/workflows/test.yml |
Overhauls CI into package-centric matrix runs, adds find_package(monoprop) smoke test, runs C++ unit tests via ctest, and consolidates coverage jobs. |
.github/workflows/docpages.yml |
Sets env to disable C++ unit tests for docs builds. |
.github/workflows/copilot-setup-steps.yml |
Sets CPM_USE_LOCAL_PACKAGES and updates uv sync invocation for setup. |
.devcontainer/postStartCommand.sh |
Makes prek install overwrite existing hooks in the devcontainer. |
ae25e7c to
2587fab
Compare
When needed, can be run as uvx gcovr, using an ephemeral environment
There is a single job running on ubuntu-26.04 with python 3.11 collecting coverage information from: * Python tests * C++ unit tests * line hits from calling the C++ compiled code from the Python API
Thus avoiding a rebuild when invoking pytest
Fallout from removing most of the cmake presets
Needs lcov format, plus some workarounds, to merge the Python and C++ results.
edd6db8 to
88dfbf7
Compare
|



By opening this PR I confirm that I have read CONTRIBUTING.md and I agree to the terms of the Contributor License Agreement.
Summary
This project is purely a Python extension but the build system, and configuration around it, still offered the (vestigial) option of building as a C++-only project.
Re-hash of #106, where I made a hideous mistake with the git history.
Changes
Remove CMake code that allowed to build as a standalone C++ project, as that is no longer meaningful. A warning is issued against compiling with direct invocation to CMake.
C++ unit tests are gated behind a new CMake option
monoprop_ENABLE_CXX_UNIT_TESTS, which is ON by default.CMakePresets.jsonchanged accordingly, as it's effectively only needed for test autodiscovery.Edit
justfileto account for loss of many presets for CMake.Overhaul CMake code for installation of artifacts. The package is installed under
lib/python3.X/site-packages/monopropall other artifacts are installed in subfolders of it:libmonoprop.sois underlib(orlib64, depending on the machine)includewith the proper hierarchical folder structurecmakeThe header files are now explicitly listed (instead of globbed) and we usetarget_sourceswithFILE_SETpento handle them sanely (instead of appending to a global list)I have dropped the distinction between private and public for now.
Simplified
test.ymlaccordingly:Checklist
docs/,CONTRIBUTING.md) if neededCHANGELOG/ release notes updated if applicableAI/LLM disclosure
This is part 1 of 3 in a stack made with GitButler: