skillfed

svix-ksuid

A pure-Python KSUID implementation

svix-ksuid v0.7.0 269.9K downloads/30d#8,247 on PyPI161
Permissive license MIT Active released

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 on this page — 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

svix-ksuid on PyPI

pip

pip install svix-ksuid

uv

uv add svix-ksuid

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — python-baseconv
Maintenance actively maintained — 153 days since the last release
Last repo commit
First released
Downloads 269,905/month — #8,247 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: svix_ksuid-0.7.0-py3-none-any.whl

Keywords: ksuid, svix

Tags

ksuid generationsorted unique identifierstimestamp-based idssortable uid libraryk-sorted uid python
identifier-generationdistributed-systems

More Utilities packages