Install the c2pa-python package from PyPI by running:
pip install c2pa-python
To use the module in Python code, import the module like this:
import c2pa
Building from local c2pa-rs sources
Using a virtual environment with local builds
The make targets honor an active virtualenv. Create a virtual environment ./.venv and activate it before running them so commands use the project interpreter rather than the global Python interpreter:
make create-venv && source .venv/bin/activate
Build steps
By default the build downloads a prebuilt native library from a c2pa-rs release. To test the Python bindings against a local, unreleased c2pa-rs checkout, you can instead build the native library from source.
Point C2PA_RS_PATH at your c2pa-rs checkout and run the build-from-source target:
export C2PA_RS_PATH=/path/to/c2pa-rs
make build-from-source C2PA_RS_PATH=$C2PA_RS_PATH
This does a clean build of the c2pa-c-ffi crate (with the file_io feature, which the Python wrapper requires), stages the resulting library under both artifacts/ and src/c2pa/libs/, and installs the package in editable mode, replacing any prebuilt artifacts from make download-native-artifacts. By default, the build uses the release profile; to build the debug profile instead, pass EXTRA_BUILD_ARGS="--debug":
make build-from-source C2PA_RS_PATH=$C2PA_RS_PATH EXTRA_BUILD_ARGS="--debug"
Note on targets for macOS
On macOS this produces a universal (arm64+x86_64) library by default, which requires both Rust targets:
Use the documentation version dropdown to choose a published release.
The versions are selected in api-docs/versions.json; the first entry is the default at the existing documentation URL.
Publishing a stable GitHub release automatically adds its tag as the default while retaining older versions.