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.4.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.4-cp314-cp314-manylinux_2_41_x86_64.whl (14.9 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.41+ x86-64

File details

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

File metadata

  • Download URL: ulid_transform-1.5.4.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.4.tar.gz
Algorithm Hash digest
SHA256 3383199c97918ed1516d80a58b62f229604e9eab83026f0534b7b8f64845496b
MD5 92f2378c0d7b2de00423989f8a28cf3d
BLAKE2b-256 bd655d20f885a7d22f3a4434f06339e310602f119434a481af19886b3e8830f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ulid_transform-1.5.4.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.4-cp314-cp314-manylinux_2_41_x86_64.whl.

File metadata

File hashes

Hashes for ulid_transform-1.5.4-cp314-cp314-manylinux_2_41_x86_64.whl
Algorithm Hash digest
SHA256 e97e391c90c86f612301766ebbc5753bfc5f0c9b73873fc58982ab2ab875b0ed
MD5 7f64b44126f7fa6cb08c0e6b6ade673e
BLAKE2b-256 6baa4394e5fa4f7f7a0b96a8ad89d378f295ded7c2885b0b5bf6cba8b15eef19

See more details on using hashes here.

Provenance

The following attestation bundles were made for ulid_transform-1.5.4-cp314-cp314-manylinux_2_41_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