pytaglib icon indicating copy to clipboard operation
pytaglib copied to clipboard

Binary wheels for Linux/MacOS

Open titusz opened this issue 3 years ago • 3 comments

Would there be interest in publishing binary wheels for Linux/MacOS? I am bad a packaging but after an extended trial & error session I managed to build the wheels including shared libs. See https://github.com/titusz/pytaglib/actions/runs/1976308688

I also did a test deployment/install with self-hosted pypi repository (https://github.com/iscc/iscc-sdk/actions/runs/1976431714) and the wheels seem to work fine. (Also added py37)

titusz avatar Mar 13 '22 13:03 titusz

Thanks for your initiative. I am unsure about Mac OS (don't have any experience with that OS), but regarding Linux I would be afraid that publishing binaries can cause problems, as there are so many different distributions, using different versions of Python, GCC, etc.

supermihi avatar Mar 16 '22 20:03 supermihi

I am also not sure if the Linux binaries can cause problems. I built them with manylinux. Their claim is "Python wheels that work on any Linux (almost). 🤷

titusz avatar Mar 16 '22 21:03 titusz

Ok I see they write: PEP 600 has been designed to be "future-proof" and does not enforce specific symbols and a specific distro to build. It only states that a wheel tagged manylinux_x_y shall work on any distro based on glibc>=x.y. So I guess pip would only install the wheels on a compatible system. According to the documentation, with the manylinux_2_24 builds that would be: ALT Linux 10+, Debian 11+, Fedora 34+, Mageia 8+, Photon OS 3.0 with updates, Ubuntu 21.04+ ...

titusz avatar Mar 16 '22 21:03 titusz

I've been looking into this a bit since especially macOS can be a lot of pain right now without wheels. It seems like https://cibuildwheel.readthedocs.io/en/stable/ is a very useful tool for building wheels for all relevant platforms on Github Actions, it even supports cross-compiling for macOS x86_64 and arm64.

It will need a bit of work, since installing taglib on macOS via homebrew won't work for that. Cross-compiling for arm64 will require the macOS wheel build to get a compiled version for arm64 (meaning probably building it manually in the action). FYI: Python for macOS supports so called universal2 wheels that contain compiled code for x86_64 AND arm64, but currently recommends to still upload x86_64 and either universal2 or arm64 wheels for compatibility (there was a bug in pip in earlier versions that broke universal2 on x86_64)… keeping this in mind I'd recommend to just upload x84_64 and arm64 and avoid universal2 for now.

I'd assume that building manylinux wheels should be fine too, considering other Python libs have been building them for a while now. See for example: https://pypi.org/project/numpy/#files

@supermihi would you be interested in refactoring the current Github Action workflow to utilize cibuildwheel for all three platforms? I'm willing to help with this, but don't have a M1 Mac yet, so I'd only be able to test macOS x86_64 wheels.

strayer avatar Oct 27 '22 18:10 strayer

For anybody looking for binary wheels see https://pypi.org/project/pytaglib-wheel/#files NOTE: Outdated/Deleted - use official pytaglib package

titusz avatar Mar 11 '23 12:03 titusz

Hi @strayer and @titusz, sorry for being inactive. I've finally found some time during the last days to dig into the bloody details of cibuildwheel etc., and managed to successfully build & test binary wheels for almost all platforms.

As a part of that effort, I decided to always build a custom native taglib instead of relying on the system-provided version, which has multiple benefits (no native deps for end users, always up-to-date taglib, no native deps in CI), so it is even possible to build macOS arm64 wheels.

Thanks for your research & help that made this possible!!

supermihi avatar Mar 26 '23 12:03 supermihi

@titusz thanks also for taking the initiative to upload wheels as pytaglib-wheels on pypi. The only thing that bothers me a bit is that the package looks like it is an official build of pytaglib (same readme, homepage, contact information etc.).

For the purpose of software supply chain security, I'd kindly ask you to add some sort of note to the PyPI project description, clarifying that these packages are inofficial. Hopefully, with the plethora of wheels that the "official" pytaglib includes from version 2.0.0, the separate project will not be necessary anymore in the first place (please let me know if you miss some arch/python/OS combination!).

supermihi avatar Mar 26 '23 12:03 supermihi

Hi @strayer and @titusz, sorry for being inactive. I've finally found some time during the last days to dig into the bloody details of cibuildwheel etc., and managed to successfully build & test binary wheels for almost all platforms.

No worries, I had some initial work on a PR but never got around finalizing it.

As a part of that effort, I decided to always build a custom native taglib instead of relying on the system-provided version, which has multiple benefits (no native deps for end users, always up-to-date taglib, no native deps in CI), so it is even possible to build macOS arm64 wheels.

Completely agree and would have done it the same way! Skimmed over your changes and they look great 👍🏻

I'll try to do some tests on macOS arm64 soon.

Thanks for your research & help that made this possible!!

Thank you for working on and maintaining this library! ❤️

strayer avatar Mar 26 '23 12:03 strayer

For the purpose of software supply chain security, I'd kindly ask you to add some sort of note to the PyPI project description, clarifying that these packages are inofficial. Hopefully, with the plethora of wheels that the "official" pytaglib includes from version 2.0.0, the separate project will not be necessary anymore in the first place (please let me know if you miss some arch/python/OS combination!).

Thank you for releasing binary wheels 👍 . I am actually very happy that I can yank/delete my distribution from PyPi. I let you know when its done.

titusz avatar Mar 26 '23 12:03 titusz