--- id: svix-ksuid version: "0.7.0" license: MIT license_treatment: permissive maintenance: active --- # svix-ksuid — A pure-Python KSUID implementation License: permissive · Maintenance: active · Downloads: 269.9K/mo ## What it is and what it does Svix-KSUID is a pure-Python implementation of K-sorted unique identifiers, a variant of UUIDs that embed a timestamp component. Unlike standard UUIDs, KSUIDs can be approximately sorted by their creation time without additional metadata. The library provides two modes: standard KSUIDs with 1-second timestamp accuracy, and KsuidMs for 4-millisecond accuracy by trading one byte of random payload. Both modes produce valid, compatible KSUIDs that can be serialized to base62 strings, raw bytes, or reconstructed from either format. The package handles the full lifecycle of KSUID operations: generation with optional datetime specification, parsing from base62 strings or bytes, timestamp extraction, and comparison operations. It's designed as a lightweight utility for systems that need sortable identifiers with embedded temporal information, commonly used in event logging, database record identification, and distributed systems where ordering by creation time is valuable. Use it for: - Generate sortable event IDs in logging systems where chronological ordering is needed without separate timestamps. - Create database record identifiers that preserve insertion order for efficient range queries and pagination. - Build distributed system identifiers where multiple services generate IDs independently but need global ordering. - Replace UUIDs in APIs where clients need to infer approximate creation order from the ID alone. - Store webhook event identifiers that can be sorted by delivery time without additional metadata lookups. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates and parses KSUIDs (K-sorted unique identifiers) that combine a timestamp with random data, allowing approximate chronological ordering by creation time. Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and installs with minimal friction. Install it if you need sortable IDs with embedded timestamps; skip it if standard UUIDs or database-generated sequences already fit your use case. ## Install pip install svix-ksuid uv add svix-ksuid poetry add svix-ksuid ## Installing svix-ksuid Before you install: Low install friction with a single pure-Python dependency. The package is actively maintained with recent commits, and requires Python 3.10 or later. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects. Quickstart: pip install svix-ksuid from ksuid import Ksuid ksuid = Ksuid() print(f"Base62: {ksuid}") print(f"Timestamp: {ksuid.timestamp}") print(f"Datetime: {ksuid.datetime}") Requires Python 3.10 or later. Verify before relying: - Whether the 4ms accuracy mode (KsuidMs) is suitable for your specific timing requirements compared to the 1-second default. - Performance characteristics when generating or parsing large volumes of KSUIDs in production workloads. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 269.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags ksuid generation, sorted unique identifiers, timestamp-based ids, sortable uid library, k-sorted uid python, identifier-generation, distributed-systems [View on SkillFed](https://skillfed.io/packages/svix-ksuid) · [View on PyPI](https://pypi.org/project/svix-ksuid/)