python-ulid
python-ulid copied to clipboard
monotonic entropy for ULIDs created in the same ms?
ULID spec now calls out entropy monotonicity for subsequent ULIDs generated in the same millisecond. It wasn't immediately clear to me how to approach that here, but I spent a few minutes looking at it. Seems like an API change might be required, or globals like I wound up trying for ulid2.
Bit of discussion at ahawker/ulid#306.
Just found myself needing this exact feature - I want ULIDs created within the same ms to still sort after each other.
Looks like https://github.com/itsrainingmani/py-ulid has a version of this: https://github.com/itsrainingmani/py-ulid/blob/bd63902a1297d32b0a264601e20400a8ce20e926/ulid/ulid.py#L202-L268
Here's the official spec for how this should work: https://github.com/ulid/spec/blob/master/README.md#monotonicity
@mdomke can you please add support for this feature, itsrainingmani/py-ulid and ahawker/ulid already do, but personally I prefer your package since it's compatible with pydantic out of the box.
Interesting that there still seems to be interest after no reaction for 6 years... But at least some new contributions have been merged, so maybe not all hope is lost if someone else wants to risk doing this work in vain.
But at least some new contributions have been merged, so maybe not all hope is lost if someone else wants to risk doing this work in vain.
@reneleonhardt I'm not sure if I understand your concern. This library has seen steady development over the years, with many contributions merged successfully. As an open source project, I welcome contributions from anyone interested in this feature - and I'm happy to work with contributors to ensure their efforts aren't in vain. I can also try to find some time to implement this myself, but it hasn't been a priority so far.
It's a good sign that some contributions have been merged, what I meant is that this literally is the feature request number 1 and no one knew for six years if such a contribution would be allowed, thank you for reacting 👍
@reneleonhardt I'm a bit puzzled: Why would a contribution not be allowed? So far, every pull-request has been eventually accepted, but in this case nobody offered to contribute, and I didn't find the time to work on it myself.
This being said, I have implemented the requested functionality in 3.1.0
You can never know in advance how maintainers react to contributions, I'm glad that this project embraces them!
Thank you for implementing it 🚀
This being said, I have implemented the requested functionality in
3.1.0
Thank you so much, I've tested it and it works to perfection.