uuid6
New time-based UUID formats which are suited for use as a database key
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 uuid6uv
uv add uuid6poetry
poetry add uuid6Installing 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
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
uuid-v7Generates UUID v7 and v6 identifiers, extending…
unclear · top 15,000 on PyPI
uuid7-standardGenerates and parses UUIDv7 identifiers with…
permissive · top 15,000 on PyPI
uuid7Generates version 7 UUIDs that are…
permissive · top 5,000 on PyPI
uuid-extensionGenerates UUID version 7…
unclear · top 15,000 on PyPI
uuid-utilsFast UUID generation and manipulation for all…
permissive · top 1,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
nanotimeNanotime provides a 64-bit UNIX timestamp type…
permissive · top 15,000 on PyPI
timeflakeGenerates 128-bit, time-ordered, URL-safe…
permissive · top 15,000 on PyPI
fastuuidFastUUID provides CPython bindings to Rust's…
permissive · top 1,000 on PyPI