Package: auditwheel-emscripten
auditwheel-emscriptenauditwheel-like tool for wheels targeting Emscripten platform$pipinstallauditwheel-emscriptenWhat is this?auditwheel-emscripten is a tiny tool to facilitate the creation of Python wheel packages forEmscripten. auditwheel-emscripten is originally created forPyodide, but it can be used in any other projects that target
Python-in-the-browser using Emscripten.pyodide auditwheel show: shows external shared libraries that the wheel depends on.pyodide auditwheel repair: copies these external shared libraries into the wheel itself.Usage (CLI)Usage:pyodideauditwheel[OPTIONS]COMMAND[ARGS]...Auditwheel-liketoolforemscriptenwheelsandsharedlibraries.

╭─Options───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│--helpShowthismessageandexit.│
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─Commands──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│copy[Deprecated]Copysharedlibrariestothewheeldirectory.Workssameasrepair.Userepairinstead.│
│exportsShowexportsofawheelorasharedlibraryfile.│
│importsShowimportsofawheelorasharedlibraryfile.│
│repairRepairawheelfile:copysharedlibrariestothewheeldirectory.│
│showShowsharedlibrarydependenciesofawheelorasharedlibraryfile.│
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯# wget https://cdn.jsdelivr.net/pyodide/v0.21.3/full/Shapely-1.8.2-cp310-cp310-emscripten_3_1_14_wasm32.whl$pyodideauditwheelshowShapely-1.8.2-cp310-cp310-emscripten_3_1_14_wasm32.whl

Thefollowingexternalsharedlibrariesarerequired:{│'shapely/speedups/_speedups.cpython-310-wasm32-emscripten.so':['libgeos_c.so'],
│'shapely/vectorized/_vectorized.cpython-310-wasm32-emscripten.so':['libgeos_c.so']}$pyodideauditwheelrepair--libdir<directorywhichcontainslibgeos_c.so>Shapely-1.8.2-cp310-cp310-emscripten_3_1_14_wasm32.whl

Repairedwheelhasfollowingexternalsharedlibraries:{│'Shapely.libs/libgeos.so.3.10.3':[],
│'Shapely.libs/libgeos_c.so':['libgeos.so.3.10.3'],
│'shapely/speedups/_speedups.cpython-310-wasm32-emscripten.so':['libgeos_c.so'],
│'shapely/vectorized/_vectorized.cpython-310-wasm32-emscripten.so':['libgeos_c.so']}Usage (API)Listing shared library dependencies of a wheel file:fromauditwheel_emscriptenimportshowlibs=show("Shapely-1.8.2-cp310-cp310-emscripten_3_1_14_wasm32.whl")print(libs)# {'shapely/vectorized/_vectorized.cpython-310-wasm32-emscripten.so': ['libgeos_c.so'], 'shapely/speedups/_speedups.cpython-310-wasm32-emscripten.so': ['libgeos_c.so']}Copying shared libraries to the wheel:fromauditwheel_emscriptenimportrepair,showrepaired_wheel=repair("Shapely-1.8.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",libdir="/path/where/shared/libraries/are/located",outdir="/path/to/output/directory",)libs=show(repaired_wheel)print(libs)# {'Shapely.libs/libgeos.so.3.10.3': [], 'Shapely.libs/libgeos_c.so': ['libgeos.so.3.10.3'], 'shapely/speedups/_speedups.cpython-310-wasm32-emscripten.so': ['libgeos_c.so'], 'shapely/vectorized/_vectorized.cpython-310-wasm32-emscripten.so': ['libgeos_c.so']}Implementation details / limitationsDynamic linking in EmscriptenDynamic linking is not in the WebAssembly specification,
but Emscripten has its own dynamic linking support,
which is required for building Python wheels targeting Emscripten platform.This tool is based on:Loosely documented Emscripten dynamic linking specification:https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.mdEmscripten's internal utility for inspecting WASM module:https://github.com/emscripten-core/emscripten/blob/main/tools/webassembly.pyEmscripten dylink implementation:https://github.com/emscripten-core/emscripten/blob/main/src/library_dylink.jsauditwheel vs auditwheel-emscriptenauditwheelis a tool that helps repair and modify Python wheels (pre-compiled packages)
to be compatible with a wide range of Linux distributions.
It does this by copying external shared libraries into the wheel and
repairing the RPATH (a file path that is used to locate shared libraries at runtime)
of the ELF binary so that the Linux operating system can locate the library when the program is run.auditwheel-emscriptenis a variation of auditwheel that is specifically designed
to work with Emscripten-generated WebAssembly (WASM) modules.
It does not perform an audit on the wheel, as Emscripten does not guarantee compatibility between versions.
Instead, it simply copies the required libraries into the wheel without modifying the module itself.
It is up to the user to manually implement a way to locate these libraries at runtime.