abi3audit: Python ABI3 Compliance Auditor

0.0.26 · active · verified Thu Apr 16

abi3audit is a command-line tool developed by Trail of Bits and now maintained by the Python Packaging Authority (PyPA). It scans Python wheels and shared objects for Application Binary Interface (ABI) violations and inconsistencies. Its purpose is to ensure that CPython extensions tagged as `abi3` actually comply with the stable ABI, thereby preventing potential crashes or memory corruption due to ABI mismatches. The library is currently at version 0.0.26 and receives frequent, minor releases, indicating active development.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically audit a PyPI package for ABI3 compliance using `abi3audit` via a subprocess call. The example audits 'numpy' and uses the `--verbose` flag for detailed output. It handles potential errors like `abi3audit` not being found or an audit failing.

import subprocess

# Audit a specific PyPI package for ABI3 compliance
# Replace 'numpy' with the actual package name you wish to audit.
# The '--verbose' flag provides detailed output.
package_to_audit = 'numpy'

try:
    print(f"Auditing {package_to_audit} for ABI3 compliance...")
    result = subprocess.run(
        ['abi3audit', package_to_audit, '--verbose'],
        capture_output=True,
        text=True,
        check=True
    )
    print("\nAudit Successful:\n")
    print(result.stdout)
except subprocess.CalledProcessError as e:
    print(f"\nAudit Failed for {package_to_audit}:\n")
    print(f"Stderr: {e.stderr}")
    print(f"Stdout: {e.stdout}")
except FileNotFoundError:
    print("Error: 'abi3audit' command not found. Is it installed and in your PATH?")

view raw JSON →