GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Bluetooth-Devices/ulid-transform: Create and transform ULIDs

BranchesTags
Open more actions menu

Latest commit

 

History

267 Commits
267 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bench
bench
 
 
src/ulid_transform
src/ulid_transform
 
 
tests
tests
 
 
.all-contributorsrc
.all-contributorsrc
 
 
.copier-answers.yml
.copier-answers.yml
 
 
.editorconfig
.editorconfig
 
 
.git-blame-ignore-revs
.git-blame-ignore-revs
 
 
.gitignore
.gitignore
 
 
.gitpod.yml
.gitpod.yml
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build_ext.py
build_ext.py
 
 
commitlint.config.mjs
commitlint.config.mjs
 
 
poetry.lock
poetry.lock
 
 
pyproject.toml
pyproject.toml
 
 
renovate.json
renovate.json
 
 
uv.lock
uv.lock
 
 

Repository files navigation

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_now_bytes()
b'\x01\x9eS\x9d\x1bhl~\x1e\xf7\x959\xe1\xf2\xbe\xea'
>>> ulid_transform.ulid_at_time(1234)
'000000016JC62D620DGYNG2R8H'
>>> ulid_transform.ulid_at_time_bytes(1234)
b'\x00\x00\x00\x12\xd4Pq+\x1eG?\x91\xe9+|\xbd'
>>> 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_timestamp('0001HZX0NW00GW0X476W5TVBFE')  # milliseconds since the epoch
1677623996
>>> ulid_transform.ulid_to_timestamp(b'\x00\x00c\xfe\x82\xbc\x00!\xc0t\x877\x0b\xad\xad\xee')  # also accepts bytes
1677623996
>>> 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.

About

Create and transform ULIDs

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

11 stars

Watchers

2 watching

Forks

4 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.