Skip to main content

Logo: pUUID - Prefixed UUIDs for Python

pUUID - Prefixed UUIDs for Python with Pydantic & SQLAlchemy support.

repository mirror License: LGPLv3 pipeline status coverage report Code style: black Imports: isort

pkgversion versionsupport Downloads Week Downloads Total


If you find the pUUID library beneficial, please consider supporting the project by starring it on GitHub.

GitHub Repo stars

pUUID - Prefixed UUIDs for Python

Features

  • Human-Friendly UUIDs: user_019b956e... instead of just 019b956e...
  • All UUID versions from RFC 9562.
  • Pydantic support. (Read more)
  • SQLAlchemy support. (Read more)
  • Strong type guarantees!

Installation

pip install pUUID

# For SQLAlchemy support:
pip install 'pUUID[sqlalchemy]'

Usage

Define a domain-specific ID by inheriting from a versioned base:

from typing import Literal
from puuid import PUUIDv7

class UserUUID(PUUIDv7[Literal["user"]]):
    _prefix = "user"

# Generation
uid = UserUUID()
print(uid) # user_019b956e-ed25-70db-9d0a-0f30fb9047c2

# Deserialization
uid = UserUUID.from_string("user_019b956e-ed25-70db-9d0a-0f30fb9047c2")

Resources

Alternatives

If you only need lexicographically sortable IDs and want to build the SQLAlchemy support yourself, these two projects might be for you:

  • TypeID - pUUID supports all UUID versions because it uses Python’s standard uuid library for UUID generation, while TypeID uses a custom generator that comes with performance improvements but only supports UUIDv7. TypeID does not support SQLAlchemy out of the box.
  • UPID - UPID implements a modified version of the ULID standard, which was designed before UUIDv7 was available. UPID does not support SQLAlchemy out of the box.

Sponsor

Digon.IO GmbH Logo

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.

License

  • Library source code: Licensed under LGPLv3.

Metadata

Release files for pUUID 1.0.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 pUUID 1.0.0
File Size Uploaded Provenance Actions
puuid-1.0.0.tar.gz 6.3 kB Without provenance Details for puuid-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pUUID 1.0.0
File Interpreter ABI Platform Actions
puuid-1.0.0-py3-none-any.whl Python 3 none any Details for puuid-1.0.0-py3-none-any.whl

Total release size: 13.4 kB

Release files / puuid-1.0.0.tar.gz

Download URL puuid-1.0.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6ce27328865d2ee45a43cfc96299e969b88afccb3b925dc2256d26aa1ac3dc87
BLAKE2b-256 checksum
How to use checksums
0dab9b79d471174c4d5b8925446edb1355848c427b88e4be72a9a6ac89576b98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.8

Release files / puuid-1.0.0-py3-none-any.whl

Download URL puuid-1.0.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32a9ecaf23c4b4ce7221a33ab1c6f73393c43f93992b6e47a0576515d413c929
BLAKE2b-256 checksum
How to use checksums
a2b88c3e54ba25f38b98f11e0c27f01b5d24d3d6253724c52550dc3ce095a72e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.8

Security for pUUID 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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