SWI-Prolog / packages-swipy

Python interface for SWI-Prolog
42 stars 6 forks source link

Package a swi-prolog binary with the binary wheels #14

Open rmanhaeve opened 3 weeks ago

rmanhaeve commented 3 weeks ago

Hi

Thank you for your work on Janus and SWI-Prolog in general.

I was wondering if you had considered packaging a (minimal) binary of SWI-Prolog along with the binary distributions of this package. This would greatly simplify the installation procedure (especially for other projects that have janus_swi as a dependency), and I would imagine this could also boost the popularity of SWI-Prolog as an easy to install package along all platforms.

Kind regards, Robin Manhaeve

JanWielemaker commented 3 weeks ago

Thanks for the heads up and suggestion. Considered? Sort of :smile: There are many possible installation targets though and it is hard to me to judge the value and costs of all the alternatives. I've spent some time turning SWI-Prolog into an (ana)conda package. It sort of works with some limitations and getting it all setup and distributed seems a lot of work.

Binary wheels also come with their issues on the various platforms. I have very limited understanding of the Python binary package management. If people want to set this up, I'm happy to help from the Prolog side.

I heard some rumours that the wheel could also download and install the regular binary? Do you have any insight in that?

rmanhaeve commented 2 weeks ago

I'm not an expert myself, but I have a bit of experience in compiling external dependencies for binary wheels. We can make use of cibuildwheel and the Github-hosted runners to build the binary for basically all common platform.

Is there a way to build SWI Prolog with minimal dependencies?

JanWielemaker commented 2 weeks ago

Is there a way to build SWI Prolog with minimal dependencies?

Configure using cmake -DSWIPL_PACKAGES=OFF -DUSE_GM=OFF ... Then the only dependency is zlib.

I'm still a bit in doubt on how good an idea this is as it results in a quite crippled SWI-Prolog version. Possibly a better choice is to select all packages that do not pull in new dependencies. That can be done using cmake -DSWIPL_PACKAGE_LIST="clib;plunit;sgml;semweb;chr;clpqr;nlp;yaml;swipy" -DUSE_GM=OFF ... With a bit of tweaking we can probably get in some more (might even have forgotton some).

If you can get this working (even without any packages), I'm happy to jump in and try to add some more functionality.

rmanhaeve commented 2 weeks ago

I'll try to get a minimal case working in a fork, I'll update here when I've made some progress.

rmanhaeve commented 2 weeks ago

Which files from the build directory need to be included?

JanWielemaker commented 2 weeks ago

Which files from the build directory need to be included?

You need to run make install (or ninja install). Set -DCMAKE_INSTALL_PREFIX=dir to control the base location. I'd assume there are more examples around of creating wheels from cmake configured applications.