Registry / serialization / ulid
library1.1pypypi✓ verified 86d ago

ULID (Universally Unique Lexicographically Sortable Identifier) library for Python. Provides encoding and decoding of ULID strings from timestamps and random components. Current version: 1.1, with infrequent releases.

pip install ulid
INSTALL
IMPORT
SIG · ULID
U
ulid
serializationpythonv1.1
Install
2.4s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ulid
import ulid
from ulid import ULID
The main module is 'ulid', not 'ULID'. Use import ulid then ulid.new()

Generates a new ULID, decodes it, and creates one from a timestamp.

import ulid import time ulid_str = ulid.new() print(f"Generated ULID: {ulid_str}") # Decode a ULID timestamp_ms, random_part = ulid.decode(ulid_str) print(f"Timestamp (ms): {timestamp_ms}, Random: {random_part}") # Create ULID from specific timestamp (in milliseconds) ts = int(time.time() * 1000) ulid_from_ts = ulid.from_timestamp(ts) print(f"ULID from timestamp: {ulid_from_ts}")
Debug
Known issues
gotchaThe library is not actively maintained (last release 2019). May have unhandled edge cases and compatibility issues with Python 3.10+.
fix
Consider alternative libraries like python-ulid or ulid-py for active maintenance.
affects: all
gotchaulid.new() returns a string, not a ULID object. No built-in ULID class or object representation.
fix
Work directly with the string output from ulid.new().
affects: all
gotchaulid.decode() expects a string, but returns a tuple (timestamp_ms, random_bits). The random part is an integer, not bytes or a dedicated object.
fix
Handle the integer random bits; convert to hex or bytes if needed.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'ULID' from 'ulid'
Incorrect import: trying to import 'ULID' as a class, but ulid module is function-based.
fix
Use 'import ulid' then call ulid.new() etc.
AttributeError: module 'ulid' has no attribute 'new'
Outdated version or incorrect installation. Also possible if the module name conflicts with another library.
fix
Reinstall with 'pip install ulid==1.1' and ensure no other ulid module in PYTHONPATH.
Upgrade
Version history
1.1latest on PyPI · released Aug 1, 2016
Audit
Dependencies

No dependency data recorded yet.

Agent activity
37 hits · last 30 days
node
30
Meta
2
Amazon
1
OpenAI (training)
1
Resources
ulid — pip install ulid · libregistry