Skip to main content

Create and transform ULIDs

Project description

Fast ULID transformations

CI Status Test coverage percentage

Poetry black pre-commit CodSpeed Badge

PyPI Version Supported Python versions License

Create and transform ULIDs

This library will use the CPP implementation from https://github.com/suyash/ulid if cython is available, and will fallback to pure python if it is not.

Example

>>> import ulid_transform
>>> ulid_transform.ulid_hex()
'01869a2ea5fb0b43aa056293e47c0a35'
>>> ulid_transform.ulid_now()
'0001HZX0NW00GW0X476W5TVBFE'
>>> ulid_transform.ulid_at_time(1234)
'000000016JC62D620DGYNG2R8H'
>>> ulid_transform.ulid_to_bytes('0001HZX0NW00GW0X476W5TVBFE')
b'\x00\x00c\xfe\x82\xbc\x00!\xc0t\x877\x0b\xad\xad\xee'
>> ulid_transform.bytes_to_ulid(b"\x01\x86\x99?\xe8\xf3\x11\xbc\xed\xef\x86U.9\x03z")
'01GTCKZT7K26YEVVW6AMQ3J0VT'
>>> ulid_transform.ulid_to_bytes_or_none('0001HZX0NW00GW0X476W5TVBFE')
b'\x00\x00c\xfe\x82\xbc\x00!\xc0t\x877\x0b\xad\xad\xee'
>>> ulid_transform.ulid_to_bytes_or_none(None)
>>> ulid_transform.bytes_to_ulid_or_none(b'\x00\x00c\xfe\x82\xbc\x00!\xc0t\x877\x0b\xad\xad\xee')
'0001HZX0NW00GW0X476W5TVBFE'
>>> ulid_transform.bytes_to_ulid_or_none(None)

Installation

Install this via pip (or your favourite package manager):

pip install ulid-transform

Contributors ✨

Thanks to https://github.com/suyash/ulid which provides the cython implementation guts.

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This package was created with Copier and the browniebroke/pypackage-template project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ulid_transform-1.5.3.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ulid_transform-1.5.3-cp313-cp313-manylinux_2_36_x86_64.whl (48.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.36+ x86-64

File details

Details for the file ulid_transform-1.5.3.tar.gz.

File metadata

  • Download URL: ulid_transform-1.5.3.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ulid_transform-1.5.3.tar.gz
Algorithm Hash digest
SHA256 d716dc6cfbb04f6c10a9a3f0b37d5e8b0dbff89fa1c267faa61dc43dede7c652
MD5 47a8c5d739179a1a45a0fbff4ae36140
BLAKE2b-256 4fed5520f40748f1cafe08b2ece4b30273481c7ae2871ecfb79cff1bb61825c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ulid_transform-1.5.3.tar.gz:

Publisher: ci.yml on Bluetooth-Devices/ulid-transform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ulid_transform-1.5.3-cp313-cp313-manylinux_2_36_x86_64.whl.

File metadata

File hashes

Hashes for ulid_transform-1.5.3-cp313-cp313-manylinux_2_36_x86_64.whl
Algorithm Hash digest
SHA256 fc7d739cd174c7b989f9c8f774ca69eb6e5ea668eaccf846e07bd990e76b0821
MD5 c3a9d4a2906afcfc80a0f764bdd04415
BLAKE2b-256 d40102a33a0ce481fe3ff38b301b903b0aeb405b30601229fa9c580fbf7b25d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ulid_transform-1.5.3-cp313-cp313-manylinux_2_36_x86_64.whl:

Publisher: ci.yml on Bluetooth-Devices/ulid-transform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page