chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
748 stars 127 forks source link

General Question: Building non-pure Python Wheels for Chaquopy #1186

Closed GerHelWan closed 1 week ago

GerHelWan commented 1 week ago

Hello,

I have a question regarding the process of preparing non-pure Python packages/wheels for a specific platform, particularly when they contain native components like shared libraries or *.*cpython*.so files.

According to the documentation at Chaquopy toolchain, it seems necessary to rebuild the entire package/wheel with the specified toolchain following the instructions there. Could you clarify why this full rebuild is required?

Is there a technical reason why we cannot simply recompile only the native parts for the target platform, replace the corresponding files within the package, and then use wheel unpack and wheel pack to update the wheel? This approach would seem a bit less complex for certain packages.

Any insights or detailed explanations on this process would be greatly appreciated, as it would help us optimize our development workflow for our Android application using Chaquopy.

Thank you for your assistance.

mhsmith commented 1 week ago

The only general way to compile the native parts is to use the package's own build system, and the only way to invoke that build system is in the context of building the entire package. By comparison, the build of the non-native components is usually trivial (copying the .py files directly into the wheel). So I don't see any possible simplification here.

If you have any specific package which you think this would help, then please give details.

mhsmith commented 1 week ago

I assume the package is pyHailoRT, which you posted about in #1184, so et's continue the discussion there.