Skip to main content

Drop-in replacement for Python UUID in Rust

Project description

Python UUID Utils

Package version Supported Python versions


Python UUID implementation using Rust's UUID library. This will make uuid4 function around 10x faster.

This package can be a drop-in replacement to the standard library UUID which implements existing UUID versions like V4 in Rust and also adds draft UUID versions like V6.

Avaialble UUID versions:

  • uuid1 - Version 1 UUIDs using a timestamp and monotonic counter.
  • uuid3 - Version 3 UUIDs based on the MD5 hash of some data.
  • uuid4 - Version 4 UUIDs with random data.
  • uuid5 - Version 5 UUIDs based on the SHA1 hash of some data.
  • uuid6 - Version 6 UUIDs using a timestamp and monotonic counter.
  • uuid7 - Version 7 UUIDs using a Unix timestamp ordered by time.
  • uuid8 - Version 8 UUIDs using user-defined data.

Please note that UUID versions 6, 7 and 8 are still in draft RFC.

Installation

$ pip install uuid-utils

Example

>>> import uuid_utils as uuid

>>> # make a random UUID
>>> uuid.uuid4()
UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')

>>> # make a random UUID using a Unix timestamp which is time-ordered.
>>> uuid.uuid7()
UUID('16ada4b8-b7b1-4e6c-b857-012bc678552b')

>>> # make a UUID using a SHA-1 hash of a namespace UUID and a name
>>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')

>>> # make a UUID using an MD5 hash of a namespace UUID and a name
>>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')

Benchmarks

Benchmark Min Max Mean Min (+) Max (+) Mean (+)
UUID V1 0.058 0.059 0.058 0.005 (12.0x) 0.005 (11.9x) 0.005 (12.0x)
UUID V4 0.041 0.041 0.041 0.004 (11.1x) 0.004 (10.8x) 0.004 (10.9x)
UUID V5 0.064 0.066 0.065 0.008 (8.1x) 0.008 (8.1x) 0.008 (8.1x)
UUID from hex 0.024 0.025 0.024 0.004 (6.7x) 0.004 (6.6x) 0.004 (6.6x)
UUID from bytes 0.024 0.025 0.024 0.004 (6.7x) 0.004 (6.6x) 0.004 (6.7x)
UUID from int 0.024 0.025 0.024 0.004 (6.6x) 0.004 (6.7x) 0.004 (6.6x)

Limitations

  • The getnode function is not available.
  • The uuid1 and uuid6 take node argument as mandatory.
  • The uuid3 function is not available.

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_utils-0.2.0.tar.gz (14.8 kB view hashes)

Uploaded Source

Built Distributions

uuid_utils-0.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

uuid_utils-0.2.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.5+ i686

uuid_utils-0.2.0-pp39-pypy39_pp73-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (579.7 kB view hashes)

Uploaded PyPy macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

uuid_utils-0.2.0-pp39-pypy39_pp73-macosx_10_7_x86_64.whl (295.3 kB view hashes)

Uploaded PyPy macOS 10.7+ x86-64

uuid_utils-0.2.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

uuid_utils-0.2.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.5+ i686

uuid_utils-0.2.0-pp38-pypy38_pp73-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (579.7 kB view hashes)

Uploaded PyPy macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

uuid_utils-0.2.0-pp38-pypy38_pp73-macosx_10_7_x86_64.whl (295.2 kB view hashes)

Uploaded PyPy macOS 10.7+ x86-64

uuid_utils-0.2.0-cp311-none-win_amd64.whl (159.7 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

uuid_utils-0.2.0-cp311-none-win32.whl (155.6 kB view hashes)

Uploaded CPython 3.11 Windows x86

uuid_utils-0.2.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

uuid_utils-0.2.0-cp311-cp311-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

uuid_utils-0.2.0-cp311-cp311-musllinux_1_2_armv7l.whl (1.4 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ ARMv7l

uuid_utils-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

uuid_utils-0.2.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.5+ i686

uuid_utils-0.2.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (578.0 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

uuid_utils-0.2.0-cp311-cp311-macosx_10_7_x86_64.whl (294.6 kB view hashes)

Uploaded CPython 3.11 macOS 10.7+ x86-64

uuid_utils-0.2.0-cp310-none-win_amd64.whl (159.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

uuid_utils-0.2.0-cp310-none-win32.whl (155.6 kB view hashes)

Uploaded CPython 3.10 Windows x86

uuid_utils-0.2.0-cp310-cp310-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

uuid_utils-0.2.0-cp310-cp310-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

uuid_utils-0.2.0-cp310-cp310-musllinux_1_2_armv7l.whl (1.4 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ ARMv7l

uuid_utils-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

uuid_utils-0.2.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.5+ i686

uuid_utils-0.2.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (578.0 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

uuid_utils-0.2.0-cp310-cp310-macosx_10_7_x86_64.whl (294.6 kB view hashes)

Uploaded CPython 3.10 macOS 10.7+ x86-64

uuid_utils-0.2.0-cp39-none-win_amd64.whl (160.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

uuid_utils-0.2.0-cp39-none-win32.whl (155.8 kB view hashes)

Uploaded CPython 3.9 Windows x86

uuid_utils-0.2.0-cp39-cp39-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

uuid_utils-0.2.0-cp39-cp39-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ i686

uuid_utils-0.2.0-cp39-cp39-musllinux_1_2_armv7l.whl (1.4 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ ARMv7l

uuid_utils-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

uuid_utils-0.2.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.5+ i686

uuid_utils-0.2.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (578.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

uuid_utils-0.2.0-cp39-cp39-macosx_10_7_x86_64.whl (294.9 kB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

uuid_utils-0.2.0-cp38-none-win_amd64.whl (160.0 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

uuid_utils-0.2.0-cp38-none-win32.whl (155.7 kB view hashes)

Uploaded CPython 3.8 Windows x86

uuid_utils-0.2.0-cp38-cp38-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

uuid_utils-0.2.0-cp38-cp38-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ i686

uuid_utils-0.2.0-cp38-cp38-musllinux_1_2_armv7l.whl (1.4 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ ARMv7l

uuid_utils-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

uuid_utils-0.2.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.5+ i686

uuid_utils-0.2.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (579.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

uuid_utils-0.2.0-cp38-cp38-macosx_10_7_x86_64.whl (295.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

uuid_utils-0.2.0-cp37-none-win_amd64.whl (160.0 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

uuid_utils-0.2.0-cp37-none-win32.whl (155.7 kB view hashes)

Uploaded CPython 3.7 Windows x86

uuid_utils-0.2.0-cp37-cp37m-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.2+ x86-64

uuid_utils-0.2.0-cp37-cp37m-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.2+ i686

uuid_utils-0.2.0-cp37-cp37m-musllinux_1_2_armv7l.whl (1.4 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.2+ ARMv7l

uuid_utils-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

uuid_utils-0.2.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.5+ i686

uuid_utils-0.2.0-cp37-cp37m-macosx_10_7_x86_64.whl (295.1 kB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

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