Skip to main content

UUID v9

An ultra-fast, lightweight, zero-dependency Python implementation of the UUID v9 proposal. The proposed UUID v9 format allows generating both time-based sequential and random non-sequential IDs with an optional prefix of up to 8 hexadecimal characters, an optional version identifier, an optional checksum, and sufficient randomness to avoid collisions.

Installation

Install UUID v9 from PyPI.

python3 -m pip install uuid-v9

Usage

from uuid_v9 import uuid, is_uuidv9, is_uuid

ordered_id = uuid()
prefixed_ordered_id = uuid('a1b2c3d4') # up to 8 hexadecimal characters
unordered_id = uuid('', False)
prefixed_unordered_id = uuid('a1b2c3d4', False)
ordered_id_without_version = uuid('', True, False)
ordered_id_with_checksum = uuid('', True, True, True)

const is_valid_v9 = is_uuidv9(ordered_id, true) # UUID v9 validator with checksum
const is_valid = is_uuid(ordered_id_without_version) # generic UUID validator

Command Line

python3 uuid_v9.py
python3 uuid_v9.py --prefix 'a1b2c3d4'
python3 uuid_v9.py --unordered
python3 uuid_v9.py --noversion
python3 uuid_v9.py --checksum

Note

Some UUID validators will not recognize v9 as a valid UUID even though it is. Three possible solutions are:

  1. Use the included validator (recommended)
  2. Bypass the validator (not recommended)
  3. Substitute the version digit for an earlier version that will pass (not recommended)

Here is the UUID v9 format: xxxxxxxx-xxxx-9xxx-xxxx-xxxxxxxxxxyy

x = prefix/timestamp/random 9 = version (optional) y = checksum (optional)

License

This project is licensed under the MIT License.

Metadata

Release files for uuid-v9 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uuid-v9 0.0.2
File Size Uploaded Provenance Actions
uuid-v9-0.0.2.tar.gz 4.4 kB Without provenance Details for uuid-v9-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uuid-v9 0.0.2
File Interpreter ABI Platform Actions
uuid_v9-0.0.2-py3-none-any.whl Python 3 none any Details for uuid_v9-0.0.2-py3-none-any.whl

Total release size: 8.5 kB

Release files / uuid-v9-0.0.2.tar.gz

Download URL uuid-v9-0.0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0a35ca0a3cfe078d007c8b822200df98df25d082db7fac41280a464d7c719d0e
BLAKE2b-256 checksum
How to use checksums
72000683c476a60c5f4f759b212a17ac8eb718d8b189c54d0f0e4f75c35cd170
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / uuid_v9-0.0.2-py3-none-any.whl

Download URL uuid_v9-0.0.2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35622e7f3f7cfba38164f97c1efe35f729267794c21daaf501ed6141ebd6b73f
BLAKE2b-256 checksum
How to use checksums
6a21c4b12e77a649a6af75d391e5e97574890c4a372e414f6301ce718a3211f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Security for uuid-v9 0.0.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page