Skip to main content

Universally Unique Lexicographically Sortable Identifier

Project description

.. image::
.. image::
.. image::
.. image::

What is this?

This is a port of the original JavaScript ULID_ implementation to Python.

A ULID is a *universally unique lexicographically sortable identifier*. It is

- 128-bit compatible with UUID
- 1.21e+24 unique ULIDs per millisecond
- Lexicographically sortable!
- Canonically encoded as a 26 character string, as opposed to the 36 character UUID
- Uses Crockford's base32 for better efficiency and readability (5 bits per character)
- Case insensitive
- No special characters (URL safe)

In general the structure of a ULID is as follows:

.. code-block:: txt

01AN4Z07BY 79KA1307SR9X4MV3
|----------| |----------------|
Timestamp Randomness
48bits 80bits

For more information have a look at the original specification_.

Basic Usage

.. code-block:: python

>>> from ulid import ULID
>>> ulid =
>>> ulid.str
>>> ulid.timestamp
>>> ulid.datetime
datetime.datetime(2017, 9, 20, 22, 18, 59, 153000)


.. code-block:: bash

$ pip install python-ulid

Other implementations

- `ahawker/ulid <>`_
- `valohai/ulid2 <>`_
- `mdipierro/ulid <>`_

.. _ULID:
.. _specification:

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
python_ulid-0.2.0-py2-none-any.whl (7.6 kB) Copy SHA256 hash SHA256 Wheel py2
python-ulid-0.2.0.tar.gz (9.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page