Skip to main content

C Extension for faster UUID generation using libuuid.

Project description

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.


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 build
# python 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()
>>> libuuid.uuid4()

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()
>>> libuuid.uuid4_bytes()


  • 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


Development takes place at Github:

Patches and contributions are more than welcome.


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

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

libuuid-1.0.0.tar.gz (39.3 kB view hashes)

Uploaded source

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