-
Notifications
You must be signed in to change notification settings - Fork 26
docs: Move project contributors info into the correct file. #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,133 +1,44 @@ | ||
| # Python API for C2PA | ||
| # C2PA Python library | ||
|
|
||
| This project provides a Python API for working with [C2PA](https://c2pa.org/) (Coalition for Content Provenance and Authenticity) manifests. It includes functionality for creating, signing, and verifying C2PA manifests, as well as working with assets and assertions. | ||
| 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 | ||
| 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. | ||
|
|
||
| ## Project Structure | ||
| ## Prerequisites | ||
|
|
||
| ```bash | ||
| . | ||
| ├── .github/ # GitHub configuration files | ||
| ├── artifacts/ # Platform-specific libraries for building (per subfolder) | ||
| │ └── your_target_platform/ # Platform-specific artifacts | ||
| ├── docs/ # Project documentation | ||
| ├── examples/ # Example scripts demonstrating usage | ||
| ├── scripts/ # Utility scripts (eg. artifacts download) | ||
| ├── src/ # Source code | ||
| │ └── c2pa/ # Main package directory | ||
| │ └── libs/ # Platform-specific libraries | ||
| ├── tests/ # Unit tests and benchmarks | ||
| ├── .gitignore # Git ignore rules | ||
| ├── Makefile # Build and development commands | ||
| ├── pyproject.toml # Python project configuration | ||
| ├── requirements.txt # Python dependencies | ||
| ├── requirements-dev.txt # Development dependencies | ||
| └── setup.py # Package setup script | ||
| ``` | ||
| This library requires Python version 3.10+. | ||
|
|
||
| ## Package installation | ||
|
|
||
| The c2pa-python package is published to PyPI. You can install it from there by running: | ||
| Install the c2pa-python package from PyPI by running: | ||
|
|
||
| ```bash | ||
| pip install c2pa-python | ||
| ``` | ||
|
|
||
| To use the module in your Python code, import like this: | ||
| To use the module in Python code, import it like this: | ||
|
|
||
| ```python | ||
| import c2pa | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Adding a "Do Not Train" Assertion | ||
|
|
||
| The `examples/training.py` script demonstrates how to add a "Do Not Train" assertion to an asset and verify it. | ||
|
|
||
| ### Signing and Verifying Assets | ||
|
|
||
| The `examples/sign.py` script shows how to sign an asset with a C2PA manifest and verify it. | ||
|
|
||
| ## Development Setup | ||
|
|
||
| 1. Create and activate a virtual environment with native dependencies: | ||
|
|
||
| ```bash | ||
| # Create virtual environment | ||
| python -m venv .venv | ||
|
|
||
| # Activate virtual environment | ||
| # On Windows: | ||
| .venv\Scripts\activate | ||
| # On macOS/Linux: | ||
| source .venv/bin/activate | ||
|
|
||
| # load project dependencies | ||
| pip install -r requirements.txt | ||
| pip install -r requirements-dev.txt | ||
|
|
||
| # download library artifacts for the current version you want, eg v0.55.0 | ||
| python scripts/download_artifacts.py c2pa-v0.55.0 | ||
| ``` | ||
|
|
||
| 2. Install the package in development mode: | ||
|
|
||
| ```bash | ||
| pip install -e . | ||
| ``` | ||
|
|
||
| This will: | ||
|
|
||
| - Copy the appropriate libraries for your platform from `artifacts/` to `src/c2pa/libs/` | ||
| - Install the package in development mode, allowing you to make changes to the Python code without reinstalling | ||
|
|
||
| ## Building Wheels | ||
|
|
||
| To build wheels for all platforms that have libraries in the `artifacts/` directory: | ||
|
|
||
| ```bash | ||
| python setup.py bdist_wheel | ||
| ``` | ||
|
|
||
| You can use `twine` to verify the wheels have correct metadata: | ||
|
|
||
| ```bash | ||
| twine check dist/* | ||
| ``` | ||
|
|
||
| This will create platform-specific wheels in the `dist/` directory. | ||
|
|
||
| ## Running Tests | ||
|
|
||
| Run the tests: | ||
|
|
||
| ```bash | ||
| make test | ||
| ``` | ||
|
|
||
| Alternatively, install pytest (if not already installed): | ||
|
|
||
| ```bash | ||
| pip install pytest | ||
| ``` | ||
|
|
||
| And run: | ||
|
|
||
| ```bash | ||
| pytest | ||
| ``` | ||
| See the [`examples` directory](https://github.com/contentauth/c2pa-python/tree/main/examples) for some helpful examples: | ||
| - `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. | ||
|
|
||
| ## Contributing | ||
|
|
||
| Contributions are welcome! Please fork the repository and submit a pull request. | ||
| 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 or the MIT License. See the LICENSE-MIT and LICENSE-APACHE files for details. | ||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.