Skip to main content
https://img.shields.io/pypi/v/python-ulid.svg?style=flat-square https://img.shields.io/travis/mdomke/python-ulid/master.svg?style=flat-square https://img.shields.io/pypi/l/python-ulid.svg?style=flat-square https://img.shields.io/codecov/c/github/mdomke/python-ulid.svg?style=flat-square

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:

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

For more information have a look at the original specification.

Basic Usage

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

Installation

$ pip install python-ulid

Other implementations

Release files for python-ulid 0.2.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 python-ulid 0.2.0
File Size Uploaded
python-ulid-0.2.0.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-ulid 0.2.0
File Interpreter ABI Platform
python_ulid-0.2.0-py2-none-any.whl Python 2 none any Details

Total release size: 16.6 kB

Release files / python-ulid-0.2.0.tar.gz

Download URL python-ulid-0.2.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8d3ffa2d2f250648293ad904b98d25776bd2a77ffc957c01f23f3e6cd011b2f8
BLAKE2b-256 checksum
How to use checksums
5c9d3c2e8e74e0382dcd858ea106b434989604e8dfe1c4667f4a27f80c97c288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / python_ulid-0.2.0-py2-none-any.whl

Download URL python_ulid-0.2.0-py2-none-any.whl
Size 7.6 kB
Tags Python 2
SHA-256 checksum
How to use checksums
f2bea3f19bea6a90138cf7d27a15066c669b3d2e6a4da7e16591a42e907acfd4
BLAKE2b-256 checksum
How to use checksums
91afb150840fdfd234ec67a3a6d027e0e68e6317789fa599a28775fafb00c108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

4.0.1

2 release files

4.0.0

2 release files

3.2.1

2 release files

3.2.0

1 release file

3.1.0

2 release files

3.0.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.0

2 release files

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.0.0

1 release file

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