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
Metadata
Release files for EmbedXMP 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| embedxmp-0.1.4.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| embedxmp-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.5 kB
Release files / embedxmp-0.1.4.tar.gz
| Download URL | embedxmp-0.1.4.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b282cdb3cf0ec086c60d9e4a87bc9a7a0d82ccb825185b9502cedf3becc6ccf
|
|
BLAKE2b-256 checksum How to use checksums |
63b9f3d64dcba11fd77afc6f3bdc9842d573fc022ae506dbf8c3d0707a300ae9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / embedxmp-0.1.4-py3-none-any.whl
| Download URL | embedxmp-0.1.4-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eae2a2dc0eca75defc8db735bc08d82bb58111177944d267fbc990eac59121df
|
|
BLAKE2b-256 checksum How to use checksums |
007b78d2828b18335461d755741dcd9920c32328bbdd5f8a6045e571153dc31f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|