{"id":21090,"library":"cyksuid","title":"cyksuid","description":"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.","status":"active","version":"2.1.0","language":"python","source_language":"en","source_url":"https://github.com/timonwong/cyksuid","tags":["ksuid","unique-id","cython","sortable"],"install":[{"cmd":"pip install cyksuid","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"KSUID","correct":"from cyksuid import KSUID"}],"quickstart":{"code":"from cyksuid import KSUID\n\n# Generate a new KSUID\nksuid = KSUID()\nprint(ksuid)           # e.g., 1srTbCFx8Z1V6gU3Zf8ZqT6aG8r\nprint(ksuid.timestamp) # datetime object\nprint(ksuid.payload)   # bytes payload\n\n# Parse from string\ntry:\n    parsed = KSUID.from_string('1srTbCFx8Z1V6gU3Zf8ZqT6aG8r')\n    print(parsed)\nexcept Exception as e:\n    print('Invalid KSUID:', e)","lang":"python","description":"Generate and parse KSUIDs."},"warnings":[{"fix":"Upgrade Python to 3.7+ or pin cyksuid<2 if Python 2 is required.","message":"Version 2.x drops Python 2 support. Requires Python >=3.7.","severity":"breaking","affected_versions":"2.0.0 and above"},{"fix":"Convert to string before serializing: json.dumps({'id': str(ksuid)})","message":"KSUID objects are not JSON serializable by default. Use str(ksuid) or ksuid.string property.","severity":"gotcha","affected_versions":"all"},{"fix":"If you need strictly monotonic order across sub-second calls, consider using a more sophisticated generation strategy.","message":"KSUID constructor with no arguments uses current UTC time. On very fast loops, identical timestamps produce unique payloads but may have identical seconds.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install cyksuid' in your current environment.","cause":"Package not installed or installed in a different environment.","error":"ModuleNotFoundError: No module named 'cyksuid'"},{"fix":"Use 'from cyksuid import KSUID'.","cause":"Incorrect import path (e.g., from cyksuid.ksuid import KSUID).","error":"AttributeError: module 'cyksuid' has no attribute 'KSUID'"},{"fix":"Ensure timestamp parameter is a non-negative integer less than 2^32 (max 4294967295) or use default.","cause":"Attempting to create a KSUID with an out-of-range timestamp parameter (e.g., negative or > 2^32-1).","error":"OverflowError: Python int too large to convert to C long"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}