Add uuid7 function #9
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UUIDv7 is now final (https://datatracker.ietf.org/doc/html/rfc9562, published May 2024), since it's been finalised very recently it's not yet available in Python (python/cpython#89083).
I've looked PyPI and found https://github.com/oittaa/uuid6-python to be the most trustworthy implementation that could be used as a dependency. However, I decided to "vendor" the implementation that is proposed to be included in CPython (python/cpython#120650).
This PR is very recent (2024-06-17T15:42:35Z) and has been updated even more recently (2024-06-19T07:39:18Z).
I've only taken the code that generates UUID v7 and slightly modified it so it works in our Python version, and doesn't violate our lint checks.
I've verified that the UUID generated is valid using https://uuid7.com/.