Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/test-c2pa-rs-source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ jobs:
working-directory: c2pa-python
env:
C2PA_PREFLIGHT_RUN: "1"
run: python ./tests/test_unit_tests.py
C2PA_RS_PATH: ${{ github.workspace }}/c2pa-rs
run: |
python ./tests/test_unit_tests.py
python ./tests/test_unit_tests_threaded.py

tests-windows:
name: Unit tests (Windows, ${{ matrix.runs-on }})
Expand Down Expand Up @@ -205,4 +208,8 @@ jobs:
working-directory: c2pa-python
env:
C2PA_PREFLIGHT_RUN: "1"
run: python .\tests\test_unit_tests.py
C2PA_RS_PATH: ${{ github.workspace }}\c2pa-rs
run: |
python .\tests\test_unit_tests.py
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python .\tests\test_unit_tests_threaded.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ See the [`examples` directory](https://github.com/contentauth/c2pa-python/tree/m

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.
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.

Expand Down
2 changes: 1 addition & 1 deletion c2pa-native-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c2pa-v0.91.10
c2pa-v0.92.0
15 changes: 8 additions & 7 deletions docs/context-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ The `Context` class encapsulates configuration for:
- **Signer configuration**: Optional signer credentials stored in the `Context` for reuse.
- **State isolation**: Each `Context` is independent, allowing different configurations to coexist in the same application.

`Context` replaces the deprecated global `load_settings()` function with explicit, isolated configuration:
`Context` replaces the removed thread-local `load_settings()` function with explicit, isolated configuration:

- **Makes dependencies explicit**: Configuration is passed directly to `Reader` and `Builder`, not hidden in global state.
- **Enables multiple configurations**: Run different configurations simultaneously (for example, one for development with test certificates, another for production with strict validation).
- **Eliminates global state**: Each `Reader` and `Builder` gets its configuration from the `Context` you pass, avoiding subtle bugs from shared state.
- **Simplifies testing**: Create isolated configurations for tests without worrying about cleanup or interference.

> [!NOTE]
> Without a `Context`, `Reader` and `Builder` use one with SDK default settings. Pass a `Context` for custom settings or a context signer. The deprecated `load_settings()` function no longer affects `Reader` or `Builder`. See [Migrating from load_settings](#migrating-from-load_settings).
> Without an explicit `Context`, `Reader` and `Builder` use the shared default context. Pass a `Context` for custom settings or a context signer. c2pa-rs 0.92 no longer supports thread-local settings, and `load_settings()` has been removed from these bindings. See [Migrating from load_settings](#migrating-from-load_settings).

## Quick start

Expand Down Expand Up @@ -754,15 +754,15 @@ assert isinstance(ctx, ContextProvider) # True

## Migrating from load_settings

The `load_settings()` function is deprecated and will be removed when c2pa-python moves to c2pa-rs 0.92.0. Replace it with `Settings` and `Context` APIs:
The `load_settings()` function has been removed. Replace it with `Settings` and `Context` APIs, passing the context to every operation that needs the configuration. Operations without an explicit context use SDK default settings:

| Aspect | `load_settings` (legacy) | `Context` |
|--------|--------------------------|-----------|
| Scope | Global state | Per Reader/Builder, passed explicitly |
| Multiple configs | Not supported | One context per configuration |
| Testing | Shared global state | Isolated contexts per test |

**Deprecated:**
**Old approach (no longer supported):**

```py
from c2pa import load_settings, Reader
Expand All @@ -774,10 +774,11 @@ reader = Reader("image.jpg") # no longer sees thread local settings
**Current approach:**

```py
from c2pa import Settings, Context, Reader
from c2pa import Context, Reader

ctx = Context.from_dict({"builder": {"thumbnail": {"enabled": False}}})
reader = Reader("image.jpg", context=ctx)
with Context.from_dict({"builder": {"thumbnail": {"enabled": False}}}) as ctx:
with Reader("image.jpg", context=ctx) as reader:
print(reader.json())
```

## See also
Expand Down
2 changes: 1 addition & 1 deletion docs/intents.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ You can set the intent on a `Builder` instance by:
- [Using Context](#using-context)
- [Using `set_intent` on the `Builder`](#using-set_intent-on-the-builder)

The deprecated `load_settings()` function no longer sets the intent for a `Builder`. To migrate existing code, see [Context and settings - Migrating from load_settings](context-settings.md#migrating-from-load_settings).
The thread-local `load_settings()` function has been removed. Set intent through an explicit `Context` or `Builder.set_intent()`. For existing code, see [Context and settings - Migrating from load_settings](context-settings.md#migrating-from-load_settings).

### Using Context

Expand Down
21 changes: 21 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Release notes

## Unreleased: c2pa-rs 0.92 preflight (DO NOT MERGE)

This branch tests the upcoming native SDK, not a published Python release.
The normal native release pin is unchanged.

### Breaking changes

Removed `load_settings()`: c2pa-rs 0.92 removes thread-local settings.
Create a `Context` with `Settings` (or `Context.from_dict` / `from_json`)
and pass it explicitly to every `Reader` and `Builder` that needs that
configuration. Constructors without a context continue to use SDK defaults.
See [Migrating from load_settings](context-settings.md#migrating-from-load_settings).

Reader and Builder constructors now use the current context-based C APIs.
Native strings, manifests, and signatures are released through `c2pa_free`.
`format_embeddable()` retains its `(size, bytes)` result using a temporary
default-context builder. For custom settings or format-specific builder state,
use `Builder.compose_manifest(format, manifest_bytes)` on a live builder.
Signing closes the builder, so use a separate builder for composition after
`sign()`.

## Version 0.38.3

### TLS trust stores
Expand Down
4 changes: 2 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ manifest_json = json.dumps({

## Settings, Context, and ContextProvider

The `Settings` and `Context` classes provide per-instance configuration for `Reader` and `Builder` operations, replacing the global `load_settings()` function, which is now deprecated. Without a `Context`, `Reader` and `Builder` use one with SDK default settings.
The `Settings` and `Context` classes provide per-instance configuration for `Reader` and `Builder` operations, replacing the removed thread-local `load_settings()` function. Without a `Context`, `Reader` and `Builder` use the shared default context.

See [Context and settings](context-settings.md) for details.

Expand Down Expand Up @@ -144,7 +144,7 @@ The built-in `Context` class is the standard `ContextProvider` implementation. C

### Migrating from load_settings

The `load_settings()` function is deprecated. Replace it with `Settings` and `Context`. See [Migrating from load_settings](context-settings.md#migrating-from-load_settings) for details.
The `load_settings()` function has been removed for c2pa-rs 0.92 compatibility. Replace it with `Settings` and `Context`. See [Migrating from load_settings](context-settings.md#migrating-from-load_settings) for details.

## File-based operation

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "c2pa-python"
version = "0.38.4"
version = "0.39.0"
requires-python = ">=3.10"
description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
readme = { file = "README.md", content-type = "text/markdown" }
Expand Down
6 changes: 2 additions & 4 deletions src/c2pa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
Context,
ContextBuilder,
ContextProvider,
sdk_version,
load_settings
sdk_version
) # NOQA

# Re-export C2paError and its subclasses
Expand All @@ -50,6 +49,5 @@
'Context',
'ContextBuilder',
'ContextProvider',
'sdk_version',
'load_settings'
'sdk_version'
]
Loading
Loading