Skip to main content

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_xmp_svg


swarmauri_xmp_svg

swarmauri_xmp_svg provides the SVGXMP handler so vector graphics can embed, retrieve, and remove RDF/XML metadata via <metadata> elements.

Features

  • Registry ready – derives from EmbedXmpBase so Swarmauri runtimes discover it through the dynamic registry.
  • XML aware – uses ElementTree to place metadata deterministically as the first child of <svg>.
  • Text fallback – gracefully injects raw strings when the SVG cannot be parsed structurally.

Installation

# pip
pip install swarmauri_xmp_svg

# uv
uv add swarmauri_xmp_svg

Usage

from pathlib import Path

from swarmauri_xmp_svg import SVGXMP

handler = SVGXMP()
svg_path = Path("example.svg")
xmp_packet = """<x:xmpmeta xmlns:x='adobe:ns:meta/'><rdf:RDF>...</rdf:RDF></x:xmpmeta>"""

# Insert metadata into the SVG root element
updated_bytes = handler.write_xmp(svg_path.read_bytes(), xmp_packet)
svg_path.write_bytes(updated_bytes)

# Read the packet back
restored_xml = handler.read_xmp(updated_bytes)
print(restored_xml)

# Remove it if necessary
clean_bytes = handler.remove_xmp(updated_bytes)

Why it works

  • XML aware – parsing via ElementTree ensures metadata lands as the first child under <svg>.
  • Resilient fallback – gracefully degrades to text insertion when the document cannot be parsed as XML.
  • Registry ready – inherits from EmbedXmpBase, making runtime discovery effortless.

Project Resources

Metadata

Release files for swarmauri_xmp_svg 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swarmauri_xmp_svg 0.1.1
File Size Uploaded
swarmauri_xmp_svg-0.1.1.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_xmp_svg 0.1.1
File Interpreter ABI Platform
swarmauri_xmp_svg-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / swarmauri_xmp_svg-0.1.1.tar.gz

Download URL swarmauri_xmp_svg-0.1.1.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
002343021b174d2ac9615a158a81bb18caa17e55ecdf988121998fd5caa85456
BLAKE2b-256 checksum
How to use checksums
86cfa7790e186e07ecc76d7f7edf14a10915f743bf4ff459b2391fa2cf79723b
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 / swarmauri_xmp_svg-0.1.1-py3-none-any.whl

Download URL swarmauri_xmp_svg-0.1.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04772f6692e31fdc9de44dd0541da417ab2495729bf0afa3c72819a280b0361f
BLAKE2b-256 checksum
How to use checksums
c34848d23e9cce406587062bed1d0cce9ba62efbec792dccf0a69edbdaa3d1cc
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}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page