All Projects → mdomke → python-ulid

mdomke / python-ulid

Licence: MIT license
ULID implementation for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-ulid

ulid-creator
A Java library for generating Universally Unique Lexicographically Sortable Identifiers (ULID)
Stars: ✭ 38 (-78.53%)
Mutual labels:  uuid, ulid, unique-id
ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Crystal
Stars: ✭ 28 (-84.18%)
Mutual labels:  uuid, ulid
friendly-id
Java Friendly Id for UUID
Stars: ✭ 173 (-2.26%)
Mutual labels:  uuid, unique-id
uuid-generator-plugin
An IntelliJ Idea plugin to generate UUID (Universally Unique Identifier), ULID (Universally Unique Lexicographically Sortable Identifier) and CUID (Collision Resistant Unique Identifier)
Stars: ✭ 30 (-83.05%)
Mutual labels:  uuid, ulid
tsid-creator
A Java library for generating Time Sortable Identifiers (TSID).
Stars: ✭ 16 (-90.96%)
Mutual labels:  ulid, unique-id
sno
Compact, sortable and fast unique IDs with embedded metadata.
Stars: ✭ 77 (-56.5%)
Mutual labels:  uuid, unique-id
ulid
Haskell implementation of ULIDs (Unique Lexicographically Sortable Identifiers)
Stars: ✭ 22 (-87.57%)
Mutual labels:  uuid, ulid
go-ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Go - Please use https://github.com/oklog/ulid
Stars: ✭ 31 (-82.49%)
Mutual labels:  uuid, ulid
rulid.rs
Rust Universally Unique Lexicographically Sortable Identifier
Stars: ✭ 40 (-77.4%)
Mutual labels:  uuid, ulid
fuuid
Functional UUIDs for Python.
Stars: ✭ 145 (-18.08%)
Mutual labels:  uuid, unique-id
Ksuid
K-Sortable Globally Unique IDs
Stars: ✭ 3,202 (+1709.04%)
Mutual labels:  uuid, unique-id
Butterfly
分布式ID生成器框架:超高性能的发号器框架。通过引入多种新的方案,彻底解决雪花算法的时间回拨等问题,并将雪花算法原生QPS提高最少十几~二十倍
Stars: ✭ 111 (-37.29%)
Mutual labels:  uuid, unique-id
Javascript
Universally Unique Lexicographically Sortable Identifier
Stars: ✭ 1,781 (+906.21%)
Mutual labels:  uuid, ulid
Zkudid
Generate and save permanent UDID with IDFV and keychain in iOS device.
Stars: ✭ 159 (-10.17%)
Mutual labels:  uuid
Python Wechat Itchat
微信机器人,基于Python itchat接口功能实例展示:01-itchat获取微信好友或者微信群分享文章、02-itchat获取微信公众号文章、03-itchat监听微信公众号发送的文章、04 itchat监听微信群或好友撤回的消息、05 itchat获得微信好友信息以及表图对比、06 python打印出微信被删除好友、07 itchat自动回复好友、08 itchat微信好友个性签名词云图、09 itchat微信好友性别比例、10 微信群或微信好友撤回消息拦截、11 itchat微信群或好友之间转发消息
Stars: ✭ 216 (+22.03%)
Mutual labels:  uuid
Uuid
Kotlin Multiplatform UUID
Stars: ✭ 146 (-17.51%)
Mutual labels:  uuid
Uuid
A PHP library for generating universally unique identifiers (UUIDs).
Stars: ✭ 11,475 (+6383.05%)
Mutual labels:  uuid
Ulid
Universally Unique Lexicographically Sortable Identifier implementation for Ruby
Stars: ✭ 253 (+42.94%)
Mutual labels:  uuid
Uuid
Erlang Native UUID Generation
Stars: ✭ 188 (+6.21%)
Mutual labels:  uuid
Laravel Uuid
Laravel package to generate and to validate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.
Stars: ✭ 1,717 (+870.06%)
Mutual labels:  uuid


ulid


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.

Installation

Use pip to install the library

$ pip install python-ulid

Basic Usage

Create a new ULID object from the current timestamp

>>> from ulid import ULID
>>> ULID()
ULID(01E75HZVW36EAZKMF1W7XNMSB4)

or use one of the named constructors

>>> import time, datetime
>>> ULID.from_timestamp(time.time())
ULID(01E75J1MKKWMGG0N5MBHFMRC84)
>>> ULID.from_datetime(datetime.datetime.now())
ULID(01E75J2XBK390V2XRH44EHC10X)

There are several options for encoding the ULID object (e.g. string, hex, int), as well as to access the timestamp attribute in different formats:

>>> str(ulid)
'01BTGNYV6HRNK8K8VKZASZCFPE'
>>> ulid.hex
'015ea15f6cd1c56689a373fab3f63ece'
>>> ulid.timestamp
1505945939.153
>>> ulid.datetime
datetime.datetime(2017, 9, 20, 22, 18, 59, 153000, tzinfo=datetime.timezone.utc)
>>> ulid.to_uuid()
UUID('015ea15f-6cd1-c566-89a3-73fab3f63ece')

Other implementations

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].