Skip to content

Commit e517765

Browse files
committed
docs: Move project contrib info
1 parent eed6f9b commit e517765

File tree

2 files changed

+94
-131
lines changed

2 files changed

+94
-131
lines changed

README.md

Lines changed: 14 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,48 @@
1-
# Python API for C2PA
1+
# C2PA Python library
22

3-
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.
3+
The [c2pa-python](https://github.com/contentauth/c2pa-python) repository provides a Python library that can:
4+
- Read and validate C2PA manifest data from media files in supported formats.
5+
- Create and sign manifest data, and attach it to media files in supported formats.
46

5-
## Features
7+
Features:
68

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

12-
## Project Structure
13-
14-
```bash
15-
.
16-
├── .github/ # GitHub configuration files
17-
├── artifacts/ # Platform-specific libraries for building (per subfolder)
18-
│ └── your_target_platform/ # Platform-specific artifacts
19-
├── docs/ # Project documentation
20-
├── examples/ # Example scripts demonstrating usage
21-
├── scripts/ # Utility scripts (eg. artifacts download)
22-
├── src/ # Source code
23-
│ └── c2pa/ # Main package directory
24-
│ └── libs/ # Platform-specific libraries
25-
├── tests/ # Unit tests and benchmarks
26-
├── .gitignore # Git ignore rules
27-
├── Makefile # Build and development commands
28-
├── pyproject.toml # Python project configuration
29-
├── requirements.txt # Python dependencies
30-
├── requirements-dev.txt # Development dependencies
31-
└── setup.py # Package setup script
32-
```
14+
## Prerequisites
3315

3416
## Package installation
3517

36-
The c2pa-python package is published to PyPI. You can install it from there by running:
18+
Install the c2pa-python package from PyPI by running:
3719

3820
```bash
3921
pip install c2pa-python
4022
```
4123

42-
To use the module in your Python code, import like this:
24+
To use the module in Python code, import it like this:
4325

4426
```python
4527
import c2pa
4628
```
4729

4830
## Examples
4931

50-
### Adding a "Do Not Train" Assertion
51-
52-
The `examples/training.py` script demonstrates how to add a "Do Not Train" assertion to an asset and verify it.
53-
54-
### Signing and Verifying Assets
55-
56-
The `examples/sign.py` script shows how to sign an asset with a C2PA manifest and verify it.
57-
58-
## Development Setup
59-
60-
1. Create and activate a virtual environment with native dependencies:
61-
62-
```bash
63-
# Create virtual environment
64-
python -m venv .venv
65-
66-
# Activate virtual environment
67-
# On Windows:
68-
.venv\Scripts\activate
69-
# On macOS/Linux:
70-
source .venv/bin/activate
71-
72-
# load project dependencies
73-
pip install -r requirements.txt
74-
pip install -r requirements-dev.txt
75-
76-
# download library artifacts for the current version you want, eg v0.55.0
77-
python scripts/download_artifacts.py c2pa-v0.55.0
78-
```
79-
80-
2. Install the package in development mode:
81-
82-
```bash
83-
pip install -e .
84-
```
85-
86-
This will:
32+
### Signing and verifying assets
8733

88-
- Copy the appropriate libraries for your platform from `artifacts/` to `src/c2pa/libs/`
89-
- Install the package in development mode, allowing you to make changes to the Python code without reinstalling
34+
The `examples/sign.py` script shows how to sign and verify an asset with a C2PA manifest.
9035

91-
## Building Wheels
36+
### Adding a "Do Not Train" assertion
9237

93-
To build wheels for all platforms that have libraries in the `artifacts/` directory:
94-
95-
```bash
96-
python setup.py bdist_wheel
97-
```
98-
99-
You can use `twine` to verify the wheels have correct metadata:
100-
101-
```bash
102-
twine check dist/*
103-
```
104-
105-
This will create platform-specific wheels in the `dist/` directory.
106-
107-
## Running Tests
108-
109-
Run the tests:
110-
111-
```bash
112-
make test
113-
```
114-
115-
Alternatively, install pytest (if not already installed):
116-
117-
```bash
118-
pip install pytest
119-
```
38+
The `examples/training.py` script demonstrates how to add a "Do Not Train" assertion to an asset and verify it.
12039

121-
And run:
12240

123-
```bash
124-
pytest
125-
```
12641

12742
## Contributing
12843

129-
Contributions are welcome! Please fork the repository and submit a pull request.
44+
Contributions are welcome! For more information, see [Contributing to the project](https://github.com/contentauth/c2pa-python/blob/main/docs/project-contributions.md).
13045

13146
## License
13247

133-
This project is licensed under the Apache License 2.0 or the MIT License. See the LICENSE-MIT and LICENSE-APACHE files for details.
48+
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.

docs/project-contributions.md

Lines changed: 80 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,46 @@
22

33
The information in this page is primarily for those who wish to contribute to the c2pa-python library project itself, rather than those who simply wish to use it in an application. For general contribution guidelines, see [CONTRIBUTING.md](../CONTRIBUTING.md).
44

5-
## Development
5+
## Development Setup
66

7-
It is best to [set up a virtual environment](https://virtualenv.pypa.io/en/latest/installation.html) for development and testing.
7+
It is best to [set up a virtual environment](https://virtualenv.pypa.io/en/latest/installation.html) for development and testing:
8+
9+
```bash
10+
# Create virtual environment
11+
python -m venv .venv
12+
13+
# Activate virtual environment
14+
# On Windows:
15+
.venv\Scripts\activate
16+
# On macOS/Linux:
17+
source .venv/bin/activate
18+
```
19+
20+
Load project dependencies:
21+
22+
```bash
23+
pip install -r requirements.txt
24+
pip install -r requirements-dev.txt
25+
```
26+
27+
Download library artifacts for the current version you want, eg v0.55.0:
28+
29+
```bash
30+
python scripts/download_artifacts.py c2pa-v0.55.0
31+
```
32+
33+
Install the package in development mode:
34+
35+
```bash
36+
pip install -e .
37+
```
38+
39+
This will:
40+
41+
- Copy the appropriate libraries for your platform from `artifacts/` to `src/c2pa/libs/`
42+
- Install the package in development mode, allowing you to make changes to the Python code without reinstalling.
43+
44+
## Build from source
845

946
To build from source on Linux, install `curl` and `rustup` then set up Python.
1047

@@ -42,49 +79,61 @@ pip install -U pytest
4279
python3 -m build --wheel
4380
```
4481

45-
Note: To peek at the Python code (uniffi generated and non-generated), run `maturin develop` and look in the c2pa folder.
82+
## Building wheels
83+
84+
To build wheels for all platforms that have libraries in the `artifacts/` directory:
4685

47-
## ManyLinux build
86+
```bash
87+
python setup.py bdist_wheel
88+
```
4889

49-
Build using [manylinux](https://github.com/pypa/manylinux) by using a Docker image as follows:
90+
You can use `twine` to verify the wheels have correct metadata:
5091

5192
```bash
52-
docker run -it quay.io/pypa/manylinux_2_28_aarch64 bash
53-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
54-
source "$HOME/.cargo/env"
55-
export PATH=/opt/python/cp312-cp312/bin:$PATH
56-
pip install maturin
57-
pip install venv
58-
pip install build
59-
pip install -U pytest
93+
twine check dist/*
94+
```
6095

61-
cd home
62-
git clone https://github.com/contentauth/c2pa-python.git
63-
cd c2pa-python
64-
python3 -m build --wheel
65-
auditwheel repair target/wheels/c2pa_python-0.4.0-py3-none-linux_aarch64.whl
96+
This will create platform-specific wheels in the `dist/` directory.
97+
98+
## Project structure
99+
100+
```bash
101+
.
102+
├── .github/ # GitHub configuration files
103+
├── artifacts/ # Platform-specific libraries for building (per subfolder)
104+
│ └── your_target_platform/ # Platform-specific artifacts
105+
├── docs/ # Project documentation
106+
├── examples/ # Example scripts demonstrating usage
107+
├── scripts/ # Utility scripts (eg. artifacts download)
108+
├── src/ # Source code
109+
│ └── c2pa/ # Main package directory
110+
│ └── libs/ # Platform-specific libraries
111+
├── tests/ # Unit tests and benchmarks
112+
├── .gitignore # Git ignore rules
113+
├── Makefile # Build and development commands
114+
├── pyproject.toml # Python project configuration
115+
├── requirements.txt # Python dependencies
116+
├── requirements-dev.txt # Development dependencies
117+
└── setup.py # Package setup script
66118
```
67119

68120
## Testing
69121

70-
We use [PyTest](https://docs.pytest.org/) and [unittest](https://docs.python.org/3/library/unittest.html) for testing.
122+
The project uses [PyTest](https://docs.pytest.org/) and [unittest](https://docs.python.org/3/library/unittest.html) for testing.
71123

72124
Run tests by following these steps:
73125

74126
1. Activate the virtual environment: `source .venv/bin/activate`
75127
2. (optional) Install dependencies: `pip install -r requirements.txt`
76-
3. Setup the virtual environment with local changes: `maturin develop`
77-
4. Run the tests: `pytest`
78-
5. Deactivate the virtual environment: `deactivate`
79-
80-
For example:
81-
82-
```bash
83-
source .venv/bin/activate
84-
maturin develop
85-
python3 tests/training.py
86-
deactivate
87-
```
128+
4. Run the tests:
129+
```bash
130+
make test
131+
```
132+
5. Alternatively, install pytest (if not already installed) and run it:
133+
```bash
134+
pip install pytest
135+
pytest
136+
```
88137

89138
### Testing during bindings development
90139

@@ -102,4 +151,3 @@ To rebuild and test, enter these commands:
102151
make build-python
103152
make test
104153
```
105-

0 commit comments

Comments
 (0)