---
title: "c2pa-python | pypx"
description: "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
canonical_url: "https://pypx.app/packages/c2pa-python"
meta:
  "og:description": "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_c2pa-python%2Cversion_0.39.0%2Csummary_Python%2Bbindings%2Bfor%2Bthe%2BC2PA%2BContent%2BAuthenticity%2BInitiative%2B(CAI)%2Blibrary%2Clicense_MIT%2BOR%2BApache-2.0%2Cp_Ii9wYWNrYWdlcy9jMnBhLXB5dGhvbiI%2Cs_IwpdzefNTFTvwGoO.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "c2pa-python 0.39.0"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_c2pa-python%2Cversion_0.39.0%2Csummary_Python%2Bbindings%2Bfor%2Bthe%2BC2PA%2BContent%2BAuthenticity%2BInitiative%2B(CAI)%2Blibrary%2Clicense_MIT%2BOR%2BApache-2.0%2Cp_Ii9wYWNrYWdlcy9jMnBhLXB5dGhvbiI%2Cs_IwpdzefNTFTvwGoO.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **c2pa-python**

v0.39.0

Python bindings for the C2PA Content Authenticity Initiative (CAI) library

7.8 MB Python 3.10+ platform-specificMIT OR Apache-2.04 deps

[** Diff **](https://pypx.app/packages/c2pa-python/diff)

`$ uv add c2pa-python`

# C2PA Python library

The [c2pa-python](https://github.com/contentauth/c2pa-python) repository provides a Python library that can:

- Read and validate C2PA manifest data from media files in supported formats.
- Create and sign manifest data, and attach it to media files in supported formats.

Features:

- Create and sign C2PA manifests using various signing algorithms.
- Verify C2PA manifests and extract metadata.
- Add assertions and ingredients to assets.
- Examples and unit tests to demonstrate usage.

For the best experience, read the docs on the [CAI Open Source SDK documentation website](https://opensource.contentauthenticity.org/docs/c2pa-c).

If you want to view the documentation in GitHub, see:

- [Using the Python library](https://pypx.app/docs/usage.md)
- [Supported formats](https://github.com/contentauth/c2pa-rs/blob/main/docs/supported-formats.md)
- [Configuring the SDK using `Context` and `Settings`](https://pypx.app/docs/context-settings.md)
- [Using Builder intents](https://pypx.app/docs/intents.md) to ensure spec-compliant manifests
- Using [working stores and archives](https://pypx.app/docs/working-stores.md)
- Selectively constructing manifests by [filtering actions and ingredients](https://pypx.app/docs/selective-manifests.md)
- [Diagram of public classes in the Python library and their relationships](https://pypx.app/docs/class-diagram.md)
- [Release notes](https://pypx.app/docs/release-notes.md)

## Prerequisites

This library requires Python version 3.10+.

## Package installation

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](https://github.com/contentauth/c2pa-rs) release. To test the Python bindings against a local, unreleased c2pa-rs checkout, you can instead build the native library from source.

Prerequisites:

- A local clone of [c2pa-rs](https://github.com/contentauth/c2pa-rs).
- The [Rust toolchain](https://rust-lang.org/tools/install/) ( `cargo` on your `PATH`).

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:

```
rustup target add aarch64-apple-darwin x86_64-apple-darwin
```

To build a single-architecture library instead, set `C2PA_LIBS_PLATFORM` to a specific platform (for example `aarch64-apple-darwin`).

## Examples

See the [`examples` directory](https://github.com/contentauth/c2pa-python/tree/main/examples) for some helpful examples:

- `examples/read.py` shows how to read and verify an asset with a C2PA manifest.
- `examples/sign.py` shows how to sign and verify an asset with a C2PA manifest.
- `examples/training.py` demonstrates how to add a "Do Not Train" assertion to an asset and verify it.

## API reference documentation

API documentation is published at [github.io/c2pa-python/api/c2pa](https://contentauth.github.io/c2pa-python/api/c2pa/index.html).

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.

To build documentation locally, see [Contributing to the project](https://github.com/contentauth/c2pa-python/blob/main/docs/project-contributions.md#api-reference-documentation).

## Contributing

Contributions are welcome! For more information, see [Contributing to the project](https://github.com/contentauth/c2pa-python/blob/main/docs/project-contributions.md).

## License

This project is licensed under the Apache License 2.0 and the MIT License. See the [LICENSE-MIT](https://github.com/contentauth/c2pa-python/blob/main/LICENSE-MIT) and [LICENSE-APACHE](https://github.com/contentauth/c2pa-python/blob/main/LICENSE-APACHE) files for details.

## **Details **

<dl>

<dt>Version</dt>
<dd>0.39.0</dd>

<dt>License</dt>
<dd>MIT OR Apache-2.0</dd>

<dt>Python</dt>
<dd>&gt;=3.10</dd>

<dt>Maintainer</dt>
<dd>Gavin Peacock &lt;gvnpeacock@adobe.com&gt;, Tania Mathern &lt;mathern@adobe.com&gt;</dd></dl>

## **Links**

- [homepage](https://contentauthenticity.org)
- [repository](https://github.com/contentauth/c2pa-python)
- [View on PyPI](https://pypi.org/project/c2pa-python/)

## **Release Cadence **

**39**

releases in the past year

avg 15 days between releases

## **Platforms **

linuxarm64mac-x86mac-armwin

## **Maintainers **

- Gavin Peacock · [gvnpeacock@adobe.com](mailto:gvnpeacock@adobe.com)
- Tania Mathern · [mathern@adobe.com](mailto:mathern@adobe.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/c2pa-python#webpage","@type":"WebPage","description":"Python bindings for the C2PA Content Authenticity Initiative (CAI) library","name":"c2pa-python","url":"https://pypx.app/packages/c2pa-python","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/c2pa-python"]}]},{"@id":"https://pypx.app/packages/c2pa-python#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Python bindings for the C2PA Content Authenticity Initiative (CAI) library","license":"MIT OR Apache-2.0","name":"c2pa-python","softwareVersion":"0.39.0"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
