skillfed

ulid-py

Universally Unique Lexicographically Sortable Identifier

ulid-py v1.1.0 1.9M downloads/30d#3,491 on PyPI739
Permissive license Apache 2.0 Abandoned released

What it is and what it does

ulid-py is a pure-Python implementation of the ULID specification, providing a 128-bit identifier format that combines a 48-bit millisecond-precision timestamp with 80 bits of cryptographic randomness. Unlike UUIDs, ULIDs are lexicographically sortable as strings, making them efficient for database indexing and time-ordered queries. The library generates new ULIDs with timestamp and randomness from standard library sources (time.time() and os.urandom()), and supports creating ULIDs from existing values including UUIDs, timestamps, and raw randomness.

The package provides a MemoryView base class that allows ULIDs, timestamps, and randomness values to be represented in multiple formats (string, bytes, hex, int, binary, octal) and compared lexicographically. It handles type conversion automatically through a parse() method when the input type is unknown. The implementation is designed for fast, pure-Python operation without external dependencies, making it suitable for applications that need sortable, distributed identifiers without database coordination.

Use it for:

  • Generate sortable unique IDs for database records that maintain insertion order without requiring a central sequence
  • Replace UUIDs in systems where lexicographic ordering and string efficiency matter, such as URL slugs or API keys
  • Create time-ordered event IDs in distributed systems where multiple services generate identifiers independently
  • Convert existing UUIDs or timestamps to ULID format for compatibility with systems expecting sortable identifiers
  • Extract timestamp information from existing ULID values for time-based queries or analytics

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates and parses ULIDs (Universally Unique Lexicographically Sortable Identifiers), which are 128-bit identifiers that combine a millisecond-precision timestamp with cryptographic randomness, sortable as strings.

Yes, with conditions. The package is stable and production-ready for generating sortable identifiers, with no known vulnerabilities and low install friction. However, it is abandoned (last update September 2020) and may lack support for newer Python versions beyond 3.8. Install it if you need ULID functionality and can accept a dependency that will not receive updates; consider alternatives if you require active maintenance or support for Python 3.9+.

Install

ulid-py on PyPI

pip

pip install ulid-py

uv

uv add ulid-py

poetry

poetry add ulid-py

Installing ulid-py

Before you install

Installation is straightforward with no runtime dependencies. The project is marked abandoned with last commit in March 2023, though it remains stable and has accumulated 739 repository stars.

License in practice

Licensed under Apache 2.0 (permissive), allowing use in both open-source and proprietary projects with minimal restrictions.

Quickstart

pip install ulid-py

import ulid

# Generate a new ULID
u = ulid.new()
print(u)  # <ULID('01BJQE4QTHMFP0S5J153XCFSP9')>

# Parse from various types
u2 = ulid.parse('01BJQE4QTHMFP0S5J153XCFSP9')

# Extract timestamp and randomness
ts = u.timestamp()
rand = u.randomness()

Verify before relying

  • Whether the abandoned status and lack of updates since 2020 affects compatibility with current Python 3.9+ releases
  • Performance characteristics compared to other ULID or UUID libraries in production workloads

Package facts

License Apache 2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,159 days since the last release
Last repo commit
First released
Downloads 1,853,145/month — #3,491 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ulid_py-1.1.0-py2.py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Software Development :: Libraries :: Python Modules

Tags

unique sortable identifier generationULID implementation pythonlexicographically sortable IDstimestamp-based unique IDUUID alternativebase32 encoded identifiersdistributed ID generation
identifier-generationsortable-idsdistributed-systems

More Python Modules packages