auditwheel
auditwheel is a command-line tool designed to facilitate the creation of Python wheel packages for Linux (containing pre-compiled binary extensions). These wheels are made compatible with a wide variety of Linux distributions by adhering to PEP 600 `manylinux_x_y`, PEP 513 `manylinux1`, PEP 571 `manylinux2010`, and PEP 599 `manylinux2014` platform tags. It helps to audit wheels for external shared library dependencies and then bundles them into the wheel, modifying RPATH entries for runtime compatibility. The library is currently at version 6.6.0 and maintains an active release cadence, frequently adding support for new manylinux policies and Python versions.
Warnings
- breaking Python 3.7, 3.8, and 3.9 support has been successively dropped in recent major/minor versions. auditwheel 6.0.0 dropped Python 3.7, 6.2.0 dropped Python 3.8, and 6.5.0 dropped Python 3.9.
- breaking The `addtag` subcommand was removed in version 6.0.0.
- gotcha auditwheel primarily processes dependencies specified via `DT_NEEDED` (like `ldd`). It cannot statically detect or repair shared libraries that are dynamically loaded at runtime using mechanisms like `ctypes`, `cffi`, or `dlopen` from C/C++ code.
- gotcha auditwheel is a Linux-specific tool and does not operate on wheels built for other operating systems. For macOS, the `delocate` tool is typically used, and for Windows, `delvewheel` or `repairwheel` are alternatives.
- gotcha auditwheel requires the `patchelf` utility to be installed and available in the system's PATH. This is an external operating system dependency, not a Python package.
Install
-
pip install auditwheel
Imports
- auditwheel
auditwheel <subcommand> [options] <wheelfile>
Quickstart
#!/bin/bash # This quickstart demonstrates auditwheel's primary command-line usage. # In a real scenario, you would typically build a wheel containing compiled extensions # and then use auditwheel within a manylinux Docker environment. # 1. Create a dummy wheel file for demonstration purposes. # Replace 'my_package-1.0-py310-none-any.whl' with your actual wheel. # For a real test, ensure this wheel has compiled native extensions. mkdir -p dist echo "Dummy content" > dist/my_package-1.0-py310-none-linux_x86_64.whl echo "\n--- Inspecting the wheel with 'auditwheel show' ---" auditwheel show dist/my_package-1.0-py310-none-linux_x86_64.whl echo "\n--- Repairing the wheel with 'auditwheel repair' ---" mkdir -p repaired_wheels auditwheel repair dist/my_package-1.0-py310-none-linux_x86_64.whl -w repaired_wheels echo "\n--- Listing repaired wheels ---" ls repaired_wheels # Clean up dummy files rm -rf dist repaired_wheels