Skip to main content

libuuid - Faster UUID generation using libuuid

A Python C extension for faster generation of UUID objects. It supports libuuid-based generation of version 1 and 4 UUIDs. The library is fully compatible with the standard uuid module, while also providing specialized, optimized, functions for generating UUID strings.

libuuid is roughly 8-10 times faster than the pure-python version.

It’s basically just a thin Cython wrapper around libuuid by Theo Tso.

This module has been forked from python-libuuid by Daniel Lundin. Daniel has not updated the module since 2010, and has not responded to pull requeststs or attempts to take over maintenance. The upstream module does not support Python 3.

Installation

You can install libuuid either via the Python Package Index (PyPI) or from source.

To install using pip:

$ pip install libuuid

To install using easy_install:

$ easy_install libuuid

If you have downloaded a source tarball you can install it by doing the following,:

$ python setup.py build
# python setup.py install # as root

Usage / Examples

The libuuid module provides a similar interface to uuid, resulting in fully compatible UUID objects. libuuid.UUID is also a subclass of uuid.UUID, so existing code using isinstance will continue to work.

>>> import libuuid
>>> libuuid.uuid1()
UUID('a3a32410-940a-11df-8ead-002219990fd7')
>>> libuuid.uuid4()
UUID('85651a1f-118f-480d-a116-526b2dd37322')

Furthermore, libuuid has a few extra utility functions not available in uuid. These are handy when you don’t need a “full” UUID object, but just need the byte representation. The _bytes functions have less overhead than the common interface.

>>> libuuid.uuid1_bytes()
'\x05f\xe1d\x94\x0b\x11\xdf\x8e\xad\x00"\x19\x99\x0f\xd7'
>>> libuuid.uuid4_bytes()
'\x05f\xe1d\x94\x0b\x11\xdf\x8e\xad\x00"\x19\x99\x0f\xd7'

Gotchas

  • libuuid only provides random (version 4) and time based (version 1) UUIDs.

  • Calling libuuid.uuid1 with node or clock_seq is not supported, and will silently fall back to the uuid.UUID implementation for compatibility.

  • Only tested on Linux. It should work on any platform, but e2fsprogs is probably just readily available on Linux distributions.

Bug tracker

If you have any suggestions, bug reports or annoyances please report using the Github issue tracker

Contributing

Development takes place at Github: http://github.com/brandond/python-libuuid/

Patches and contributions are more than welcome.

License

This software is licensed under the BSD software license. See the LICENSE file in the top distribution directory for full license text.

Metadata

Release files for libuuid 1.0.0

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

Source distribution (sdist)

Source distribution for libuuid 1.0.0
File Size Uploaded Provenance Actions
libuuid-1.0.0.tar.gz 39.3 kB Without provenance Details for libuuid-1.0.0.tar.gz

Release files / libuuid-1.0.0.tar.gz

Download URL libuuid-1.0.0.tar.gz
Size 39.3 kB
Tags Source
SHA-256 checksum
How to use checksums
267e00c1246b341a630b72483af26a1fc2fa1952717759cd10f2177e2344239e
BLAKE2b-256 checksum
How to use checksums
944cad07bf7e0a62c9b14e0d4dd908218152affc57062cf8c6766a90542fedc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7+

Security for libuuid 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

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