
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
typeid-python
Advanced tools
Python implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs
[!WARNING]
mainmay contain unreleased changes. For stable usage, use the latest release tag.
A high-performance Python implementation of TypeIDs — type-safe, sortable identifiers based on UUIDv7.
TypeIDs are designed for modern systems where identifiers should be:
This library provides a Python package with Rust acceleration.
user_, order_, ...)new, encode, decode, explain)TypeID is optimized for real-world performance, not just correctness.
| Operation | Before Rust | Rust + optimizations |
|---|---|---|
| Generate | 3.47 µs | 0.70 µs |
| Parse | 2.08 µs | 1.30 µs |
| Workflow | 5.52 µs | 2.25 µs |
Benchmarks are:
bench/See Docs: Performance for details.
$ pip install typeid-python
Included:
uuid-utils for fast UUIDv7 generation$ pip install typeid-python[yaml] # YAML schema support
$ pip install typeid-python[cli] # CLI tools
Extras are strictly optional.
from typeid import TypeID
tid = TypeID(prefix="user")
assert tid.prefix == "user"
assert isinstance(tid.suffix, str)
assert str(tid).startswith("user_")
from typeid import TypeID
tid = TypeID.from_string("user_01h45ytscbebyvny4gc8cr8ma2")
assert tid.prefix == "user"
from typeid import TypeID
from uuid_utils import uuid7
u = uuid7()
tid = TypeID.from_uuid(prefix="user", suffix=u)
assert tid.uuid.version == 7
from typing import Literal
from typeid import TypeID, typeid_factory
UserID = TypeID[Literal["user"]]
gen_user_id = typeid_factory("user")
user_id = gen_user_id()
$ pip install typeid-python[cli]
Generate:
$ typeid new -p user
user_01h2xcejqtf2nbrexx3vqjhp41
Decode:
$ typeid decode user_01h2xcejqtf2nbrexx3vqjhp41
uuid: 0188bac7-4afa-78aa-bc3b-bd1eef28d881
Encode:
$ typeid encode 0188bac7-4afa-78aa-bc3b-bd1eef28d881 --prefix user
TypeID is framework-agnostic by design. Integrations are provided as optional adapters, installed explicitly and kept separate from the core.
Pydantic (v2) Native field type with validation and JSON Schema support.
from typing import Literal
from pydantic import BaseModel
from typeid.integrations.pydantic import TypeIDField
class User(BaseModel):
id: TypeIDField[Literal["user"]]
FastAPI (Coming Soon 🚧)
SQLAlchemy (Coming Soon 🚧)
All integrations are opt-in via extras and never affect the core package.
typeid explain — understand any ID$ typeid explain user_01h45ytscbebyvny4gc8cr8ma2
Outputs:
parsed:
prefix: user
uuid: 01890bf0-846f-7762-8605-5a3abb40e0e5
created_at: 2025-03-12T10:41:23Z
sortable: true
Works without schema, fully offline.
Define meaning for prefixes using JSON or YAML.
Example (typeid.schema.json):
{
"schema_version": 1,
"types": {
"user": {
"name": "User",
"owner_team": "identity-platform",
"pii": true
}
}
}
Then:
$ typeid explain user_01h45ytscbebyvny4gc8cr8ma2
Read more here: "Docs: Explain".
Think of TypeID as UUIDs + semantics + observability — without sacrificing speed
MIT
FAQs
Python implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs
We found that typeid-python demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.