Skip to main content

SVG handler for embedding and extracting XMP packets in Swarmauri runtimes.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmauri_xmp_svg-0.1.2.dev2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_xmp_svg-0.1.2.dev2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_xmp_svg-0.1.2.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_xmp_svg-0.1.2.dev2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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

Hashes for swarmauri_xmp_svg-0.1.2.dev2.tar.gz
Algorithm Hash digest
SHA256 7756cfa862db6ffbbbaf6b12748e3426c9fa9f958e6391fe13f03b8f684c6445
MD5 3c7e9cfe83c7af3b73f595a590a4064e
BLAKE2b-256 6b1d547462fec4e1e956c9b3171b077cd1391a79ebf0ccc21616432b875384a2

See more details on using hashes here.

File details

Details for the file swarmauri_xmp_svg-0.1.2.dev2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_xmp_svg-0.1.2.dev2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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

Hashes for swarmauri_xmp_svg-0.1.2.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ef4b09be5eb67b36f18d58aa34ff636737b418e04f35ca44e5c9894c6769acb
MD5 b6c3b0facf4d78c4097d62b101ab39ac
BLAKE2b-256 d49f5af775aef93e07d43ede5f719c30e0eba13b87466cdfc24d90fb02b3fbcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page