-
Notifications
You must be signed in to change notification settings - Fork 54
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
how to find PythonExtensions
#966
Comments
If you use scikit-build (classic), then that tutorial will work, and |
Ok, thank you. Where can I find documentation on the CMake things that scikit-build and scikit-build-core provide? I want to be as independent as possible! My goal is to redo my build system for a C++/Python library using Boost.Python (so I can finally hopefully distribute pre-compiled binaries, a goal that's long challenged me), and I'm working to build a minimal example since the examples don't include such an example. For example, my question next is about linking needed libraries to my
The error I get is
I can get it to work by adding the Another thing vexing me is how to get scikit-build-core / CMake / pip to install both a built C++/.so library AND a pure-python library that imports the .so and makes calls into it. I haven't found an example of that yet. Is there one in the documentation for scikit-build-core? Thanks for your time! |
Regarding dependencies though, you can bundle them and download them as needed using
This is a rather more complex design question, and it can be handled in various ways depending on what are your requirements. I generally ask the question where do you want to package and support your project (PyPI, conda, spack, distro packages)? Each of these will put some constraints on the design and guide you to some good practices for each environment. Another important aspect is what is your intended user experience after As for reference projects, I do not believe we have any official ones to recommend, but maybe @henryiii has some good references. My design in Footnotes |
Thank you for your thorough reply. I have a working CMake build setup already for my library, but it still feels piecemeal, in that pip installing from the repo isn't connected to compilation (yet). My tool consists of three pieces:
Getting all three built and installed currently takes three steps, and they feel disconnected, and it's a barrier to people using my tools. I desperately need it to be pip- or conda-installable. I certainly would welcome a complete model example for packaging and distribution of a library built using C++ and Python; not just building, but how to get it all the way into the distribution pipeline. My highest goal is I think we're close to the end of this thread, which has now wandered from the title of this thread. To conclude, do you have advice or resources for closing the gap between a public repo on github and installation via pip, for such a library as I'm working with? That's what brought me to scikit-build in the first place. I keep finding examples that do one step or another, but nothing that's end-to-end (and maybe such an example would be too specific, but here I am, needing to solve this problem, and it continues to be challenging to me). Thanks again, I really appreciate your time. |
Following up a bit for myself to help bring this nearer to closure, |
Progress updatesOk, I'm much further than last time. I'm working on a complete example repo that solves all of the bottle necks I have been working on. I now have the ability to compile the pieces, and I'm back to a scikit-build question, I think. My pieces:
From top level, I can build the non-python pieces and they install correctly. And, the Python bindings build at the same time, which is a nice improvement. But, the bindings don't install to the correct place, and the pure-python part isn't tied to the rest. My scikit-build questions are...For a directory structure that looks like
|
It's best to put pyproject.toml in the top level. That will work best. You don't have a setup.py, that's a setuptools file. You do have a CMakeLists.txt file, which can go either place, but I'd guess it's best top level also since you have a The default for If you use cmake targets and install commands, all the components should get installed. |
Here is an excessive answer, but I think the design that you want is similar to mine so I am sharing some organization notes.
To add on Henry's answer, you are constrained by what sources do you need when building the project, i.e. starting from the folder that contains the
|
Perfect, this is what I will do. |
Thanks to help in scikit-build/scikit-build-core#966, this example now installs the bindings to the same folder as the pure-python wrapper. can now successfully ``` import example print(example.foo()) ``` where `example.foo` is a binding function via Boost.Python which calls `example::core_function` from the pure c++ core library
Now something that feels unrelated, but is also part of the design choice we're talking about. From the packaging.python.org documentation,
Another question follows, particularly for @LecrisUT : how to do versioning, since the three pieces are separate. In the "real" library I will apply all these lessons to, I have separate version numbers, and I would appreciate advice on this, since updates in various pieces need to reflect each other's compatibility. Or do I not worry about that? I ask because the I think:
Changes happen, and as they effect changes in higher layers, i just increase version numbers using semantic versioning. Is this right? |
Good question. One way is to regex from the The matching version dependency though that is harder and we don't have dynamic dependencies field in |
I'm trying to use scikit-build-core for a C++ project that generates Python bindings, and I'm stuck at an early step. I've tried to follow the tutorial, and I can't even get that to work because I can't get CMake to find
FindPythonExtensions.cmake
. I'm writing to ask for help making sure this.cmake
file is available.I've seen a number of projects online that use your tool, and their CMakeLists.txt files contain the line
I just cannot get this step to succeed. All I can get is
I can see the necessary file
FindPythonExtensions.cmake
as part of my scikit-build installation atsite-packages/skbuild/resources/cmake
. But I do not know how to programmatically get the location of this file to add it to myCMAKE_MODULE_PATH
. To that end, I've tried running a Python script viaEXECUTE_PROCESS
a la this forum post, but I cannot get it to succeed for the life of me.Am I supposed to take a copy of
FindPythonExtensions.cmake
into my repo? Why doesn't scikit-build-core find it when I invokepip install .
to build and install my library?The text was updated successfully, but these errors were encountered: