{"id":22511,"library":"ulid","title":"ulid","description":"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.","status":"active","version":"1.1","language":"python","source_language":"en","source_url":"https://github.com/mdipierro/ulid","tags":["ulid","uuid","identifier","lexicographic","sortable"],"install":[{"cmd":"pip install ulid","lang":"bash","label":"PyPI install"}],"dependencies":[],"imports":[{"note":"The main module is 'ulid', not 'ULID'. Use import ulid then ulid.new()","wrong":"from ulid import ULID","symbol":"ulid","correct":"import ulid"}],"quickstart":{"code":"import ulid\nimport time\n\nulid_str = ulid.new()\nprint(f\"Generated ULID: {ulid_str}\")\n\n# Decode a ULID\ntimestamp_ms, random_part = ulid.decode(ulid_str)\nprint(f\"Timestamp (ms): {timestamp_ms}, Random: {random_part}\")\n\n# Create ULID from specific timestamp (in milliseconds)\nts = int(time.time() * 1000)\nulid_from_ts = ulid.from_timestamp(ts)\nprint(f\"ULID from timestamp: {ulid_from_ts}\")","lang":"python","description":"Generates a new ULID, decodes it, and creates one from a timestamp."},"warnings":[{"fix":"Consider alternative libraries like python-ulid or ulid-py for active maintenance.","message":"The library is not actively maintained (last release 2019). May have unhandled edge cases and compatibility issues with Python 3.10+.","severity":"gotcha","affected_versions":"all"},{"fix":"Work directly with the string output from ulid.new().","message":"ulid.new() returns a string, not a ULID object. No built-in ULID class or object representation.","severity":"gotcha","affected_versions":"all"},{"fix":"Handle the integer random bits; convert to hex or bytes if needed.","message":"ulid.decode() expects a string, but returns a tuple (timestamp_ms, random_bits). The random part is an integer, not bytes or a dedicated object.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'import ulid' then call ulid.new() etc.","cause":"Incorrect import: trying to import 'ULID' as a class, but ulid module is function-based.","error":"ImportError: cannot import name 'ULID' from 'ulid'"},{"fix":"Reinstall with 'pip install ulid==1.1' and ensure no other ulid module in PYTHONPATH.","cause":"Outdated version or incorrect installation. Also possible if the module name conflicts with another library.","error":"AttributeError: module 'ulid' has no attribute 'new'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}