uuid7gen
A lightweight and pure-Python implementation of UUIDv7 for Python versions < 3.11. Fully compatible with RFC 9562, including submillisecond precision.
Installation
pip install uuid7gen
Usage
Generate a single UUIDv7 (with optional submillisecond precision)
from uuid7gen import uuid7
id = uuid7()
print(id)
# Example output (ms precision):
# 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7c
# Generate with submillisecond precision
timestamp_ms = 1620000000123.456 # float, ms since epoch
id_subms = uuid7(timestamp_ms=timestamp_ms)
print(id_subms)
# Example output (subms precision):
# 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7d
Generate a batch of UUIDv7s (supports subms intervals)
from uuid7gen import batch_uuid7
ids = batch_uuid7(5, timestamp_start_ms=1620000000123.0, interval_ms=0.1)
for i, id in enumerate(ids):
print(f"{i+1}: {id}")
# Example output:
# 1: 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7c
# 2: 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7d
# 3: 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7e
# 4: 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7f
# 5: 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c80
Visual representations of a UUIDv7
id = uuid7()
print("standard string:", id)
print("bytes:", id.bytes)
print("hex:", id.hex)
print("int:", id.int)
print("urn:", id.urn)
# Example output:
# standard string: 018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7c
# bytes: b'\x01\x8en|{|\x7f|\xbf|||||||'
# hex: 018e6e7c7b7c7f7cbf7c7c7c7c7c7c7c7c
# int: 212345678901234567890123456789012345
# urn: urn:uuid:018e6e7c-7b7c-7f7c-bf7c-7c7c7c7c7c7c
Features:
- RFC 9562 compliant (including submillisecond encoding)
- Python <3.11 compatible
- Batch generation with subms intervals
For more details, see the documentation.
Metadata
Release files for uuid7gen 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| uuid7gen-0.1.0.tar.gz | 4.5 kB | Without provenance | Details for uuid7gen-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| uuid7gen-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for uuid7gen-0.1.0-py3-none-any.whl |
Total release size: 9.1 kB
Release files / uuid7gen-0.1.0.tar.gz
| Download URL | uuid7gen-0.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ead289983f2c2181214c3530534acc13a0630884976885fd5db090883a738bb
|
|
BLAKE2b-256 checksum How to use checksums |
857365e3c024b0c278d9af90e4a14abd02bd7d1b95e27e7629231940aef67ebd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.3
|
Release files / uuid7gen-0.1.0-py3-none-any.whl
| Download URL | uuid7gen-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a17013fc65c08eb413b38d7aec44fb0f8ffb27d3281f46d4bd0933c0fdd03ce
|
|
BLAKE2b-256 checksum How to use checksums |
9f153a0f75ab589f536fa62a5cf6567814360bf27cf2a5006edcf525ee8dd264
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.3
|
Security for uuid7gen 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.