onnx_light.cpp_build#

Paths needed to link extensions against the loaded onnx-light runtime.

onnx_light.cpp_build.get_cpp_build_info() → dict[str, str]#

Returns ABI metadata, headers and libraries used by the Python runtime.

The libraries are looked up next to the loaded _onnxpyprotoop extension, not in the source tree, so the result is correct for editable installs as well. Linking an extension to another build or installed copy of lib_onnx_core would create a second process-wide kernel registry.

Returns:

A dictionary with the nanobind version and platform ABI tag, compiler identity and version, C++ standard, stable-ABI mode, include_dir, library_dir and one <component>_library entry per runtime library built as a shared library. Python builds use shared core and proto libraries on every platform so extensions observe one runtime identity. On Windows, the matching <component>_import_library is added when the build tree is available.

The following example displays the ABI metadata and the exact headers and libraries selected by the imported package:

<<<

from pprint import pprint

from onnx_light import get_cpp_build_info

pprint(get_cpp_build_info())

>>>

    {'compiler_id': 'GNU',
     'compiler_version': '13.3.0',
     'core_library': '/opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages/onnx_light/onnx_py/liblib_onnx_core.so',
     'cxx_standard': '20',
     'include_dir': '/home/runner/work/xadupre.github.io/xadupre.github.io/onnx-light/onnx_light',
     'library_dir': '/opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages/onnx_light/onnx_py',
     'nanobind_platform_abi': 'nanobind_system_libstdcpp_gxx_abi_1xxx_use_cxx11_abi_1',
     'nanobind_version': '3.1.0',
     'proto_library': '/opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages/onnx_light/onnx_py/liblib_onnx_proto.so',
     'python_stable_abi': 'OFF'}