Install and Use¶
SDK layout¶
In the libCalibGeom SDK package, the Python wrapper is installed as a standard Python package directory:
python/libCalibGeom/__init__.py_libCalibGeom.*(compiled extension module)libCalibGeom.pyi(stub file)py.typed(PEP 561 marker file; it is expected to be empty)
To import the library in Python:
import libCalibGeom
Prerequisites¶
- A compatible Python interpreter (matching the built extension ABI)
- Access to the extracted SDK folder
- Runtime access to the native libCalibGeom shared library from the SDK
lib/directory (resolved automatically via relative rpath on Linux)
Quick usage¶
From the SDK root:
export PYTHONPATH="$PWD/python:$PYTHONPATH"
export LD_LIBRARY_PATH="$PWD/lib:$LD_LIBRARY_PATH"
python3 -c "import libCalibGeom; print('ok')"
On Linux, LD_LIBRARY_PATH is normally not needed with this SDK layout because _libCalibGeom is built with a relative rpath to ../../lib.
On macOS, use DYLD_LIBRARY_PATH if needed.
On Windows PowerShell:
$env:PYTHONPATH = "$PWD\python;$env:PYTHONPATH"
$env:PATH = "$PWD\lib;$env:PATH"
python -c "import libCalibGeom; print('ok')"
Setting paths inside Python¶
You can also set paths programmatically in your script instead of exporting shell environment variables.
from pathlib import Path
import os
import sys
sdk_root = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(sdk_root / "python"))
if os.name == "nt":
os.add_dll_directory(str(sdk_root / "lib"))
import libCalibGeom
Development builds¶
The extension is also built with a relative build-tree rpath to find build/<config>/lib, so Python examples from the build tree should work without setting LD_LIBRARY_PATH in the default layout.