coin-or / CyLP

A Python interface to CLP, CBC, and CGL to solve LPs and MIPs.
Other
182 stars 68 forks source link

Use cibuildwheel #154

Closed mkoeppe closed 2 years ago

mkoeppe commented 2 years ago

https://cibuildwheel.readthedocs.io/en/stable/

tkralphs commented 2 years ago

I briefly tried this and it looks great, but it's non-trivial. Building the extension is easy, but we also need to somehow build or install Cbc itself and it's not exactly clear how to do that.

mkoeppe commented 2 years ago

Do you know which version / configuration of Cbc you want in the prebuilt wheels?

tkralphs commented 2 years ago

The latest 2.10 release should do. I tried installing the Cbc package with yum, but it didn't know about the package. I'm not sure of the best way to get it installed. I thought about trying to use brew. The documentation for doing complex installs in the image before building the wheel is not very detailed.

mkoeppe commented 2 years ago

Do you have a branch that you can share?

tkralphs commented 2 years ago

I'm not sure what you mean. A branch of Cbc?

mkoeppe commented 2 years ago

PR for cylp with how you tried out cibuildwheel

mkoeppe commented 2 years ago

I tried installing the Cbc package with yum, but it didn't know about the package.

manylinux2014 is based on centos-7 for maximum compatibility, one can't rely on distribution packages there for anything recent. https://github.com/pypa/manylinux#manylinux

tkralphs commented 2 years ago

PR for cylp with how you tried out cibuildwheel

Oh, I see. No, I didn't try it out within a CI workflow. I just tried to run it locally, which is easy: just execute cibuildwheel --platform linux in the root of the git repo.

manylinux2014 is based on centos-7 for maximum compatibility, one can't rely on distribution packages there for anything recent. https://github.com/pypa/manylinux#manylinux

Right, but even an old Cbc would be fine for getting something running initially to see how it works. I thought there was some chance and worth a try, but also not surprised it failed.

mkoeppe commented 2 years ago

coinbrew is probably the best approach to provision cbc for it

tkralphs commented 2 years ago

You can do, e.g., export CIBW_BEFORE_ALL='apt install libpng-dev' to specify arbitrary commands that should be run before building the wheel. It wasn't clear to me how much you could pack into that. Can I put any bash that I want? I assume git is available? So can I give a one-liner that will download coinbrew and build Cbc? This is easy to try, but I just don't have the bandwidth to go down more rabbit holes at the moment.

mkoeppe commented 2 years ago

It's not urgent and shouldn't hold up the release

mkoeppe commented 2 years ago

You can do, e.g., export CIBW_BEFORE_ALL='apt install libpng-dev' to specify arbitrary commands that should be run before building the wheel. It wasn't clear to me how much you could pack into that. Can I put any bash that I want?

Yes, the examples at https://cibuildwheel.readthedocs.io/en/stable/options/#before-all illustrate this