This is an example project that packages a tvm-ffi based library into a Python ABI-agnostic wheel.
This example can also serve as a guideline for general packaging as well.
- Source-level build for cross-compilation support in CMake
- Registration via global function table
Use uv pip (the same tooling used in CI) to build and install the example wheel:
cd examples/python_packaging
uv pip install --reinstall --verbose .Note: When running the auditwheel process, make sure to skip
libtvm_ffi.so as they are shipped via the tvm_ffi package.
After installing the my_ffi_extension example package, you can run the following example.
python run_example.pyThis runs four flows: calling add_two via the TVM-FFI ABI, calling add_one via the global
registry, calling raise_error to demonstrate error propagation, and constructing/using the
IntPair object.