Shared native-build helpers for hatch plugins
Helpers shared by the hatch native build plugins (hatch-rs, hatch-cpp) for wheels that ship a C ABI library next to a Python extension. It is a library for plugin authors, not a hatch plugin, and has no configuration of its own.
| Module | Provides |
|---|---|
symbols |
exported_symbols(path): the export table of an ELF, Mach-O (including fat), PE, or WebAssembly binary, read without loading it |
headers |
header_symbols(text, prefix), check_headers(...) for expected headers and ABI strings, prefixed_header_symbols(...) |
validation |
check_exports(...) for expected symbols plus an optional ctypes load, run_validation_command(...) |
config |
pydantic models LibraryValidationConfig, ExternalLibraryConfig, ValidationCommandConfig, so every plugin uses the same field names |
external |
resolve_library_source(...) for bundled, external, static, direct; resolve_external_library(...) from a root, a Python package, pkg-config, or $PREFIX/$CONDA_PREFIX |
manifest |
write_artifact_manifest(...): {"version": 1, "module": ..., "artifacts": [...]} |
naming |
shared_library_name(name, platform=...): libfoo.so, libfoo.dylib, foo.dll, foo.wasm |
Plugins mix the config models into their own artifact models, so a project writes the same keys whichever plugin builds the library:
expected-headers = ["include/foo/foo.h"]
header-symbol-prefix = "foo_"
expected-abi-strings = ["FOO_ABI_VERSION 1"]
validate = falseEach key also accepts its snake_case spelling.
Note
This library was generated using copier from the Base Python Project Template repository.