Dynamic XMP embed/read/remove orchestration for Swarmauri handlers.
Project description
EmbedXMP
EmbedXMP collects every installed EmbedXmpBase implementation, discovers them via Swarmauri's dynamic registry, and exposes a unified manager that can embed, read, or remove XMP packets without worrying about container formats.
Features
- Dynamic discovery – lazily imports modules named
swarmauri_xmp_*and collects subclasses registered underEmbedXmpBase. - Unified interface – delegates to the first handler whose
supportsmethod confirms compatibility with the payload. - Convenience wrappers – module-level helpers (
embed,read,remove) keep high-level workflows succinct. - Async-friendly APIs – integrate inside event loops without blocking when calling out to plugin hooks.
- Media-format coverage – load handlers for PNG, GIF, JPEG, SVG, WEBP, TIFF, PDF, and MP4 assets through extras.
Installation
Using uv
uv add EmbedXMP
Using pip
pip install EmbedXMP
Usage
from pathlib import Path
from EmbedXMP import EmbedXMP, embed, embed_file, read, read_file_xmp
manager = EmbedXMP()
image = Path("example.png")
packet = """<x:xmpmeta xmlns:x='adobe:ns:meta/'><rdf:RDF>...</rdf:RDF></x:xmpmeta>"""
# Embed into the file in place.
embed_file(image, packet)
# Inspect metadata via the manager API.
xmp_text = manager.read(image.read_bytes(), str(image))
print(xmp_text)
# Remove metadata from the file when it is no longer required.
manager.remove(image.read_bytes(), str(image))
Note You can provide either a
pathor ahintkeyword argument when callingembed,read, orremoveto help the manager pick the correct handler. The values are interchangeable as long as they match when both are supplied.
Async orchestration
EmbedXMP's manager can be shared inside asynchronous workflows by deferring media-aware work to plugin hooks:
import asyncio
from pathlib import Path
from EmbedXMP import EmbedXMP, embed
async def embed_all(paths: list[str], packet: str) -> None:
manager = EmbedXMP()
for path in paths:
data = Path(path).read_bytes()
await asyncio.to_thread(embed, data, packet, hint=path)
asyncio.run(embed_all(["one.png", "two.svg"], "<x:xmpmeta>...</x:xmpmeta>"))
Project Resources
- Source: https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/EmbedXMP
- Documentation: https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/EmbedXMP#readme
- Issues: https://github.com/swarmauri/swarmauri-sdk/issues
- Releases: https://github.com/swarmauri/swarmauri-sdk/releases
- Discussions: https://github.com/orgs/swarmauri/discussions
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 embedxmp-0.1.3.dev7.tar.gz.
File metadata
- Download URL: embedxmp-0.1.3.dev7.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3069aab81bcfcb46cde462617a880c2da128616bda40784d443facd61d73a7af
|
|
| MD5 |
b1e073fcc6674dc60159563fdd826699
|
|
| BLAKE2b-256 |
d7dddf62e58505362e86949f8e1de931a24ada620b4031ad074beb66e45057c1
|
File details
Details for the file embedxmp-0.1.3.dev7-py3-none-any.whl.
File metadata
- Download URL: embedxmp-0.1.3.dev7-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b8a5dab7a4d7802878127b79f9a575aa49b01ba35bc8718490b0a2f5543b08c
|
|
| MD5 |
5379f2300ba4acaa97523b89445c3be9
|
|
| BLAKE2b-256 |
c95a3a3eb8050c3da24d09725b6ee8658cc64381653e897b48de50234b3749ab
|