Registry / serialization / typeid-python

typeid-python

JSON →
library0.3.10pypypi✓ verified 35d ago

typeid-python is a Python implementation of TypeIDs, offering type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs. It is actively maintained with frequent releases, focusing on performance, robustness, and developer experience.

serializationdatabase
Install & Compatibility
Where this runs
tested against v0.3.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 1.75s
py 3.11
✕ build_error
✓ 1.73s
py 3.12
✕ build_error
✓ 1.53s
py 3.13
✕ build_error
✓ 1.68s
py 3.9
✓ —
✓ 1.78s
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from typeid import TypeID

This example demonstrates how to generate a new TypeID, extract its components, convert it to and from its string representation, and compare TypeID objects.

from typeid import TypeID # Generate a new TypeID with a prefix (uses a new UUIDv7 internally) user_id = TypeID("user") print(f"Generated TypeID: {user_id}") print(f"Prefix: {user_id.prefix}") print(f"UUID: {user_id.uuid}") # Raw UUID object # Get the string representation user_id_str = str(user_id) print(f"String representation: {user_id_str}") # Parse a TypeID from a string parsed_id = TypeID.from_string(user_id_str) print(f"Parsed TypeID: {parsed_id}") # Compare TypeIDs assert user_id == parsed_id
Debug
Known footguns
breakingPython 3.8 and 3.9 support was dropped. The library now requires Python 3.10 or newer.
breakingThe prefix validation was updated in v0.3.0 to adhere strictly to the TypeID specification regex (`[a-z]{0,63}`). Prefixes that were previously accepted but did not conform will now raise an error.
gotchaStarting from v0.3.5, the library introduced optional Rust acceleration, which became standard in v0.3.7 for improved performance in base32 encoding/decoding and UUIDv7 generation. While a pure-Python fallback exists, users might experience performance differences on platforms where native wheels aren't available or if the Rust extension fails to build.
gotchaPrior to v0.3.9, there was an issue with Pydantic JSON schema generation for FastAPI/OpenAPI, leading to incorrect schema definitions. This was fixed in v0.3.9.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
16 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources