A Python extension providing Crockford Base32 UUID support for the msgspec serialization library. The core encoding and decoding logic is written in Rust and exposed through PyO3.
CrockfordUUIDtype with generation helpers for v4 UUIDscuuid_encoderandcuuid_decoderhooks for msgspec- Stable ABI wheels built with
maturinand theabi3feature
uv pip install pycrockford_msgspecimport msgspec
from pycrockford_msgspec import CrockfordUUID, cuuid_encoder, cuuid_decoder
class Event(msgspec.Struct):
event_id: CrockfordUUID
payload: dict
encoder = msgspec.json.Encoder(enc_hook=cuuid_encoder)
decoder = msgspec.json.Decoder(type=Event, dec_hook=cuuid_decoder)
event = Event(CrockfordUUID.generate_v4(), {"hello": "world"})
data = encoder.encode(event)
restored = decoder.decode(data)
assert restored == eventBuild wheels using maturin:
uv pip install -e .[dev]
maturin build --releaseRun tests:
cargo test
pytest -qmake fmt and make check-fmt run mdtablefix (version 0.6.1, the same
release CI installs); install it once with
cargo install --locked mdtablefix --version 0.6.1. make fmt also runs
markdownlint-cli2, which CI provides through its GitHub action; locally
install it with bun install -g markdownlint-cli2 (or
npm install -g markdownlint-cli2). This replaces the previous mdformat-all
wrapper.
The documentation lives in docs/ and uses Sphinx. Install Sphinx and run:
uv pip install sphinx
sphinx-build -M html docs/source docs/_buildGenerated HTML will appear in docs/_build/html. This directory is ignored by
Git and should not be committed.
Run make spelling after changing Markdown. The target refreshes the shared
leynos en-GB-oxendict dictionary only when its published source is newer than
the ignored local cache, regenerates the tracked typos.toml, and runs the
pinned typos 1.48.0 release. Add narrow repository-only exceptions to
typos.local.toml; never edit the generated configuration by hand.