libgpiod
libgpiod copied to clipboard
Publish wheels to pypi
There are a number of reasons to provide precompiled wheels:
- Not all distributions provide compiler support and thus cannot compile sdists
- For space constrained or "sealed" systems, distributors/admins may not deploy toolchains due to disk requirements or to prevent people from deploying unapproved binaries
- Performance-wise, it's cheaper to unpack a wheel vs downloading the sdist, building, and installing the result.
- The time it takes either on a commandline for a maintainer or a CI pipeline is a one-time cost and requires less time & energy vs the requirement that 1000s of machines build and deploy the binaries (if they even can).
- Having public wheels means people don't have to spin up their own pypi server to host their built wheels because they can just use the upstream package.
Building wheels on the command line or via pipeline is generally pretty straightforward. There is a utility called cibuildwheel that accomplishes most of this by using containers with very specific combinations of toolchains and utilities to build libraries that will work across distributions, generally rooted off of the major glibc version available.
From the command line, with an sdist:
vfazio@vfazio4 /tmp/tmp.nYZrtOYERx $ wget https://files.pythonhosted.org/packages/a8/56/730573fe8d03c4d32a31e7182d27317b0cef298c9170b5a2994e2248986f/gpiod-2.1.3.tar.gz
--2024-03-05 08:23:48-- https://files.pythonhosted.org/packages/a8/56/730573fe8d03c4d32a31e7182d27317b0cef298c9170b5a2994e2248986f/gpiod-2.1.3.tar.gz
Resolving files.pythonhosted.org (files.pythonhosted.org)... 199.232.96.223, 2a04:4e42:58::223
Connecting to files.pythonhosted.org (files.pythonhosted.org)|199.232.96.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 53092 (52K) [application/octet-stream]
Saving to: ‘gpiod-2.1.3.tar.gz’
gpiod-2.1.3.tar.gz 100%[==============================================================================================================>] 51.85K --.-KB/s in 0.02s
2024-03-05 08:23:49 (2.54 MB/s) - ‘gpiod-2.1.3.tar.gz’ saved [53092/53092]
vfazio@vfazio4 /tmp/tmp.nYZrtOYERx $ tar -xf gpiod-2.1.3.tar.gz
vfazio@vfazio4 /tmp/tmp.nYZrtOYERx $ cd gpiod-2.1.3/
vfazio@vfazio4 /tmp/tmp.nYZrtOYERx/gpiod-2.1.3 $ python3 -m venv venv
vfazio@vfazio4 /tmp/tmp.nYZrtOYERx/gpiod-2.1.3 $ . venv/bin/activate
(venv) vfazio@vfazio4 /tmp/tmp.nYZrtOYERx/gpiod-2.1.3 $ pip install cibuildwheel
</snip>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 69.5/69.5 KB 14.5 MB/s eta 0:00:00
Installing collected packages: typing-extensions, tomli, platformdirs, packaging, filelock, certifi, bracex, bashlex, cibuildwheel
Successfully installed bashlex-0.18 bracex-2.4 certifi-2024.2.2 cibuildwheel-2.16.5 filelock-3.13.1 packaging-23.2 platformdirs-4.2.0 tomli-2.0.1 typing-extensions-4.10.0
(venv) vfazio@vfazio4 /tmp/tmp.nYZrtOYERx/gpiod-2.1.3 $ CIBW_BUILD='cp3*' cibuildwheel --platform linux --archs x86_64,aarch64
_ _ _ _ _ _ _
___|_| |_ _ _|_| |_| |_ _ _| |_ ___ ___| |
| _| | . | | | | | . | | | | | -_| -_| |
|___|_|___|___|_|_|___|_____|_|_|___|___|_|
cibuildwheel version 2.16.5
Build options:
platform: linux
architectures: aarch64, x86_64
build_selector:
build_config: cp3*
skip_config:
requires_python: >=3.9.0
prerelease_pythons: False
container_engine: docker
output_dir: /tmp/tmp.nYZrtOYERx/gpiod-2.1.3/wheelhouse
package_dir: /tmp/tmp.nYZrtOYERx/gpiod-2.1.3
test_selector:
skip_config:
before_all:
before_build:
before_test:
build_frontend: None
build_verbosity: 0
config_settings:
dependency_constraints: pinned
environment:
manylinux_images:
x86_64: quay.io/pypa/manylinux2014_x86_64:2024-01-23-12ffabc
i686: quay.io/pypa/manylinux2014_i686:2024-01-23-12ffabc
pypy_x86_64: quay.io/pypa/manylinux2014_x86_64:2024-01-23-12ffabc
aarch64: quay.io/pypa/manylinux2014_aarch64:2024-01-23-12ffabc
ppc64le: quay.io/pypa/manylinux2014_ppc64le:2024-01-23-12ffabc
s390x: quay.io/pypa/manylinux2014_s390x:2024-01-23-12ffabc
pypy_aarch64: quay.io/pypa/manylinux2014_aarch64:2024-01-23-12ffabc
pypy_i686: quay.io/pypa/manylinux2014_i686:2024-01-23-12ffabc
musllinux_images:
x86_64: quay.io/pypa/musllinux_1_1_x86_64:2024-01-23-12ffabc
i686: quay.io/pypa/musllinux_1_1_i686:2024-01-23-12ffabc
aarch64: quay.io/pypa/musllinux_1_1_aarch64:2024-01-23-12ffabc
ppc64le: quay.io/pypa/musllinux_1_1_ppc64le:2024-01-23-12ffabc
s390x: quay.io/pypa/musllinux_1_1_s390x:2024-01-23-12ffabc
repair_command: auditwheel repair -w {dest_dir} {wheel}
test_command:
test_extras:
test_requires:
Cache folder: /home/vfazio/.cache/cibuildwheel
Here we go!
</snip>
16 wheels produced in 10 minutes:
gpiod-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl 96 kB
gpiod-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl 95 kB
gpiod-2.1.3-cp310-cp310-musllinux_1_1_aarch64.whl 98 kB
gpiod-2.1.3-cp310-cp310-musllinux_1_1_x86_64.whl 98 kB
gpiod-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl 97 kB
gpiod-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl 97 kB
gpiod-2.1.3-cp311-cp311-musllinux_1_1_aarch64.whl 100 kB
gpiod-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl 100 kB
gpiod-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl 97 kB
gpiod-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl 96 kB
gpiod-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl 102 kB
gpiod-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl 102 kB
gpiod-2.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl 95 kB
gpiod-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl 95 kB
gpiod-2.1.3-cp39-cp39-musllinux_1_1_aarch64.whl 98 kB
gpiod-2.1.3-cp39-cp39-musllinux_1_1_x86_64.whl 97 kB
This build used the default target images for building wheels, which is probably fine as they are not EOL (see https://github.com/pypa/manylinux). The one suggestion I may make is to possibly generate manylinux_2_28 wheels as the OS used to generate manylinux2014 will technically be EOL in June though may still receive support from the provided docker images beyond it's EOL date.
Having prebuilt wheels will likely also increase package adoption. I'm currently stuck on the old pure-python implementation (and thus the v1 kernel interface) until wheels are provided unless I package and deploy them to my own internal server.