skillfed

uuid7

UUID version 7, generating time-sorted UUIDs with 200ns time resolution and 48 bits of randomness

uuid7 v0.1.0 14.6M downloads/30d#1,223 on PyPI132
Permissive license MIT license DORMANT released

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 uuid7

uv

uv add uuid7

poetry

poetry add uuid7

Installing 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

Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

time-sortable UUID generationuuid v7 implementationchronological UUIDsortable unique identifierstimestamp-based UUIDuuid7 libraryRFC4122 extension UUID
uuid-generationtime-sortabledistributed-systems

More Software Development packages