Skip to content

Commit

Permalink
Merge pull request #10 from contentauth/manylinux-doc-update
Browse files Browse the repository at this point in the history
README cleanup...
Landing since this is doc-only and mostly just cleanup.
  • Loading branch information
crandmck authored Jan 29, 2024
2 parents ba80c16 + d9ee1ce commit 2304265
Showing 1 changed file with 55 additions and 38 deletions.
93 changes: 55 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ Install from PyPI by entering this command:
pip install -U c2pa-python
```

This is a platform wheel built with Rust. If your platform is not already supported,
see the development section for info on how to build from source.
This is a platform wheel built with Rust that works on Windows, macOS, and most Linux distributions (using [manylinux](https://github.com/pypa/manylinux)). If you need to run on another platform, see [Development](#development) for information on how to build from source.

### Reinstalling

If you tried unsuccessfully to install this package before the [0.40 release](https://github.com/contentauth/c2pa-python/releases/tag/v0.4), then use this command to reinstall:

```
pip install --upgrade --force-reinstall c2pa-python
```

## Usage

### Import
Expand All @@ -42,7 +48,7 @@ A media file may contain many manifests in a manifest store. The most recent man

If the optional `data_dir` is provided, the function extracts any binary resources, such as thumbnails, icons, and C2PA data into that directory. These files are referenced by the identifier fields in the manifest store report.

NOTE: For a comprehensive reference to the JSON manifest structure, see the [CAI manifest store reference](https://contentauth.github.io/json-manifest-reference/manifest-reference).
NOTE: For a comprehensive reference to the JSON manifest structure, see the [Manifest store reference](https://opensource.contentauthenticity.org/docs/manifest/manifest-ref).

### Add a signed manifest to a media file

Expand All @@ -63,7 +69,7 @@ The parameters (in order) are:
- `sign_info`, a `SignerInfo` object instance; see [Generating SignerInfo](#generating-signerinfo) below.
- `data_dir` optionally specifies a directory path from which to load resource files referenced in the manifest JSON identifier fields; for example, thumbnails, icons, and manifest data for ingredients.

### Create a SignerInfo Instance
### Create a SignerInfo instance

A `SignerInfo` object contains information about a signature. To create an instance of `SignerInfo`, first set up the signer information from the public and private key `.pem` files as follows:

Expand Down Expand Up @@ -103,32 +109,56 @@ manifest_json = json.dumps({
})
```

## Supported file formats

| Extensions | MIME type |
| ------------- | --------------------------------------------------- |
| `avi` | `video/msvideo`, `video/avi`, `application-msvideo` |
| `avif` | `image/avif` |
| `c2pa` | `application/x-c2pa-manifest-store` |
| `dng` | `image/x-adobe-dng` |
| `heic` | `image/heic` |
| `heif` | `image/heif` |
| `jpg`, `jpeg` | `image/jpeg` |
| `m4a` | `audio/mp4` |
| `mp4` | `video/mp4`, `application/mp4` |
| `mov` | `video/quicktime` |
| `png` | `image/png` |
| `svg` | `image/svg+xml` |
| `tif`,`tiff` | `image/tiff` |
| `wav` | `audio/x-wav` |
| `webp` | `image/webp` |


## Development

It is best to [set up a virtual environment](https://virtualenv.pypa.io/en/latest/installation.html) for development and testing.
It is best to [set up a virtual environment](https://virtualenv.pypa.io/en/latest/installation.html) for development and testing. To build from source on Linux, install `curl` and `rustup` then set up Python.

To build from source on Linux, install curl and rustup and set up python
First update `apt` then (if needed) install `curl`:

First update apt
```
apt update
apt install curl
```

Install Rust
```apt install curl
Install Rust:

```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
```

Install Python, pip and venv
Install Python, `pip`, and `venv`:

```
apt install python3
apt install pip
apt install python3.11-venv
python3 -m venv .venv
```

Build the wheel for your platform
Build the wheel for your platform:

```
source .venv/bin/activate
pip install maturin
Expand All @@ -140,6 +170,9 @@ python3 -m build --wheel
```

### ManyLinux build

Build using [manylinux](https://github.com/pypa/manylinux) by using a Docker image as follows:

```
docker run -it quay.io/pypa/manylinux_2_28_aarch64 bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Expand All @@ -155,7 +188,6 @@ git clone https://github.com/contentauth/c2pa-python.git
cd c2pa-python
python3 -m build --wheel
auditwheel repair target/wheels/c2pa_python-0.4.0-py3-none-linux_aarch64.whl
```

### Testing
Expand All @@ -171,9 +203,7 @@ pytest
deactivate
```

### Example

Run the example code like this:
For example:

```
source .venv/bin/activate
Expand All @@ -182,31 +212,18 @@ python3 tests/training.py
deactivate
```

## Supported file formats
## Release notes

| Extensions | MIME type |
| ------------- | --------------------------------------------------- |
| `avi` | `video/msvideo`, `video/avi`, `application-msvideo` |
| `avif` | `image/avif` |
| `c2pa` | `application/x-c2pa-manifest-store` |
| `dng` | `image/x-adobe-dng` |
| `heic` | `image/heic` |
| `heif` | `image/heif` |
| `jpg`, `jpeg` | `image/jpeg` |
| `m4a` | `audio/mp4` |
| `mp4` | `video/mp4`, `application/mp4` |
| `mov` | `video/quicktime` |
| `png` | `image/png` |
| `svg` | `image/svg+xml` |
| `tif`,`tiff` | `image/tiff` |
| `wav` | `audio/x-wav` |
| `webp` | `image/webp` |
### Version 0.4.0

This release:

- Changes the name of the import from `c2pa-python` to `c2pa`.
- Supports pre-built platform wheels for macOS, Windows and [manylinux](https://github.com/pypa/manylinux).

## Change Notes:
### Version 0.3.0

Version 0.3.0 changes:
There are some breaking changes to align with future APIs:
This release includes some breaking changes to align with future APIs:
- `C2paSignerInfo` moves the `alg` to the first parameter from the 3rd.
- `c2pa.verify_from_file_json` is now `c2pa.read_file`.
- `c2pa.ingredient_from_file_json` is now `c2pa.read_ingredient_file`.
Expand All @@ -217,12 +234,12 @@ There are some breaking changes to align with future APIs:

## License

This package is distributed under the terms of both the [MIT license](https://github.com/contentauth/c2pa-rs/blob/main/LICENSE-MIT) and the [Apache License (Version 2.0)](https://github.com/contentauth/c2pa-rs/blob/main/LICENSE-APACHE).
This package is distributed under the terms of both the [MIT license](https://github.com/contentauth/c2pa-python/blob/main/LICENSE-MIT) and the [Apache License (Version 2.0)](https://github.com/contentauth/c2pa-python/blob/main/LICENSE-APACHE).

Note that some components and dependent crates are licensed under different terms; please check the license terms for each crate and component for details.

### Contributions and feedback

We welcome contributions to this project. For information on contributing, providing feedback, and about ongoing work, see [Contributing](https://github.com/contentauth/c2pa-js/blob/main/CONTRIBUTING.md).
We welcome contributions to this project. For information on contributing, providing feedback, and about ongoing work, see [Contributing](https://github.com/contentauth/c2pa-python/blob/main/CONTRIBUTING.md).


0 comments on commit 2304265

Please sign in to comment.