Stripe-style prefixed identifiers -typed, time-sortable, and human-readable. Branded for static analysis, runtime type checkable for external APIs, URL safe, and native to Pydantic, FastAPI, and SQLAlchemy.

Under the hood it uses Python 3.14’s native uuid7 for time-sortable unique ids, encoded as URL-safe base62 strings.

uv add uplid

Usage

from typing import Literal
from uplid import UPLID, factory
from pydantic import BaseModel, Field

UserId = UPLID[Literal["usr"]]
UserIdFactory = factory(UserId)

class User(BaseModel):
    id: UserId = Field(
        default_factory=UserIdFactory
    )

Related Articles

Introducing UPLID