-
Notifications
You must be signed in to change notification settings - Fork 248
wheels: enforce 'abi3audit' checks #3111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: NVIDIA/raft
Length of output: 1908
🏁 Script executed:
Repository: NVIDIA/raft
Length of output: 1908
🏁 Script executed:
Repository: NVIDIA/raft
Length of output: 1908
🌐 Web query:
pypa abi3audit _extract.py wheel filename ABI3 audit input behavior💡 Result:
In the pypa/abi3audit project, extract.py (often associated with the internal logic of scanning symbols) is a component used to perform static analysis on Python extensions to verify ABI3 compliance [1][2]. When abi3audit processes a wheel, it uses the wheel filename to inform its audit behavior, specifically regarding the assumed ABI3 version [1][3]. The key behaviors are as follows: 1. Metadata vs. Reality: The presence of the abi3 tag in a wheel filename is treated strictly as metadata [4]. The tool does not assume the wheel is compliant simply because the filename contains the tag [4]. 2. Version Inference: When auditing a packaged wheel, abi3audit can often infer the intended minimum abi3 version from the wheel's metadata [1][2]. However, when auditing a bare shared object (e.g.,.abi3.so) where such metadata is absent, it defaults to the lowest known abi3 version (abi3-cp32) and reports warnings on version mismatches [1][3]. 3. Symbol Analysis: The audit process involves checking both local and external symbols for extensions to detect violations [3]. It searches for symbols starting with Py or Py that are not part of the allowed abi3 compatibility list [1][2]. Because some CPython functions are static inline (like _Py_DECREF), the tool attempts to catch these by analyzing symbol tables, though stripped symbol tables may cause these to be missed [3]. 4. Stabilization vs. Introduction: The tool flags mismatches based on when a symbol was stabilized rather than when it was introduced [1][3]. For example, if an abi3-cp36 extension uses a function stabilized in 3.7, it will trigger a warning, even if that function existed in 3.6 [1]. In summary, abi3audit uses the filename metadata primarily as a starting point to determine the version constraints for the audit, but it relies on an independent analysis of the binary's symbol table to verify actual compliance [1][3].
Citations:
🌐 Web query:
NVIDIA raft ci/validate_wheel.sh abi3audit wheel_dir_relative_path💡 Result:
The script ci/validate_wheel.sh in the NVIDIA RAFT (and broader RAPIDS) repository is a continuous integration utility designed to validate the integrity and compliance of Python wheels before they are published or used [1][2]. While the script varies slightly across different RAPIDS repositories (such as cuDF), it generally serves as a quality control gate [2]. Regarding your specific interest in abi3audit, here is the context: 1. Purpose: The script is used to automate checks on built Python wheels. Common validation steps include checking wheel file sizes, using twine to verify wheel metadata (twine check), and validating package structure using tools like pydistcheck [3][2]. 2. abi3audit: While abi3audit is a standard industry tool used to scan Python extensions for abi3 ABI compatibility violations [4][5], it is not explicitly present in the primary ci/validate_wheel.sh logic found in the public RAFT repository as of August 2026. If you are seeing references to this combination, it may be part of a custom internal modification, a recently added feature in a downstream branch, or a misidentification of the other validation tools (like pydistcheck) that are present in the script [2]. 3. How it functions: Typically, these CI scripts accept arguments like package_dir (the source directory) and wheel_dir_relative_path (the directory where the built wheels are located) [2]. The script iterates through the wheels in the specified directory and runs the validation commands against them [2]. If you are attempting to implement or debug this integration, ensure your environment has the abi3audit package installed, and you can invoke it within the script using a pattern similar to: abi3audit "${wheel_dir_relative_path}"/*.whl This will scan the target wheels for ABI version mismatches or violations, as described in the official abi3audit documentation [4][5].
Citations:
🌐 Web query:
Python wheel filename convention abi3 tag distribution name PEP 427💡 Result:
The Python wheel filename convention is defined in PEP 427, which specifies the structure as {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl [1][2]. The filename ends with three "compatibility tags" [1][3]: 1. Python tag: Indicates the language implementation and version (e.g., py3, cp310) [1][4]. 2. ABI tag: Indicates the Application Binary Interface required by any included extension modules (e.g., cp33m, none, abi3) [1][4][3]. 3. Platform tag: Indicates the supported CPU architecture and OS (e.g., linux_x86_64, any) [1][4]. The abi3 tag is a specific ABI tag used to denote that a wheel is compatible with the CPython stable ABI [4][5]. By using the abi3 tag, a binary extension module can be built once and run on multiple minor versions of CPython (starting from Python 3.2), provided those versions support the stable ABI [4][6]. This reduces the need to build and distribute separate wheels for every minor Python version [4][6]. In contexts where no specific ABI is required (such as pure Python packages), the ABI tag is typically set to none [1][4].
Citations:
🌐 Web query:
site:github.com/pypa/abi3audit "_extract.py" "Wheel"💡 Result:
In the context of Python packaging and tooling, _extract.py is an internal module within the pypa/abi3audit project [1]. abi3audit is a tool used to scan Python extensions and wheels to verify their compliance with the stable ABI (abi3) [2][3]. Within this project, _extract.py is responsible for the technical process of extracting and parsing symbol information from compiled Python extensions (such as shared objects or dynamic libraries within a wheel) to check for abi3 violations [4][5]. It is not a general-purpose Python utility for wheels; rather, it is a specific implementation detail used by the abi3audit tool to inspect the binary symbols of CPython extensions [3][5].
Citations:
🌐 Web query:
site:github.com/pypa/abi3audit "abi3audit" "Usage" wheel path💡 Result:
To audit a wheel file using abi3audit, you provide the path to the local wheel file as an argument to the command [1][2]. You can execute the audit using either the installed executable or the Python module syntax: abi3audit path/to/your-wheel-file.whl or python -m abi3audit path/to/your-wheel-file.whl When providing a path to a local wheel file, abi3audit uses the metadata contained within the package to accurately check for abi3 violations and inconsistencies [1][2]. Running the audit on a full wheel is generally recommended over auditing bare shared objects, as wheels contain sufficient metadata to avoid the potential false positives that can occur when the tool cannot determine the intended minimum abi3 version [1][2].
Citations:
🌐 Web query:
site:github.com/NVIDIA/raft "validate_wheel.sh" "abi3audit"💡 Result:
The command validate_wheel.sh is a custom CI script used within the NVIDIA/raft repository to validate Python wheel packages [1][2]. The term abi3audit refers to a utility for auditing Python wheels to ensure they correctly adhere to the Stable Application Binary Interface (abi3) requirements [3]. While specific implementation details of validate_wheel.sh are not exhaustively documented in the search results, the script is integrated into the project's Continuous Integration (CI) workflows (e.g., in.github/workflows/pr.yaml) to ensure the integrity and compatibility of generated wheels before they are published or used in downstream testing [1][2][4]. The inclusion of audit tools like abi3audit in such scripts typically serves to verify that wheels intended for multiple Python versions are correctly tagged and do not contain binary incompatibilities that would violate the abi3 standard [3].
Citations:
🌐 Web query:
site:github.com/rapidsai "find" "abi3audit" "*abi*"💡 Result:
abi3audit is a Python tool developed by the Python Packaging Authority (PyPA) used to verify that a Python wheel correctly implements the stable ABI (abi3) [1]. The tool is primarily used to inspect Python wheels to ensure they actually adhere to the limited API requirements [1]. It is often integrated into Continuous Integration (CI) pipelines to catch cases where a package is incorrectly tagged as supporting the stable ABI when it does not [1]. While tools like auditwheel are used to audit and repair wheels for platform compatibility (e.g., manylinux), abi3audit provides specialized validation for the ABI compatibility of wheels intended to be cross-compatible across multiple Python versions [1]. It is frequently used in projects that build wheels for multiple Python versions or architectures to maintain strict compliance with stable ABI standards [1].
Citations:
🌐 Web query:
abi3audit source CLI accepts wheel shared object filename non abi3 wheel error💡 Result:
The abi3audit tool accepts shared object files and wheel files for auditing [1][2][3]. When you pass a file that is not explicitly tagged as abi3—such as a shared object missing the.abi3. suffix in its filename—the tool may issue warnings or require specific handling because it lacks sufficient metadata to determine the intended ABI version [1][4][5]. Key points regarding this behavior include: 1. Handling of "Bare" Shared Objects: When auditing a bare shared object (e.g., foo.so instead of foo.abi3.so), abi3audit cannot determine the intended minimum abi3 version [1][4]. It defaults to the lowest known abi3 version (abi3-cp32) and may report version mismatches, which can result in false positives [1][3][4]. 2. Improved Error Messaging: Recent updates have specifically improved error messages when a shared object does not contain.abi3. in its filename [5]. 3. Manual Override: You can use the --assume-minimum-abi3 argument to manually specify the assumed abi3 version (e.g., 3.x) when the tool cannot automatically detect it [6]. 4. Extension Filtering: abi3audit intentionally ignores files that do not appear to be Python extensions to avoid false positives [7]. A file is identified as a Python extension based on its naming convention (e.g., including.so or.pyd) and the presence of a recognized initialization function (e.g., PyInit_foo) [7]. If you encounter errors when auditing non-abi3 wheels or objects, it is often because the tool is applying default assumptions or failing to identify the file as a valid Python extension [1][7][4]. Using the --assume-minimum-abi3 flag or ensuring your files follow expected Python extension naming conventions can help resolve these issues [7][6].
Citations:
🌐 Web query:
abi3audit "not an abi3 wheel" error💡 Result:
The error "not an abi3 wheel" is not a standard, explicit error message generated by the abi3audit tool itself [1][2]. Instead, it indicates a fundamental mismatch or a misunderstanding of how the tool classifies and verifies Python wheels [1][3]. If you are encountering issues where abi3audit fails to recognize or process a wheel as abi3-compatible, it is likely due to one of the following reasons: 1. Metadata Mismatch: The wheel may not be tagged with the abi3 suffix (e.g., cp36-abi3-manylinux...) in its filename or metadata [1][3]. abi3audit relies on these tags to determine the intended compatibility version [1]. If a wheel claims to be abi3 but contains symbols that violate the stable ABI, or if it lacks the proper tagging, the tool will report violations [1][3]. 2. Improper Tool Usage: If you are running abi3audit on a "bare" shared object (e.g.,.so or.pyd file) rather than a full wheel, the tool cannot infer the intended abi3 version [1][4]. It defaults to the lowest known version (abi3-cp32), which often triggers false positives or apparent "errors" because it checks against a stricter baseline than intended [1][4]. 3. Packaging Configuration: It is common for packages to be built without proper configuration, resulting in wheels that are tagged as abi3 but do not actually implement the limited API [3]. In these cases, abi3audit is functioning correctly by identifying that the wheel's contents do not match its declared abi3 status [1][3]. To resolve these issues: - Audit the entire wheel rather than individual shared objects to ensure the tool has access to the necessary metadata [1][4]. - Verify that your build backend (e.g., setuptools, cibuildwheel) is correctly configured to use the CPython Limited API [5]. Simply tagging a wheel as abi3 without using the proper build flags will cause audit failures [3]. - If you believe the tool is flagging valid code as invalid (e.g., due to custom symbols using Py_ prefixes), check the tool's output for specific symbol violations, as it may be flagging them as non-abi3 compliant [6]. If you are using abi3audit within a CI/CD pipeline (such as cibuildwheel), ensure your repair command explicitly copies the resulting wheel to the expected destination, as a failure to do so can cause the CI process to exit with an error that may be misattributed to the audit tool itself [7].
Citations:
🌐 Web query:
abi3audit strict exit code wheel audit failure💡 Result:
The abi3audit tool is designed to exit with a non-zero exit code (specifically 1) when it detects ABI version mismatches or potential ABI violations in Python wheels [1]. There is currently no official option or flag (such as a "strict" mode) to prevent the tool from returning a non-zero exit code when these issues are found [1]. Maintainers have expressed that adding such an option would be considered "unsound," as it is generally necessary to treat detected ABI version mismatches as failures to ensure proper compliance with the stable ABI [1]. Key points regarding these failures: * ABI Version Mismatches: The tool flags symbols stabilized in a newer Python version than the one declared by the extension [2][1]. Even if a function was introduced in an earlier version, abi3audit uses the version in which it was "stabilized," which can lead to warnings that trigger the non-zero exit code [2][3]. * Best-Effort Nature: Because the tool is best-effort, users are encouraged to audit entire wheels rather than "bare" shared objects to reduce the risk of false positives, as wheels contain the metadata necessary for a more accurate audit [2][4][3]. * Integration: Since the tool is intended to catch potential bugs or compliance issues, its default behavior is to fail (exit code 1) upon discovery of any issue [1]. If you are encountering this in a CI/CD environment (like cibuildwheel), the tool's failure is intentional to notify you of potential ABI inconsistencies [5][6].
Citations:
Restrict the audit to ABI3 wheel files.
-name '*abi*'also matches non-wheel files and non-ABI3 wheels whose distribution name containsabi. Match the ABI tag and wheel suffix instead.Proposed fix
find \ "${wheel_dir_relative_path}" \ -type f \ - -name '*abi*' \ + -name '*-abi3-*.whl' \ -exec abi3audit --strict --summary --verbose '{}' \+📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Path instructions