Shared Python toolkit for OuEstCharlie agents
Project description
OuEstCharlie Python Toolkit
Shared Python library for building OuEstCharlie photo management agents.
Overview
This toolkit provides four core capabilities:
- MCP integration — MCP server lifecycle, tool registration, progress reporting, and logging
- Manifest read-edit with consistency — hierarchical manifest traversal, atomic read-modify-write with optimistic concurrency
- XMP read-edit with consistency — sidecar read-modify-write with optimistic concurrency and field-level semantics
- Image processing — thumbnail AVIF grid assembly and on-demand JPEG preview generation, delegated to
ouestcharlie-imageproc
Package Structure
ouestcharlie-toolkit/
├── pyproject.toml
└── src/
└── ouestcharlie_toolkit/
├── schema.py # Data models, exceptions, constants
├── backend.py # Backend protocol
├── backends/
│ └── local.py # Local filesystem backend
├── manifest.py # ManifestStore for manifest operations
├── xmp.py # XmpStore for XMP sidecar operations
├── thumbnail_builder.py # Thumbnail generation (delegates to ouestcharlie-imageproc)
├── preview_builder.py # On-demand JPEG preview (delegates to ouestcharlie-imageproc)
├── progress.py # ProgressReporter for MCP progress
└── server.py # AgentBase for MCP server lifecycle
Installation
From PyPI (recommended)
pip install ouestcharlie-toolkit
ouestcharlie-imageproc (the Rust binary) is a separate package pulled in automatically. No Rust toolchain required at install time.
System prerequisites:
- macOS:
brew install inih brotli gettext(required by pyexiv2 at runtime) - Linux/Windows: no extra steps
From source (development)
# For macOs on arm64 architecture, the full Python version is required e.g.: cpython-3.14.5-macos-aarch64-none
# the version string is listed by `uv python list`
uv venv --python 3.13
uv sync
uv sync uses the [tool.uv.sources] override to install ouestcharlie-imageproc from the adjacent ../outestcharlie-imageproc checkout as an editable install (which compiles the Rust binary). Make sure that repo is checked out alongside this one.
Running Tests
Always use .venv/bin/python -m pytest — do not use .venv/bin/pytest or a system python:
# Unit tests
.venv/bin/python -m pytest tests/ -v
# Run a specific file
.venv/bin/python -m pytest tests/test_photo.py -v --tb=short
Integration tests (real image-proc binary) are in ouestcharlie-imageproc/tests_integration/.
Building a Wheel
The toolkit is pure Python — no Rust compilation required:
pip install hatch
hatch build
# produces dist/ouestcharlie_toolkit-*.whl (pure Python, any platform)
Dependencies
mcp— Official MCP Python SDKpyexiv2— EXIF extraction from image files (wraps Exiv2); requiresbrew install inihon macOSblake3— Fast content hashingouestcharlie-imageproc— Rust coprocessor for image decode, resize, AVIF assembly, JPEG preview
XMP parsing and serialization use stdlib only and have no native dependencies.
Usage
Creating an Agent
from ouestcharlie_toolkit import AgentBase
class HousekeepingAgent(AgentBase):
def __init__(self):
super().__init__(name="ouestcharlie-housekeeping", version="1.0.0")
@self.mcp.tool()
async def rebuild_partition(backend: str, partition: str, mode: str = "lazy"):
"""Rebuild partition manifest and thumbnails."""
photos = await self.backend.list_files(partition, suffix=".jpg")
progress = self.progress(total=len(photos))
for photo in photos:
await self.check_cancelled()
await progress.advance(message=f"Processing {photo.path}")
return {"photosProcessed": len(photos), "errors": 0}
if __name__ == "__main__":
agent = HousekeepingAgent()
agent.run() # Runs on stdio transport
Working with XMP Sidecars
from ouestcharlie_toolkit import XmpStore
async def add_face_tags(store: XmpStore, photo_path: str, faces: list[str]):
def modify(xmp):
for face in faces:
tag = f"ouestcharlie:faces/{face}"
if tag not in xmp.tags:
xmp.tags.append(tag)
return xmp
await store.read_modify_write(photo_path, modify)
Backend Configuration
export WOOF_BACKEND_CONFIG='{"type": "filesystem", "root": "/Users/alice/Photos"}'
Architecture
See py_toolkit_LLD.md for the design and agent_LLD_rationale.md for technology selection rationale.
Key design principles:
- Optimistic concurrency — All manifest and XMP writes use version tokens to detect conflicts
- Unknown field preservation — Schema evolution via
_extradict in dataclasses - Async throughout — All I/O operations are async
- Backend abstraction — Swappable storage backends (local, S3, GCS, etc.)
- MCP-native — Built on FastMCP for clean agent implementation
References
License
MIT license
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ouestcharlie_py_toolkit-0.9.0.tar.gz.
File metadata
- Download URL: ouestcharlie_py_toolkit-0.9.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1c3c0c90004adbc4894c2678a400b8f1ce0bb872d7d7559c5336d594b4d0ab1
|
|
| MD5 |
906d9b9f92ee832ce14b612d057581b4
|
|
| BLAKE2b-256 |
74b05db31047aa22dd3db3ba0ed209328a07f5a792f97b737cc9aaaef58edc33
|
Provenance
The following attestation bundles were made for ouestcharlie_py_toolkit-0.9.0.tar.gz:
Publisher:
publish.yml on ouestcharlie/ouestcharlie-py-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ouestcharlie_py_toolkit-0.9.0.tar.gz -
Subject digest:
e1c3c0c90004adbc4894c2678a400b8f1ce0bb872d7d7559c5336d594b4d0ab1 - Sigstore transparency entry: 1711812587
- Sigstore integration time:
-
Permalink:
ouestcharlie/ouestcharlie-py-toolkit@a6ea65586d2cb234577013ed2fe068d5ca77fd17 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/ouestcharlie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a6ea65586d2cb234577013ed2fe068d5ca77fd17 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ouestcharlie_py_toolkit-0.9.0-py3-none-any.whl.
File metadata
- Download URL: ouestcharlie_py_toolkit-0.9.0-py3-none-any.whl
- Upload date:
- Size: 46.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3c18fdceaf42487a4b7a4b6a219e031bbec3ce223d54bf2b43e7d12114b3f83
|
|
| MD5 |
8a58912e1b2ef8ed0e76b0bd0023a2ab
|
|
| BLAKE2b-256 |
69cb3a388647cecbe4bb3252159cae332eaf870d164ed4a2565fff774a9a114a
|
Provenance
The following attestation bundles were made for ouestcharlie_py_toolkit-0.9.0-py3-none-any.whl:
Publisher:
publish.yml on ouestcharlie/ouestcharlie-py-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ouestcharlie_py_toolkit-0.9.0-py3-none-any.whl -
Subject digest:
a3c18fdceaf42487a4b7a4b6a219e031bbec3ce223d54bf2b43e7d12114b3f83 - Sigstore transparency entry: 1711812633
- Sigstore integration time:
-
Permalink:
ouestcharlie/ouestcharlie-py-toolkit@a6ea65586d2cb234577013ed2fe068d5ca77fd17 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/ouestcharlie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a6ea65586d2cb234577013ed2fe068d5ca77fd17 -
Trigger Event:
push
-
Statement type: