c-uuid-v7

raw JSON →
0.0.11 verified Sat May 09 auth: no python

A fast UUID v7 generator implemented as a CPython C extension, version 0.0.11. Provides a simple interface for generating time-ordered UUIDs compliant with RFC 9562. Released periodically with performance improvements.

pip install c-uuid-v7
error ImportError: cannot import name 'UUIDv7' from 'c_uuid_v7'
cause The library may not be installed correctly, or you have a different package with a similar name.
fix
Run pip install --upgrade c-uuid-v7 and verify the installation with pip show c-uuid-v7.
error ModuleNotFoundError: No module named 'c_uuid_v7'
cause The package is not installed or the import path is wrong (e.g., using hyphen instead of underscore).
fix
Install with pip install c-uuid-v7 and import as from c_uuid_v7 import UUIDv7.
breaking Requires Python >=3.10; on older Python versions, installing from source may fail or produce errors.
fix Upgrade to Python 3.10 or later.
gotcha The library exports only UUIDv7, not a function like 'uuid7()' or 'generate()'. Users may mistakenly try to call uuid7() or import from uuid module.
fix Use `from c_uuid_v7 import UUIDv7; uid = UUIDv7()`.
gotcha Generated UUIDs are time-ordered but not guaranteed to be strictly monotonic across multiple processes due to clock skew or high concurrency; rely on them for ordering within a single process only.
fix For cross-process monotonicity, consider using a coordinator or additional sequence counter.

Generate a UUID v7 using the C extension. The UUIDv7 class can be instantiated directly and provides .hex and .bytes properties.

from c_uuid_v7 import UUIDv7

# Generate a single UUID v7
uid = UUIDv7()
print(uid)  # e.g., 018f3a6e-1b2c-7a3d-8e4f-5a6b7c8d9e0f

# Generate as hex string
hex_str = uid.hex
print(hex_str)

# Generate as bytes
bytes_val = uid.bytes
print(bytes_val)