falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.51k stars 937 forks source link

Build wheels for musllinux (PEP 656) platforms #2145

Closed mwheeler closed 1 month ago

mwheeler commented 1 year ago

This is a small feature request to build wheels for PEP 656 musllinux platform tags, if your team aren't opposed to the idea.

We're seeing pip install for falcon on AArch64 Alpine Linux platforms take upwards of 20 minutes to build the wheel from source (on Github Actions nodes).

CaselIT commented 1 year ago

Hi,

thanks for reporting. This does seem to be taken case by the cibuildwheel action https://github.com/pypa/cibuildwheel that can be used to create the wheels so it may be a theoretically low effort option option to support

vytas7 commented 1 year ago

I agree with @CaselIT that https://github.com/pypa/cibuildwheel looks very promising, we should look into it. @mwheeler just confirm, do you know what architectures are we expected to add musllinux support for, do we need the likes of s390x, or just x86 and ARM?

mwheeler commented 1 year ago

Personally I'm only interested in x86_64 and AArch64 (ARM), coming from a "running containers in the cloud" perspective.

I can't imagine people are running falcon web servers on old s390x machines :) (and if they are, I'm sure they'd notify via an issue if this was an issue for them similar to how I am)

vytas7 commented 1 year ago

FWIW, the IBM Z mainframe platform (identified as s390x in Python) isn't completely dead yet :slightly_smiling_face: We haven't seen much interest in it, but we are nevertheless running normal tests and wheels on it since it is the only true big-endian architecture left in the wild, which is useful to verify that our C/Cython code doesn't make any endian-specific assumptions.

But anyway, let's limit musllinux support to x86 and ARM (both 64bit only).

vytas7 commented 1 month ago

We will address this for Falcon 4.0 automatically courtesy of Cibuildwheel: #2259.

vytas7 commented 1 month ago

Hi again @mwheeler! we will release Falcon wheels for musllinux as part of Falcon 4.0.0 release (about in one month time from now).

I have built out test wheels to TestPyPI, and they seem to work for me, but you can also take 'em for a spin in your container or musllinux distribution on metal: https://test.pypi.org/project/falcon/#files.

My limited testing: $ docker run --rm -it python:3.12-alpine /bin/sh

/ # export PIP_INDEX_URL=https://test.pypi.org/simple/
/ # python -m venv /tmp/venv
/ # source /tmp/venv/bin/activate
(venv) / # pip install falcon
Looking in indexes: https://test.pypi.org/simple/
Collecting falcon
  Downloading https://test-files.pythonhosted.org/packages/0e/05/c196e5edcbee5107e68c9058314e17071db67f67d0063b19cbb9cf421aa9/falcon-4.0.0.dev1-cp312-cp312-musllinux_1_2_x86_64.whl.metadata (37 kB)
Downloading https://test-files.pythonhosted.org/packages/0e/05/c196e5edcbee5107e68c9058314e17071db67f67d0063b19cbb9cf421aa9/falcon-4.0.0.dev1-cp312-cp312-musllinux_1_2_x86_64.whl (11.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.9/11.9 MB 4.1 MB/s eta 0:00:00
Installing collected packages: falcon
Successfully installed falcon-4.0.0.dev1
(venv) / # python
Python 3.12.5 (main, Aug  7 2024, 19:15:55) [GCC 13.2.1 20240309] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import falcon
>>> falcon.parse_header
<cyfunction parse_header at 0x753d012312f0>
>>> falcon.parse_header('application/falcon; kind=peregrine')
('application/falcon', {'kind': 'peregrine'})