scikit-build-core
scikit-build-core copied to clipboard
Question: Is There a Way to Enable Extras in `tool.scikit-build.overrides`?
Context
I am working on a project where I want to enable conditional features, specifically MPI support, using Python extras during installation:
pip install .[mpi]
I have defined optional dependencies in my pyproject.toml
like this:
[project.optional-dependencies]
mpi = ["mpi4py"]
I want to conditionally enable MPI in the build configuration, and I tried using the [[tool.scikit-build.overrides]]
section to detect when the mpi
extra is used:
[[tool.scikit-build.overrides]]
if = "extra == 'mpi'"
cmake.define.ENABLE_MPI = "ON"
However, this results in an error:
"extra == 'mpi'" is not valid under any of the given schemas.
Question
Is there currently a way to conditionally apply overrides based on extras (e.g., extra == 'mpi'
) within the tool.scikit-build.overrides
section?
Suggestion (If Not Currently Supported)
If this feature is not currently supported, would it be possible to introduce support for matching extras within the overrides
section? This would make it easier to enable specific build configurations based on user-specified extras, aligning with Python’s optional-dependencies
mechanism.
Thank you for your time and assistance!
Environment Details
-
scikit-build-core
version:0.10.7
- Python version:
3.12
- Platform:
Linux