--- jupyter: description: Build planex2d from source with CMake and scikit-build-core, run its tests, and contribute. --- # Building and contributing planex2d is a C++20 library with Python bindings (pybind11), built with CMake through scikit-build-core. The sources are at . ## Requirements - a C++20 compiler (GCC, Clang or MSVC) and CMake 3.20 or newer; - Python 3.11 or newer; - netgen and the OpenCASCADE headers, which by default come from the pip packages of the Python that builds, so that no OpenCASCADE installed elsewhere on the system is picked up; - optionally `ccache`, which is used automatically when found. Eigen and Taskflow are included in `external_dependencies/`; pybind11 comes with the netgen-mesher package. ## Build ```bash git clone https://github.com/planex2d/planex2d cd planex2d pip install netgen-mesher netgen-occt-devel scikit-build-core pip install --no-build-isolation -e . ``` The editable install rebuilds the C++ part on the next `import planex` after a source change. Two settings change the build: - `NETGEN_CMAKE_DIR=/path/to/netgen/cmake` builds against another netgen, for example a netgen built from source; - `-Ccmake.define.PLANEX_CONSTRAINTS=OFF` builds without the constraint sketch and its solver, so `px.Sketch` is then missing, while `px.QuickSketch` remains. ## Tests ```bash pip install pytest hypothesis shapely pytest tests ``` The randomized fuzz tests share a time budget of 30 seconds, and `--fuzz-seconds 600` gives them more. See [Testing](testing.md) for how planex2d is tested. ## Contributing Bugs and changes go through the issues and pull requests of the repository. A change comes with tests for what it fixes or adds, and the whole test suite passes before it is merged.