skillfed

cyksuid

Cython implementation of ksuid

cyksuid v2.1.0 213.6K downloads/30d#9,433 on PyPI52
Permissive license BSD AGING released

What it is and what it does

CyKSUID is a Cython-based implementation of KSUID, a sortable unique identifier format that combines a timestamp with random data. It generates IDs that are lexicographically sortable by creation time, making them useful for databases and distributed systems where time-ordered uniqueness matters. The package provides two APIs (v1 and v2) and exposes IDs in multiple formats: raw bytes, hex, base32-encoded strings, and as Python datetime objects.

The library has no runtime dependencies beyond Python and a C compiler, and ships with pre-built wheels for most common platforms. It's positioned as a high-performance alternative to UUID libraries when you need sortability and timestamp extraction without external dependencies. The benchmark data shows it generates IDs roughly 3-4x faster than comparable implementations.

Use it for:

  • Generate sortable IDs for database records that need to be ordered by creation time without a separate timestamp column.
  • Create distributed system identifiers that are globally unique and time-ordered without requiring a central ID service.
  • Replace UUIDs in applications where both uniqueness and sortability are required for efficient indexing.
  • Extract creation timestamps from IDs after the fact using the parse function and datetime property.
  • Build audit logs or event streams where ID ordering reflects event sequence without explicit timestamps.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates and parses KSUIDs (K-Sortable Globally Unique IDs) using a high-performance Cython implementation, providing sortable unique identifiers with embedded timestamps.

Yes, if you need sortable unique IDs with embedded timestamps and want better performance than pure-Python alternatives. The permissive BSD license, lack of runtime dependencies, and production-stable status make it low-risk. The aging maintenance status (last release 688 days ago) is a minor concern but not a blocker—the code is stable and the repository remains active. Install friction is moderate due to compilation, but pre-built wheels cover most platforms.

Install

cyksuid on PyPI

pip

pip install cyksuid

uv

uv add cyksuid

poetry

poetry add cyksuid

Installing cyksuid

Before you install

Medium install friction due to compiled wheels, but pre-built binaries are available for common platforms (macOS, Linux, Windows across x86_64 and ARM). Last release was 688 days ago; repository remains active with recent commits and is marked production-stable.

License in practice

BSD license is permissive and imposes minimal restrictions; you may use, modify, and distribute this package in commercial and private projects with only attribution required.

Quickstart

pip install cyksuid

from cyksuid.v2 import ksuid, parse

uid = ksuid()
print(uid.encoded)  # b'2G2IfS6177qFICE3w10eMjgYu89'
print(uid.timestamp)  # 1665580354.0
print(uid.datetime)  # datetime with UTC timezone

Requires a C compiler at install time if pre-built wheels are unavailable for your platform; Python 3.7 or later.

Verify before relying

  • Whether the v1 and v2 APIs are both actively maintained or if v1 is deprecated.
  • Performance characteristics under high-concurrency workloads beyond the single-threaded benchmark shown.
  • Whether KSUIDs generated by this implementation are compatible with the original Go KSUID library in all edge cases.
  • Exact byte length and structure of generated IDs.

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.7)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance aging — 688 days since the last release
Last repo commit
First released
Downloads 213,593/month — #9,433 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cyksuid-2.1.0-cp310-cp310-macosx_10_15_universal2.whl; cyksuid-2.1.0-cp310-cp310-macosx_10_9_x86_64.whl; cyksuid-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cyksuid-2.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cyksuid-2.1.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; cyksuid-2.1.0-cp310-cp310-musllinux_1_1_aarch64.whl; cyksuid-2.1.0-cp310-cp310-musllinux_1_1_x86_64.whl; cyksuid-2.1.0-cp310-cp310-win32.whl; cyksuid-2.1.0-cp310-cp310-win_amd64.whl; cyksuid-2.1.0-cp310-cp310-win_arm64.whl; cyksuid-2.1.0-cp311-cp311-macosx_10_15_universal2.whl; cyksuid-2.1.0-cp311-cp311-macosx_10_9_x86_64.whl; cyksuid-2.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cyksuid-2.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cyksuid-2.1.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; cyksuid-2.1.0-cp311-cp311-musllinux_1_1_aarch64.whl; cyksuid-2.1.0-cp311-cp311-musllinux_1_1_x86_64.whl; cyksuid-2.1.0-cp311-cp311-win32.whl; cyksuid-2.1.0-cp311-cp311-win_amd64.whl; cyksuid-2.1.0-cp311-cp311-win_arm64.whl

Keywords: ksuid

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: CythonProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

ksuid generation pythonsortable unique id generatork-sortable globally unique idstimestamp-based uuid alternativecython uuid librarydistributed id generation
unique-idssortable-identifiersdistributed-systems

More Software Development packages