Repository navigation
Validate C ABI libraries and link extensions against them - #141
Merged
Merged
Conversation
Libraries entries accept the hatch-rs validation fields through hatch-native: expected headers, ABI strings, a header symbol prefix, expected exports, an optional ctypes load, and validation commands. A top-level artifacts list validates files that libraries does not name, such as CMake install output, by path or by library name. The artifact-manifest option records each packaged binary in a JSON file in the wheel. Library output directories are created before compiling, so a library can be built into a lib/ subdirectory. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
An entry's depends names generic libraries declared before it. The entry links each one's output and gets an $ORIGIN or @loader_path rpath to its directory. On Windows it links the import library, which is packaged next to the DLL. Generic libraries get a SONAME or an @rpath install name unless the project sets one, so the link does not record a build-tree path. depends raises for Emscripten builds. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
library-source, or HATCH_CPP_LIBRARY_SOURCE, picks bundled (the default and the existing behavior), external, or direct. In external mode the library is not built: hatch-native finds it under library-root, HATCH_CPP_LIBRARY_ROOT, pkg-config, or the conda prefix, the consumer links it without an rpath, and validation checks the external file. In direct mode its sources are compiled into each consumer. static and python-package raise until hatch-cpp supports them. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
A validate instance method is an incompatible override of pydantic's BaseModel.validate classmethod, which fails ty. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Contributor
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #141 +/- ##
==========================================
+ Coverage 95.95% 96.31% +0.35%
==========================================
Files 15 16 +1
Lines 1287 1574 +287
==========================================
+ Hits 1235 1516 +281
- Misses 52 58 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Add C ABI support to
librariesentries, using the validation and library lookup code in hatch-native.librariesentries accept the hatch-rs validation fields:expected-headers,expected-abi-strings,header-symbol-prefix,expected-symbols,validate, andvalidation-commands. A top-levelartifactslist validates files thatlibrariesdoes not list, such as CMake install output.artifact-manifestwrites a JSON file into the wheel that lists each packaged binary.dependslistsgenericlibraries declared before it. The entry links each one and gets an$ORIGINor@loader_pathrpath to its directory. On Windows it links the import library, which is packaged next to the DLL.dependsraises for Emscripten builds.library-source(orHATCH_CPP_LIBRARY_SOURCE) selectsbundled(the default),external, ordirectfor libraries listed independs.staticandpython-packageraise.lib/subdirectory.This adds a dependency on
hatch-native>=0.1.0,<0.2. hatch-native is on PyPI, and its conda-forge recipe is in review (conda-forge/staged-recipes#35661), so the hatch-cpp feedstock cannot take a release with this change until that recipe merges.The tests pass on macOS locally and on Linux in CI. CI in this repository has no Windows job, so the Windows import library code is untested.
Type of Change
Checklist
make lint)make test)