ulid-py
Universally Unique Lexicographically Sortable Identifier
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-pyuv
uv add ulid-pypoetry
poetry add ulid-pyInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
python-ulidGenerates and manipulates ULIDs (universally…
permissive · top 5,000 on PyPI
snowflake-idGenerates and parses Snowflake IDs, distributed…
permissive · top 15,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
timeflakeGenerates 128-bit, time-ordered, URL-safe…
permissive · top 15,000 on PyPI
uuidProvides UUID object creation and RFC…
unclear · top 5,000 on PyPI
typeid-pythonGenerates and parses TypeIDs—type-safe,…
permissive · top 15,000 on PyPI
ulid-transformGenerate and convert ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
cyksuidGenerates and parses KSUIDs (K-Sortable…
permissive · top 15,000 on PyPI
py-deviceidGenerates or retrieves a unique device…
permissive · top 5,000 on PyPI
pksuidGenerates prefixed, k-sortable unique…
permissive · top 15,000 on PyPI