skillfed

uuid6

New time-based UUID formats which are suited for use as a database key

uuid6 v2025.0.1 18.0M downloads/30d#1,090 on PyPI181
Permissive license MIT Active released

What it is and what it does

uuid6 extends Python's built-in UUID class with three new time-based UUID generators—uuid6(), uuid7(), and uuid8()—that implement the proposed IETF RFC 9562 standard. These formats are designed to be sortable and database-friendly, addressing a key limitation of random UUIDs (uuid4) which scatter across index space. UUID version 7 is recommended for most use cases, using Unix epoch milliseconds for ordering and improved entropy. UUID version 6 provides a reordered variant of UUID version 1 for systems with existing v1 UUIDs. UUID version 8 trades some entropy for nanosecond-level timestamp precision when finer granularity is required.

The package has no runtime dependencies and installs cleanly. It is actively maintained, supports Python 3.9 through 3.13, and carries an MIT license. The implementation includes a conversion function (uuid1_to_uuid6) for migrating existing UUID version 1 objects. All three generators are documented as not thread-safe, so concurrent use requires external synchronization.

Use it for:

  • Generate sortable primary keys for database tables where insertion order and query performance matter.
  • Replace uuid4() in applications that need both uniqueness and temporal ordering without additional indexing overhead.
  • Migrate legacy systems using UUID version 1 to the improved UUID version 6 format via uuid1_to_uuid6().
  • Generate UUIDs with nanosecond precision for high-resolution event logging or financial transaction tracking.
  • Implement distributed system identifiers where both time-ordering and cryptographic randomness are required.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates time-based UUID formats (versions 6, 7, and 8) optimized for use as database keys, extending Python's standard UUID class with RFC 9562 compliant functions.

Yes. uuid6 is a lightweight, zero-dependency package that solves a real database performance problem by providing RFC 9562 compliant, sortable UUIDs. It is actively maintained, supports current Python versions, carries a permissive MIT license, and has no known vulnerabilities. Install it if you generate UUIDs for database keys and want better index locality than random UUIDs provide.

Install

uuid6 on PyPI

pip

pip install uuid6

uv

uv add uuid6

poetry

poetry add uuid6

Installing uuid6

Before you install

Installs with no runtime dependencies and low friction. Actively maintained with recent commits and a stable release cadence; supports Python 3.9 through 3.13.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects with minimal obligations.

Quickstart

pip install uuid6

import uuid6

my_uuid = uuid6.uuid7()
print(my_uuid)
assert my_uuid < uuid6.uuid7()

Verify before relying

  • Thread-safety guarantees for uuid6(), uuid7(), and uuid8() in concurrent environments beyond the documented 'not thread-safe' note.
  • Performance characteristics and suitability for high-throughput UUID generation workloads.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 406 days since the last release
Last repo commit
First released
Downloads 18,014,267/month — #1,090 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: uuid6-2025.0.1-py3-none-any.whl

Keywords: uuid, uuid6, uuid7, uuid8, uuidv6, uuidv7, uuidv8

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9

Tags

time-based uuid generationuuid6 uuid7 uuid8sortable uuid for databaserfc 9562 uuidordered uuid keysdatabase-friendly uuiduuid with timestamp
uuid-generationdatabase-keysrfc-9562

More Database packages