Registry / serialization / cyksuid

cyksuid

JSON →
library2.1.0pypypi✓ verified 84d ago

A Cython-based implementation of KSUID (K-Sortable Unique IDentifier) for Python. Version 2.1.0 provides fast generation and parsing of KSUIDs with a focus on performance. Released under MIT license.

pip install cyksuid
INSTALL
IMPORT
SIG · CYKSUID
C
cyksuid
serializationpythonv2.1.0
Install
1.6s avg
Import
Disk
19MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.0 · 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
✓ —
✓ 1.6s
py 3.11
✓ —
✓ 1.7s
py 3.12
✓ —
✓ 1.5s
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 1.7s
19MB installed
● package 19MB
Code
Verified usage

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

KSUID
import cyksuid
from cyksuid import KSUID

Generate and parse KSUIDs.

from cyksuid import KSUID # Generate a new KSUID ksuid = KSUID() print(ksuid) # e.g., 1srTbCFx8Z1V6gU3Zf8ZqT6aG8r print(ksuid.timestamp) # datetime object print(ksuid.payload) # bytes payload # Parse from string try: parsed = KSUID.from_string('1srTbCFx8Z1V6gU3Zf8ZqT6aG8r') print(parsed) except Exception as e: print('Invalid KSUID:', e)
Debug
Known issues
breakingVersion 2.x drops Python 2 support. Requires Python >=3.7.
fix
Upgrade Python to 3.7+ or pin cyksuid<2 if Python 2 is required.
affects: 2.0.0 and above
gotchaKSUID objects are not JSON serializable by default. Use str(ksuid) or ksuid.string property.
fix
Convert to string before serializing: json.dumps({'id': str(ksuid)})
affects: all
gotchaKSUID constructor with no arguments uses current UTC time. On very fast loops, identical timestamps produce unique payloads but may have identical seconds.
fix
If you need strictly monotonic order across sub-second calls, consider using a more sophisticated generation strategy.
affects: all
Upgrade
Version history
2.1.0latest on PyPI · released Sep 25, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources