aws / aws-lambda-python-runtime-interface-client

Apache License 2.0
258 stars 73 forks source link

Publish musl wheels to PyPI #91

Open miki725 opened 1 year ago

miki725 commented 1 year ago

Currently only manylinux wheels are provided (screenshot below). As such, in order to install this package in musl-based distros such as 'Alpine` requires to either install system build deps. If however musl wheels will be published, package could be installed without any system deps hence simplifying the install process significantly.

https://github.com/pypa/cibuildwheel might be of use to simplify that process

Installing on debian-based python without any system deps it installs just fine:

➜ docker run --rm -it python:3.10-slim pip install awslambdaric
Collecting awslambdaric
  Downloading awslambdaric-2.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (338 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 338.5/338.5 kB 6.2 MB/s eta 0:00:00
Collecting simplejson==3.17.2
  Downloading simplejson-3.17.2.tar.gz (83 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.2/83.2 kB 29.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: simplejson
  Building wheel for simplejson (setup.py) ... done
  Created wheel for simplejson: filename=simplejson-3.17.2-py3-none-any.whl size=55475 sha256=92a2435595030632bd1adc0b05cdd4184fdd2196144e2e09a31a39ae8d88d6dd
  Stored in directory: /root/.cache/pip/wheels/4c/d2/65/e6ec94ca89c44483d8010d15e5fbead72b6411e01d26f90a31
Successfully built simplejson
Installing collected packages: simplejson, awslambdaric
Successfully installed awslambdaric-2.0.4 simplejson-3.17.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: pip install --upgrade pip

However installing it on alpine python without system deps currently results in this error:

➜ docker run --rm -it python:3.10-alpine pip install awslambdaric
Collecting awslambdaric
  Downloading awslambdaric-2.0.4.tar.gz (4.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.4/4.4 MB 37.0 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Error: cmake is not installed.
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-c8hn2qrd/awslambdaric_63bc53b8fb0343188f4f437787e555d4/setup.py", line 95, in <module>
          ext_modules=get_runtime_client_extension(),
        File "/tmp/pip-install-c8hn2qrd/awslambdaric_63bc53b8fb0343188f4f437787e555d4/setup.py", line 46, in get_runtime_client_extension
          extra_link_args=get_curl_extra_linker_flags(),
        File "/tmp/pip-install-c8hn2qrd/awslambdaric_63bc53b8fb0343188f4f437787e555d4/setup.py", line 19, in get_curl_extra_linker_flags
          check_call(["./scripts/preinstall.sh"])
        File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['./scripts/preinstall.sh']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: pip install --upgrade pip

https://pypi.org/project/awslambdaric/#files

image
WhyNotHugo commented 1 year ago

Looks like this explicitly depends on glibc, so it needs some patches to build on Alpine/musl.