{"id":6928,"library":"typeid-python","title":"TypeID Python","description":"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.","status":"active","version":"0.3.10","language":"en","source_language":"en","source_url":"https://github.com/akhundMurad/typeid-python","tags":["typeid","uuid","identifier","unique-id","k-sortable","pydantic"],"install":[{"cmd":"pip install typeid-python","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for UUIDv7 generation. It is a direct dependency.","package":"uuid-utils","optional":false}],"imports":[{"symbol":"TypeID","correct":"from typeid import TypeID"}],"quickstart":{"code":"from typeid import TypeID\n\n# Generate a new TypeID with a prefix (uses a new UUIDv7 internally)\nuser_id = TypeID(\"user\")\nprint(f\"Generated TypeID: {user_id}\")\nprint(f\"Prefix: {user_id.prefix}\")\nprint(f\"UUID: {user_id.uuid}\") # Raw UUID object\n\n# Get the string representation\nuser_id_str = str(user_id)\nprint(f\"String representation: {user_id_str}\")\n\n# Parse a TypeID from a string\nparsed_id = TypeID.from_string(user_id_str)\nprint(f\"Parsed TypeID: {parsed_id}\")\n\n# Compare TypeIDs\nassert user_id == parsed_id\n","lang":"python","description":"This example demonstrates how to generate a new TypeID, extract its components, convert it to and from its string representation, and compare TypeID objects."},"warnings":[{"fix":"Upgrade your Python environment to version 3.10 or later. For example, `pyenv install 3.10.12 && pyenv local 3.10.12`.","message":"Python 3.8 and 3.9 support was dropped. The library now requires Python 3.10 or newer.","severity":"breaking","affected_versions":">=0.3.2"},{"fix":"Ensure all TypeID prefixes conform to the regex `[a-z]{0,63}` (lowercase alphanumeric, max 63 characters).","message":"The 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.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"No direct fix is typically needed as the library handles fallbacks. However, for optimal performance, ensure a compatible environment for Rust-powered wheels. Check documentation for specific platform build troubleshooting if performance is critical and seems suboptimal.","message":"Starting 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.","severity":"gotcha","affected_versions":">=0.3.5"},{"fix":"Upgrade to `typeid-python` version 0.3.9 or later to ensure correct Pydantic JSON schema generation for FastAPI/OpenAPI integrations.","message":"Prior 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.","severity":"gotcha","affected_versions":"<0.3.9"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}