-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Migration to scikit-build-core
#65
Comments
I am aware of the I did have a look at this last year when development on |
Thanks for clarifying the blocking feature. I am not sure I understand what is meant with Have you also checked the I can also share my project for design reference. It's basically split in CMake subprojects so that it can build as a monolith, or individual components, like the python interface only. |
https://github.com/rapidfuzz/RapidFuzz/blob/main/setup.py is the setup script This behaves in the following way:
I don't believe 2) can be implemented using In addition one pre-requirement for 2) is that cmake and ninja are only installed using pip if:
I currently implement this pre-requirement in https://github.com/rapidfuzz/RapidFuzz/blob/main/_custom_build/backend.py. Not sure whether this is already supported by |
Couldn't this be controlled within CMake, e.g. adding an advanced option
The default is to try the system first and then fallback to pip. Version checking is implemented. Changing the preference order would be tricky for packagers. |
Yes but this breaks in the following case:
In this case I still want the fallback version to be installed. This pretty much rules out any solutions that are implemented in cmake.
Maybe that would be possible. I don't know how I can allow
I am not familiar with this option. So not sure how it would help me in my particular case. |
Aaah, now I understood. Wow that's a tricky set of conditions to support. Kudos for the extra consideration put. In that case I am truly lost. How are the pure-python files supposed to work in that case, maybe there is a design using multi-python project like
Why would it fail? This is defined in
Here's an example. Hopefully the naming is enough to indicate what it does in that case. |
I install the Python and C implementations side by side and import the fastest version available. Essentially when the library is imported I try the following imports:
If the user specifically wants to get the C++ or Python variant he can override the behaviour by setting the This allows everyone to get as fast of an implementation as possible without losing the compatibility provided by a pure Python implementation. Most users will get the C++ implementation through binary wheels or their package manager anyway. So this really only affects more exotic targets. The downsides of the implementation are:
I just assumed that's what's registering it to be compiled as well. All I really wanted to say is that I don't know how I would mark this using an |
Interesting, it's different to my situation when I want to link to either system or python bundled library. In your case I would definitely split into 2 packages making the pure python an optional dependency but preferred in import workflow (just to give the user maximum control). Dealing with
Didn't know about pyinstaller, and indeed it seems fairly dangerous. That seems like a nightmare to support even in pure-python.
Ah, I thought you were concerned about configure stage failures. If it's build stage, you have a bit more control on scikit-build-core if you filter specific build targets. |
I think this can be supported with a few more override settings. We could provide:
Should we allow The cmake one would trigger if you were not on a platform with a known cmake wheel and there's no sufficient CMake present, or always if there's no system CMake. If this matches, This is what pure-python on non-supported CMake system would look like: [[tool.scikit-build.overrides]]
if.no-system-cmake = "known-wheel"
wheel.cmake = false Or if the build fails: [[tool.scikit-build.overrides]]
if.failed = true
wheel.cmake = false Custom message on failure: [[tool.scikit-build.overrides]]
if.failed = true
error-message = "The build failed!" I think this would add a lot of flexibility; for an unrelated example, you could fail on unsupported Pythons: [[tool.scikit-build.overrides]]
if.python-version = ">=3.13"
error-message = "Python 3.13+ is not supported yet!" I'm looking at a way to allow the cmake wheel to trigger the bootstrapping feature, and I think this would be a step in that direction too. This is a very rough draft of what I'm thinking. |
I assume with this I could implement my handling as:
|
I think we should make the error-message only appear if the build fails, and add a |
Yes I think this would cover all of my needs and would be a lot more concise than my current implementation with I will start a branch porting over the existing set of features and extend it as things get added to |
FYI, if.any.env.CIBUILDWHEEL = true Will do truthy/falsey values. |
Any ideas for better naming on |
No clue from my side. To me |
That great, that's what it is supposed to be, except I'm not sure how to indicate the "and there's no known wheel for this platform" condition. |
To me |
I migrated this project to scikit-build-core. The implementation for rapidfuzz still requires a little more work. However everything required should be in scikit-build-core now. |
It is recommended that projects migrate from
scikit-build
toscikit-build-core
when possible. Most development is focused there and it is a very CMake friendly and pythonic build system. For now I only wanted to create an issue to get your opinion on this and track the progress of such migration. If you have questions or need help, feel free to ask.The text was updated successfully, but these errors were encountered: