Package for termux

I try to package python project in Android Termux and I get:

  • astyle-3.3-cp311-cp311-linux_aarch64.whl
  • astyle-3.3-cp311-cp311-linux_armv7l.whl
  • astyle-3.3-cp311-cp311-linux_i686.whl
  • astyle-3.3-cp311-cp311-linux_x86_64.whl

They can be downloaded from here

However, I cannot upload them to PYPI:

Uploading astyle-3.3-cp311-cp311-linux_aarch64.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB • 00:01 • 118.3 MB/s
WARNING Error during upload. Retry with the --verbose option for more details.
ERROR HTTPError: 400 Bad Request from upload.pypi.org · PyPI
Binary wheel ‘astyle-3.3-cp311-cp311-linux_aarch64.whl’ has an unsupported platform tag ‘linux_aarch64’.

So how can user pip install a wheel in android termux?

As the error message tells you, those are not standardized and supported platform tag on PyPI. For building for Linux in general, you should build in a manylinux container; the easiest and best way to do that (and build all your other wheels too) is to build your wheels in CI with cibuildwheel and upload those, plus a sdist. If the termux is a manylinux compatible environment, then your manylinux-tagged wheels will work natively on it. Otherwise, it’ll fall back to the sdist.

I build in my PC and I get *-manylinux_*.whl, not -linux_*.whl. And in termux, pip install *-linux_*.whl can success, pip install *-manylinux_*.whl will fail. So it means termux is not a manylinux compatible environment? How can we distribute the wheel which termux supports?

PyPI doesn’t accept non-standard binary types, so you’ll need to create your own index server for this. https://www.piwheels.org/ does something similar for Raspberry Pi, you might be able to take inspiration from them.

https://github.com/termux-user-repository/tur/issues/415 said they host an index server in https://termux-user-repository.github.io/pypi/.

Then you need to upload the package to their index, not PyPI.