• Stars
    star
    403
  • Rank 103,557 (Top 3 %)
  • Language
    Python
  • License
    Other
  • Created over 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Auditing and relabeling cross-distribution Linux wheels.

auditwheel

https://travis-ci.org/pypa/auditwheel.svg?branch=main https://pepy.tech/badge/auditwheel/month

Auditing and relabeling of PEP 600 manylinux_x_y, PEP 513 manylinux1, PEP 571 manylinux2010 and PEP 599 manylinux2014 Linux wheels.

Overview

auditwheel is a command line tool to facilitate the creation of Python wheel packages for Linux (containing pre-compiled binary extensions) that are compatible with a wide variety of Linux distributions, consistent with the PEP 600 manylinux_x_y, PEP 513 manylinux1, PEP 571 manylinux2010 and PEP 599 manylinux2014 platform tags.

auditwheel show: shows external shared libraries that the wheel depends on (beyond the libraries included in the manylinux policies), and checks the extension modules for the use of versioned symbols that exceed the manylinux ABI.

auditwheel repair: copies these external shared libraries into the wheel itself, and automatically modifies the appropriate RPATH entries such that these libraries will be picked up at runtime. This accomplishes a similar result as if the libraries had been statically linked without requiring changes to the build system. Packagers are advised that bundling, like static linking, may implicate copyright concerns.

Requirements

  • OS: Linux
  • Python: 3.7+
  • patchelf: 0.14+

Only systems that use ELF-based linkage are supported (this should be essentially every Linux).

In general, building manylinux1 wheels requires running on a CentOS5 machine, building manylinux2010 wheels requires running on a CentOS6 machine, and building manylinux2014 wheels requires running on a CentOS7 machine, so we recommend using the pre-built manylinux Docker images, e.g.

$ docker run -i -t -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /bin/bash

Installation

auditwheel can be installed using pip:

$ pip3 install auditwheel

Examples

Inspecting a wheel:

$ auditwheel show cffi-1.5.0-cp35-cp35m-linux_x86_64.whl

cffi-1.5.0-cp35-cp35m-linux_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".

The wheel references the following external versioned symbols in
system-provided shared libraries: GLIBC_2.3.

The following external shared libraries are required by the wheel:
{
    "libc.so.6": "/lib64/libc-2.5.so",
    "libffi.so.5": "/usr/lib64/libffi.so.5.0.6",
    "libpthread.so.0": "/lib64/libpthread-2.5.so"
}

In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:

libffi.so.5

Repairing a wheel.

$ auditwheel repair cffi-1.5.2-cp35-cp35m-linux_x86_64.whl
Repairing cffi-1.5.2-cp35-cp35m-linux_x86_64.whl
Grafting: /usr/lib64/libffi.so.5.0.6
Setting RPATH: _cffi_backend.cpython-35m-x86_64-linux-gnu.so to "$ORIGIN/.libs_cffi_backend"
Previous filename tags: linux_x86_64
New filename tags: manylinux1_x86_64
Previous WHEEL info tags: cp35-cp35m-linux_x86_64
New WHEEL info tags: cp35-cp35m-manylinux1_x86_64

Fixed-up wheel written to /wheelhouse/cffi-1.5.2-cp35-cp35m-manylinux1_x86_64.whl

Limitations

  1. auditwheel uses the DT_NEEDED information (like ldd) from the Python extension modules to determine which system libraries they depend on. Code that dynamically loads libraries at runtime using ctypes / cffi (from Python) or dlopen (from C/C++) doesn't contain this information in a way that can be statically determined, so dependencies that are loaded via those mechanisms will be missed.

  2. There's nothing we can do about "fixing" binaries if they were compiled and linked against a too-recent version of libc or libstdc++. These libraries (and some others) use symbol versioning for backward compatibility. In general, this means that code that was compiled against an old version of glibc will run fine on systems with a newer version of glibc, but code what was compiled on a new system won't / might not run on older system.

    So, to compile widely-compatible binaries, you're best off doing the build on an old Linux distribution, such as a manylinux Docker image.

Testing

The tests can be run with nox, which will automatically install test dependencies.

Some of the integration tests also require a running and accessible Docker daemon. These tests will pull a number of docker images if they are not already available on your system, but it won't update existing images. To update these images manually, run:

