flakemaker
The flakemaker library offers a straightforward approach to generating unique, time-based identifiers similar to Discord's snowflake IDs, but repurposing the worker and process IDs into a generalized "parameter".
Features
- Generates 64-bit snowflake IDs.
- Customizable epoch.
- Includes a user-defined parameter at snowflake generation. Note that this replaces the worker and process ids!
Quickstart
Generating a Snowflake
To generate a snowflake, create an instance of SnowflakeGenerator and call the generate method with your parameter.
from flakemaker import SnowflakeGenerator
generator = SnowflakeGenerator() # you can put a time here in milliseconds since 1970
snowflake = generator.generate(42) # or any value from 0-1023
print(f"Generated snowflake: {snowflake}")
# Generated snowflake: 17359567945990144
Parsing a Snowflake
To parse an existing snowflake and extract its creation time and parameter, use the parse method.
dt, parameter = generator.parse(snowflake)
print(f"Timestamp: {dt}, Parameter: {parameter}")
# Timestamp: datetime.datetime(2024, 2, 17, 13, 49, 13, 466377), Parameter: 42
This method returns the timestamp of the snowflake as a datetime object in UTC and the parameter encoded within the snowflake.
Metadata
Release files for flakemaker 1.0.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flakemaker-1.0.0.post1.tar.gz | 3.7 kB | Without provenance | Details for flakemaker-1.0.0.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flakemaker-1.0.0.post1-py3-none-any.whl | Python 3 | none | any | Details for flakemaker-1.0.0.post1-py3-none-any.whl |
Total release size: 7.2 kB
Release files / flakemaker-1.0.0.post1.tar.gz
| Download URL | flakemaker-1.0.0.post1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfb5696dce20200ca904febea188f5d361ef5aa254caa5dec7173fc9710660db
|
|
BLAKE2b-256 checksum How to use checksums |
544db0e820e5af3b60f43752c410368eb650e3c256021e3060a392d74358f1fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / flakemaker-1.0.0.post1-py3-none-any.whl
| Download URL | flakemaker-1.0.0.post1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84c58f3a17ec590e4f33bc618c949848b39d1f2c7d5e6562435d90f5f8b0c4f6
|
|
BLAKE2b-256 checksum How to use checksums |
1669b87d1d45b2291f30b0dc4f8bc8a49acaeb7787c8834e92c51f2b0a861899
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for flakemaker 1.0.0.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.