-
Our package REBOUNDx builds a C extension, which needs to link to a C extension in another package REBOUND (without the x!). How do I configure my pyproject.toml file to do this correctly on different operating systems? In particular, we would strongly prefer for the wheel to not package the REBOUND C extension dependency, but rather have it locate it on the target machine so that different users could have different combinations of REBOUND and REBOUNDx versions that aren't tied to each other. Is this a misunderstanding of how wheels work? Is the libreboundx.so shared library already pre-built in the wheel (so that there is no hope of setting the correct user-specific paths at wheel installation time)? I tried using --exclude librebound.so in the wheel repair step, which built the wheel successfully, but when I try to install from it and import reboundx, I get
In setup.py, we deal with this by importing rebound and getting the path to where it's installed in a couple ways
then append these to self.library_dirs, and ext.runtime_library_dirs, extra_link_args for ext in self.extensions. Any help/pointers would be most appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
It seems like the symbols from |
Beta Was this translation helpful? Give feedback.
-
Unfortunately not @joerick. Here's what I don't understand conceptually: In the regular setup.py build, when we build libreboundx.so, we need to set all the link paths and rpaths correctly to where the user has their installation of the librebound.so library. When we build a wheel, are we building the C extension on our own local computer and then packaging that into the wheel? If so, it seems like wheels will not work for this type of project, since we can't know what user-specific paths to set at the time we build the wheel. Are there any hooks available that lets us write python code that runs at the end of installing the wheel (that we could use to find where librebound.so is installed and set the appropriate paths at the end?). Or is the only option to also package librebound.so inside our wheel for reboundx? |
Beta Was this translation helpful? Give feedback.
-
Thanks @Czaki, I think that clears everything up. Really appreciate both your help! |
Beta Was this translation helpful? Give feedback.
Wheels is the format for unpack and use. If you need to execute code on installation, you need to use sdist.
If you would like to use wheels you need to ship librebound.so or create a separate specialized package whose purpose is only to determine the path to
librebound.so
during installation time and export it in a form readable by the main package.