uuid7
UUID version 7, generating time-sorted UUIDs with 200ns time resolution and 48 bits of randomness
What it is and what it does
uuid7 implements version 7 UUIDs as proposed in draft-peabody-dispatch-new-uuid-format-02, which encode a Unix timestamp in the first 36 bits followed by fractional seconds, a sequential counter, and random bits. Unlike standard UUIDs, version 7 UUIDs sort chronologically by their creation time, making them useful for databases and systems where insertion order matters. The package provides multiple output formats (bytes, hex, int, str, uuid, or None).
The implementation allocates the 128 bits as: 36 bits of whole seconds since epoch, 24 bits of fractional seconds (approximately 50ns resolution), 14 bits of sequential counter for repeated calls within the same time tick, and 48 bits of randomness, plus RFC4122-mandated version and variant bits. Generation is faster than uuid.uuid4() when returning integers or strings, though slightly slower when returning UUID objects.
Use it for:
- Database primary keys where insertion order and time-based sorting are both required without a separate timestamp column.
- Distributed system event IDs that need to be both globally unique and chronologically orderable across nodes.
- Time-series data collection where UUID generation order reflects actual event timing.
- Log entry identifiers that can be sorted by creation time without parsing metadata.
- Microservice request tracing where trace IDs encode their generation timestamp for quick temporal analysis.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates version 7 UUIDs that are time-sortable with chronological ordering and include randomness for uniqueness.
Yes, if you need time-sortable UUIDs and can accept a dormant package (no updates since 2021-12-29). The implementation is simple, dependency-free, and MIT-licensed. However, verify that RFC4122 version 7 adoption aligns with your infrastructure's UUID support before committing to it as a primary identifier scheme.
Install
uuid7 on PyPI
pip
pip install uuid7uv
uv add uuid7poetry
poetry add uuid7Installing uuid7
Before you install
No runtime dependencies and a pure-Python wheel distribution make installation straightforward. The package is dormant (last release 2021-12-29, last commit 2025-02-10) but the repository remains active and unarchived.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install uuid7
from uuid7 import uuid7
# Generate a time-sortable UUID
my_uuid = uuid7()
print(my_uuid) # UUID('061cb26a-54b8-7a52-8000-2124e7041024')
Verify before relying
- Whether the 50ns time resolution claim and the 200ns resolution in the summary are equivalent or represent different measurement contexts.
- Current adoption rate and real-world production use beyond the top-5000 download tier.
- Whether draft-peabody-dispatch-new-uuid-format-02 has progressed to RFC status since the package's 2021 release.
- Import path: whether uuid7() is imported directly from uuid7 or from a submodule.
Package facts
| License | MIT license (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,689 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,610,259/month — #1,223 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: uuid7-0.1.0-py2.py3-none-any.whl
Keywords: uuid7
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
uuid-extensionGenerates UUID version 7…
unclear · top 15,000 on PyPI
timeflakeGenerates 128-bit, time-ordered, URL-safe…
permissive · top 15,000 on PyPI
uuidProvides UUID object creation and RFC…
unclear · top 5,000 on PyPI
uuid6Generates time-based UUID formats (versions 6,…
permissive · top 5,000 on PyPI
uuid-utilsFast UUID generation and manipulation for all…
permissive · top 1,000 on PyPI
uuid7-standardGenerates and parses UUIDv7 identifiers with…
permissive · top 15,000 on PyPI
uuid-v7Generates UUID v7 and v6 identifiers, extending…
unclear · top 15,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
c_uuid_v7Generates UUID v7 identifiers via a CPython C…
permissive · top 15,000 on PyPI
freeze-uuidDecorator and context manager to mock Python's…
permissive · top 15,000 on PyPI