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.0.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.0-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.0.tar.gz.

File metadata

  • Download URL: ulid_transform-2.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 58c4b30d940d09ff82441c5a58cff36150396965a303a40dae57762c06121ec9
MD5 8f195a7196cc05b1340ddbf47bffce80
BLAKE2b-256 e240aff60c75e4a5ade0682b53fd568ea9a1fce7d5c60f9f76ad2ac61c370417

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ulid_transform-2.0.0-cp314-cp314-manylinux_2_41_x86_64.whl
Algorithm Hash digest
SHA256 08414d30c3d64cf0b237a839db2d9a35cec2c82469940f64b48ea0bf9e8feafd
MD5 e53fd4a3298561dbf591d60ced44b064
BLAKE2b-256 8a0b3d985d7a54499e595a9a66ac48487f31b6cc265442b5e955e6089439dc59

See more details on using hashes here.

Provenance

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