Skip to main content

The v9 UUID supports both time-based sequential and random non-sequential IDs with an optional prefix, an optional checksum, and sufficient randomness to avoid collisions.

Project description

UUID v9

The v9 UUID supports both time-based sequential and random non-sequential IDs with an optional prefix, 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

Compatibility

Some UUID validators will not accept some v9 UUIDs. Three possible workarounds are:

  1. Use the built-in validator (recommended)
  2. Use compatibility mode*
  3. Bypass the validator (not recommended)

*Compatibility mode adds version and variant digits to immitate v1 or v4 UUIDs based on whether or not you have a timestamp.

Format

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

x = prefix/timestamp/random, y = checksum (optional), 9 = version (optional), 8 = variant (compatibility mode)

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uuid-v9-0.0.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

uuid_v9-0.0.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file uuid-v9-0.0.3.tar.gz.

File metadata

  • Download URL: uuid-v9-0.0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for uuid-v9-0.0.3.tar.gz
Algorithm Hash digest
SHA256 95bbe16f46007a31faf99a966ace22ceaaef599ed88a5bb1f3d34fb9bf404032
MD5 72fcef1bcc62b5259bf1f3d4e655a1ad
BLAKE2b-256 0f234a0bf8032f64577ecb99a03072c5b69d6f2af0c55a706ed852737e7205c3

See more details on using hashes here.

File details

Details for the file uuid_v9-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: uuid_v9-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for uuid_v9-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62084baf210248f99551eaaa29f2c9bd9dfb086f2a8a6b162fc3019285fe9674
MD5 cadcd8a4596a2deb645aa4684eb89dd5
BLAKE2b-256 04c331c92751fd7db4fc2f60fcc4542e496a9f8f96d7037b6d0ea9ab1b3914cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page