| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
pUUID - Prefixed UUIDs for Python with Pydantic & SQLAlchemy support.
Raw UUIDs like 019b9a2e-9856-... are annoying to work with. They provide no context in logs, traces or bug reports and offer no safe guards against accidental ID swapping in code. pUUID provides prefixed UUIDs for python with minimal overhead and strong type guarantees.
# NOTE: pUUID requires python 3.14+
pip install pUUID
# For Pydantic support:
pip install 'pUUID[pydantic]'
# For SQLAlchemy support:
pip install 'pUUID[sqlalchemy]'Define a domain-specific ID by inheriting from a versioned base:
from typing import Literal
from puuid import PUUIDv7
class UserUUID(PUUIDv7[Literal["user"]]): ...
# Generation
uid = UserUUID.factory()
print(uid) # user_019b956e-ed25-70db-9d0a-0f30fb9047c2
# Deserialization
uid2 = UserUUID.from_string("user_019b956e-ed25-70db-9d0a-0f30fb9047c2")If you only need lexicographically sortable IDs and want to build the SQLAlchemy support yourself, these two projects might be for you:
Digon.IO provides dev & data end-to-end consulting for SMEs and software companies. (Website) (Technical Blog)
The sponsor logo is the property of Digon.IO GmbH. Standard trademark and copyright restrictions apply to any use outside this repository.
| Back | FazBrowse Home | New Git URL |