Skip to content

xmojo v0.2.0

Choose a tag to compare

@amarbarosys amarbarosys released this 29 Oct 22:11
· 15 commits to main since this release

xmojo v0.2.0

Released: 2026-10-29 · Commit: a76920f · Previous: v0.1.0

What it does

XML for Mojo: parse into your own structs (from_xml[T]), write them back (to_xml), stream big
documents record by record (Records), or walk a compact tree (parse -> Doc). Structs are
walked with Mojo's standard reflection module; no dependency beyond the standard library. Every gate run checks the
parser against CPython's expat on 4,030 generated, mutated and real documents. Library only,
Mojo 1.2.0, linux-64; pixi install and -I src, or the conda package from recipe.yaml.

Highlights

  • Builds on Mojo 1.2.0. v0.1.0 could not: its dependency emberserde 0.1.0 ships a file precompiled by Mojo 1.1.0 that 1.2.0 refuses.
  • No third-party dependency: decoding and encoding are xmojo's own, over Mojo's standard reflection module.
  • Same from_xml[T] / to_xml behaviour and the same modifiers (Rename, RenameAll, Skip, Defaulted, Field[..., extra_names=...], DenyUnknownFields, ArmName), now imported from xmojo.

Changes

Changed

  • Breaking: the modifiers import from xmojo instead of emberserde: from xmojo import Rename, Skip, Defaulted, Field, RenameAll, RenamePolicy, DenyUnknownFields, ArmName.
  • Breaking: decode and encode errors are plain Error values with the same text as before (for example missing field: id, xmojo: unknown element <extra>), not emberserde's DeserializationError / SerializationError.
  • Pin moves to Mojo 1.2.0 (pixi.toml, recipe.yaml, pixi.lock).

Removed

  • The emberserde dependency. A struct set up for EmberJson no longer decodes from XML through the shared framework; it still decodes through xmojo's own rules.

Verified

Check Result
pixi run gate on Mojo 1.2.0: unit tests, tool builds, expat differential (2 seeds), negative control, README snippets PASS: 35/35 tests, 2015/2015 twice, negative control 53/215 differ
Same gate on Mojo 1.1.0 with emberserde removed PASS, same counts
from_xml 80k items, same session, best of 5: v0.1.0 (1.1.0 + emberserde) vs v0.2.0 (1.2.0) 28.3-28.9 ms vs 28.3-28.9 ms; peak RSS 27.4 MB vs 24.7 MB

Known limits

  • Parsing 80k sibling elements is about 5% slower on Mojo 1.2.0 than on 1.1.0 (16.8 vs 17.7 ms, same session); the parser did not change.
  • Only unit Variant arms, scalar SIMD fields and String map keys, as in v0.1.0.

Upgrade / run

pixi install      # Mojo 1.2.0
# in your code: from emberserde import Rename  ->  from xmojo import Rename

Commits

  • a76920f docs: README for the own reflection layer and Mojo 1.2
  • 6dc218c build: Mojo 1.2.0
  • 0e9dad3 refactor!: own reflection layer, drop emberserde
  • cf11d2a docs: NOTICE names the owner and contact
  • f45bf4d publish-check: lint workflows with actionlint
  • 7bc529e publish-check: fail on workflow actions pinned to a deprecated runtime
  • f2b695d ci: actions/checkout v7 (node24)