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 C++ implementation from https://github.com/suyash/ulid when the C extension 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 C++ 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-2.0.1.tar.gz (14.5 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-2.0.1-cp314-cp314-manylinux_2_41_x86_64.whl (14.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.41+ x86-64

File details

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

File metadata

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

File hashes

Hashes for ulid_transform-2.0.1.tar.gz
Algorithm Hash digest
SHA256 8814e7407635da3f57b371178260e16422f4c0d92915586ef6e4d2a5a8ac96d3
MD5 8be499edc05d3621aecebac1c2dfabae
BLAKE2b-256 8f797e85e04a611e1a96361203b5479ad008c9c5b848100b07d09f4eb94fe7f0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ulid_transform-2.0.1-cp314-cp314-manylinux_2_41_x86_64.whl
Algorithm Hash digest
SHA256 cfadd25c94f45a8844c56ecd61bb2d0db1302b4dda73a14b553bb436bb2e5ed8
MD5 c503fb16b52250444e57a76503ce7d2d
BLAKE2b-256 e384066e76ac522cc47e80a614a1da6fea4626aeb1054d177013d6bc21945534

See more details on using hashes here.

Provenance

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