Skip to main content

suuid

Semantic, filename- and S3-safe UUIDs.

A SUUID is a 3-part identifier you can use directly as an S3 object key, a filename, or a database column name:

<ClassName>__<safe_name>__<huuid>

Data__messung_2026_csv__9e51448c57ab5ef1b92d0c27f554a49e
└─ class    └─ readable name   └─ 32-char hex uuid
  • ClassName — the object/type class, case preserved ([A-Za-z0-9_]).
  • safe_name — a normalised human label ([a-z0-9_], no leading/trailing _).
  • huuid — a 32-char lowercase hex UUID.

The separator is exactly __ and no component contains __ or an edge _, so a SUUID parses back into its three parts unambiguously.

Why

  • Safe as a filename / S3 key. Only [A-Za-z0-9_] after the class, no spaces, no special characters — works on Linux, Windows, S3 and as a DB identifier.
  • Length-bounded. Every sname is ≤ 254 characters, so the metadata sibling key — sname + "_" — still fits the 255-char limit. Store an object under sname and its metadata under meta_name.
  • Reproducible. Name- and content-deterministic modes mean the same input always yields the same identifier, on every run and machine. The rules are frozen and versioned (NORMALIZATION_SPEC).

Install

uv add suuid
# or
uv pip install suuid

Usage

from suuid import SUUID

# Name-deterministic: same (class, name) -> same id, everywhere.
sid = SUUID.from_name("Data", "Messung 2026.csv")
sid.sname        # 'Data__messung_2026_csv__9e51...'
sid.meta_name    # 'Data__messung_2026_csv__9e51..._'  (metadata object key)
sid.huuid        # '9e51448c57ab5ef1b92d0c27f554a49e'
sid.did          # 'did:suuid:Data__messung_2026_csv__9e51...'

# Content-deterministic: same bytes -> same id (content-addressed, dedup).
SUUID.from_content("Doc", "spec.pdf", b"...bytes...")
SUUID.from_file("Doc", "spec.pdf")

# Random (non-reproducible).
SUUID.random("Run", "nightly")

# Round-trips.
SUUID.from_sname(sid.sname) == sid
SUUID.from_compact_token(sid.compact_token) == sid
SUUID.from_dict(sid.to_dict()) == sid

CLI

suuid mint --class Data --name "Messung 2026.csv"
suuid mint --class Doc  --name spec.pdf --mode content --content-file spec.pdf
suuid mint --class Run  --name nightly  --mode random
suuid parse --sname "Data__messung_2026_csv__9e51..."
suuid mint  --class Data --name x --json     # full to_dict() as JSON

The three modes

Mode Constructor huuid Reproducible
name from_name(cls, name) uuid5(NS, upper(class + safe_name)) yes
content from_content(cls, name, bytes) / from_file(cls, path) uuid5(NS, sha3-256(content)) yes (per content)
random random(cls, name) uuid4() no

In content mode the name stays human-readable; only the huuid is derived from the content hash (also exposed as content_hash, full sha3-256 hex).

Length budget

class (≤64) + "__" (2) + safe_name (≤154) + "__" (2) + huuid (32)  =  ≤ 254
                                                          + "_"     =  ≤ 255   (meta_name)

Development

uv sync
uv run pytest
uv run ruff check

Releasing

Published to PyPI via Trusted Publishing on GitHub Release — see RELEASING.md.

License

MIT — see LICENSE.

Metadata

Release files for suuid 0.2.0

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

Source distribution (sdist)

Source distribution for suuid 0.2.0
File Size Uploaded
suuid-0.2.0.tar.gz 22.5 kB Details

Built distribution (wheel)

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

Total release size: 33.7 kB

Release files / suuid-0.2.0.tar.gz

Download URL suuid-0.2.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b97c1f5afb34e5a802354edd6ed3f321c4de3885555aed6ba2e0b0dcc09fb0fe
BLAKE2b-256 checksum
How to use checksums
e4062126282fbd44bf2ba57a5878f4d7b5389de65f17540541b8cb2da64a78e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 25, 2026.

Transparency log

Release files / suuid-0.2.0-py3-none-any.whl

Download URL suuid-0.2.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd6d54b680d71f7732872a0bcf17e407854a9b5a6aec04bfbef221506e0c80c4
BLAKE2b-256 checksum
How to use checksums
93816b3086d9883960b13c0fa934bc3945c0b57e1c00fe760baa1ca3a6be02f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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