docker pull python:3.7-slim
docker pull quay.io/pypa/manylinux1_x86_64
docker pull quay.io/pypa/manylinux2010_x86_64
docker pull quay.io/pypa/manylinux2014_x86_64
docker pull quay.io/pypa/manylinux_2_28_x86_64

You may also remove these images using docker rmi.

Code of Conduct

Everyone interacting in the auditwheel project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PSF Code of Conduct.

More Repositories

1

pipenv

Python Development Workflow for Humans.
Python
24,500
star
2

pip

The Python package installer
Python
9,178
star
3

pipx

Install and Run Python Applications in Isolated Environments
Python
8,438
star
4

hatch

Modern, extensible Python project management
Python
5,078
star
5

sampleproject

A sample project that exists for PyPUG's "Tutorial on Packaging and Distributing Projects"
Python
4,914
star
6

virtualenv

Virtual Python Environment builder
Python
4,642
star
7

pipfile

Python
3,231
star
8

setuptools

Official project repository for the Setuptools build system
Python
2,251
star
9

flit

Simplified packaging of Python modules
Python
2,070
star
10

cibuildwheel

🎑 Build Python wheels for all the platforms with minimal configuration.
Python
1,684
star
11

twine

Utilities for interacting with PyPI
Python
1,543
star
12

manylinux

Python wheels that work on any linux (almost)
Shell
1,365
star
13

packaging.python.org

Python Packaging User Guide
Python
1,362
star
14

pip-audit

Audits Python environments and dependency trees for known vulnerabilities
Python
888
star
15

setuptools_scm

the blessed package to manage your versions by scm tags
Python
802
star
16

gh-action-pypi-publish

The blessed :octocat: GitHub Action, for publishing your πŸ“¦ distribution files to PyPI: https://github.com/marketplace/actions/pypi-publish
Python
795
star
17

get-pip

Helper scripts to install pip, in a Python installation that doesn't have it.
Python
694
star
18

build

A simple, correct Python build frontend
Python
667
star
19

packaging

Core utilities for Python packages
Python
566
star
20

wheel

The official binary distribution format for Python
Python
469
star
21

bandersnatch

A PyPI mirror client according to PEP 381 http://www.python.org/dev/peps/pep-0381/
Python
421
star
22

advisory-database

Advisory database for Python packages published on pypi.org
236
star
23

python-manylinux-demo

Demo project for building Python wheels for Linux with Travis-CI
C
221
star
24

sample-namespace-packages

Tests against namespace packages
Python
166
star
25

readme_renderer

Safely render long_description/README files in Warehouse
Python
151
star
26

packaging-problems

An issue tracker for the problems in packaging
140
star
27

trove-classifiers

Canonical source for classifiers on PyPI.
Python
126
star
28

pyproject-hooks

A low-level library for calling build-backends in `pyproject.toml`-based project
Python
115
star
29

installer

A low-level library for installing from a Python wheel distribution.
Python
107
star
30

scripttest

Utilities to help with testing command line scripts
Python
59
star
31

gh-action-pip-audit

A GitHub Action for pip-audit
Python
59
star
32

distlib

A low-level library which implements some Python packaging standards (PEPs) and which could be used by third-party packaging tools to achieve interoperability.
Python
43
star
33

distutils

distutils as found in cpython
Python
42
star
34

.github

Community health files for the Python Packaging Authority
30
star
35

interoperability-peps

Development repo for evolution of PyPA interoperability standards (released versions are published as PEPs on python.org)
Python
22
star
36

pypa.io

Source code for the pypa.io website
Python
22
star
37

integration-test

ensure core packaging tools work well with each other
17
star
38

pkg_resources

Abandoned extraction of pkg_resources. Official version found at /pypa/setuptools.
Python
15
star
39

get-virtualenv

14
star
40

history

history generates history/changelog files for a project
Python
7
star
41

easy_install

Python
7
star
42

wheel-builders

Companion repo for the [email protected] mailing list
7
star
43

browntruck

Python
6
star
44

pypa-docs-theme

Common base Sphinx theme for PyPA projects
Python
6
star
45

docker-python

5
star
46

copr

Package files for building PyPA packages in copr
4
star
47

pep470

Python
4
star
48

pip-test-package

Used in pip's test suite
Python
4
star
49

pypa-bot

Source code behind @pypa-bot (eventually)
3
star
50

pypi-camo

Dockerfile
3
star
51

bot-test

1
star