From d34e6eb63b97067be05a61077b9c83bcce7a81ee Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Tue, 22 Nov 2022 11:33:46 -0800 Subject: [PATCH 1/4] Suggest running abi3audit in docs Suggested in #1342 --- docs/faq.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index 7d73e3e2f..3bd5fad6c 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -118,6 +118,8 @@ The CPython Limited API is a subset of the Python C Extension API that's declare To create a package that builds ABI3 wheels, you'll need to configure your build backend to compile libraries correctly create wheels with the right tags. [Check this repo](https://github.com/joerick/python-abi3-package-sample) for an example of how to do this with setuptools. +You could also consider running [abi3audit](https://github.com/trailofbits/abi3audit) against the produced wheels in order to check for abi3 violations or inconsistencies. + ### Packages with optional C extensions {: #optional-extensions} `cibuildwheel` defines the environment variable `CIBUILDWHEEL` to the value `1` allowing projects for which the C extension is optional to make it mandatory when building wheels. From a5c5f5e0f05fa5cafa089eb794e23c0ea23ae424 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sun, 4 Dec 2022 23:46:56 -0800 Subject: [PATCH 2/4] add to multiline example --- docs/options.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/options.md b/docs/options.md index f2a5c142d..5f8e7b73b 100644 --- a/docs/options.md +++ b/docs/options.md @@ -893,9 +893,11 @@ Platform-specific environment variables are also available:
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}" # Multi-line example - use && to join on all platforms + # Use abi3audit to catch issues with Limited API wheels CIBW_REPAIR_WHEEL_COMMAND: > python scripts/repair_wheel.py -w {dest_dir} {wheel} && - python scripts/check_repaired_wheel.py -w {dest_dir} {wheel} + python scripts/check_repaired_wheel.py -w {dest_dir} {wheel} && + pipx run abi3audit --strict --report {wheel} ``` !!! tab examples "pyproject.toml" @@ -915,10 +917,12 @@ Platform-specific environment variables are also available:
repair-wheel-command = "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}" # Multi-line example + # Use abi3audit to catch issues with Limited API wheels [tool.cibuildwheel] repair-wheel-command = [ 'python scripts/repair_wheel.py -w {dest_dir} {wheel}', 'python scripts/check_repaired_wheel.py -w {dest_dir} {wheel}', + 'pipx run abi3audit --strict --report {wheel}', ] ``` From 1e2cc2fc37a834e5af6fcd9e4ff271609ed9c88f Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:27:12 -0800 Subject: [PATCH 3/4] Update docs/faq.md Co-authored-by: Joe Rickerby --- docs/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index 3bd5fad6c..2192a7868 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -118,7 +118,7 @@ The CPython Limited API is a subset of the Python C Extension API that's declare To create a package that builds ABI3 wheels, you'll need to configure your build backend to compile libraries correctly create wheels with the right tags. [Check this repo](https://github.com/joerick/python-abi3-package-sample) for an example of how to do this with setuptools. -You could also consider running [abi3audit](https://github.com/trailofbits/abi3audit) against the produced wheels in order to check for abi3 violations or inconsistencies. +You could also consider running [abi3audit](https://github.com/trailofbits/abi3audit) against the produced wheels in order to check for abi3 violations or inconsistencies. You can run it alongside the default in your [CIBW_REPAIR_WHEEL_COMMAND](options.md#repair-wheel-command). ### Packages with optional C extensions {: #optional-extensions} From 41daa4bd26c327fe996ce4133d1b4adf777da5c9 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Mon, 5 Dec 2022 13:32:31 -0800 Subject: [PATCH 4/4] separate example --- docs/options.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/options.md b/docs/options.md index 5f8e7b73b..62c5ecf2a 100644 --- a/docs/options.md +++ b/docs/options.md @@ -893,10 +893,20 @@ Platform-specific environment variables are also available:
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}" # Multi-line example - use && to join on all platforms - # Use abi3audit to catch issues with Limited API wheels CIBW_REPAIR_WHEEL_COMMAND: > python scripts/repair_wheel.py -w {dest_dir} {wheel} && - python scripts/check_repaired_wheel.py -w {dest_dir} {wheel} && + python scripts/check_repaired_wheel.py -w {dest_dir} {wheel} + ``` + + ```yaml + # Use abi3audit to catch issues with Limited API wheels + CIBW_REPAIR_WHEEL_COMMAND_LINUX: > + auditwheel repair -w {dest_dir} {wheel} && + pipx run abi3audit --strict --report {wheel} + CIBW_REPAIR_WHEEL_COMMAND_MACOS: > + delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} && + pipx run abi3audit --strict --report {wheel} + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: > pipx run abi3audit --strict --report {wheel} ``` @@ -917,15 +927,29 @@ Platform-specific environment variables are also available:
repair-wheel-command = "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}" # Multi-line example - # Use abi3audit to catch issues with Limited API wheels [tool.cibuildwheel] repair-wheel-command = [ 'python scripts/repair_wheel.py -w {dest_dir} {wheel}', 'python scripts/check_repaired_wheel.py -w {dest_dir} {wheel}', - 'pipx run abi3audit --strict --report {wheel}', ] ``` + ```toml + # Use abi3audit to catch issues with Limited API wheels + [tool.cibuildwheel.linux] + repair-wheel-command = [ + "auditwheel repair -w {dest_dir} {wheel}", + "pipx run abi3audit --strict --report {wheel}", + ] + [tool.cibuildwheel.macos] + repair-wheel-command = [ + "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}", + "pipx run abi3audit --strict --report {wheel}", + ] + [tool.cibuildwheel.windows] + repair-wheel-command = "pipx run abi3audit --strict --report {wheel}" + ``` + In configuration mode, you can use an inline array, and the items will be joined with `&&`.