Simple snowflake id generator
Project description
Snowflake-tool
Snowflake tool is a Python library that implements the Snowflake algorithm and is used to generate Snowflake ID.
The default Twitter format shown below.
+------------------------------------------------------------------------------+
| 1 Bit Unused | 41 Bit Timestamp | 10 Bit Machine ID | 12 Bit Sequence ID |
+------------------------------------------------------------------------------+
Install
pip install snowflake-tool
Usage
from snowflake import Snowflake
gen = Snowflake(1)
for i in range(int(1e5)):
print(next(gen.g()))
Of course, you could also generate one id by generator:
from snowflake import Snowflake
gen = Snowflake(1)
print(gen.gen_id())
Reference:
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
snowflake_tool-2.0.3.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snowflake_tool-2.0.3.tar.gz.
File metadata
- Download URL: snowflake_tool-2.0.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d8a98435206124c2700ca3f3d0de7186e662b6baa0b3d96fb0d41539bb6c7c6
|
|
| MD5 |
d0c4270ab1a2d833b154a2c79aa35150
|
|
| BLAKE2b-256 |
063f8d08581e89fa374867b0d2facc458bd8d814a87cb2f9dc542400803c7c94
|
File details
Details for the file snowflake_tool-2.0.3-py3-none-any.whl.
File metadata
- Download URL: snowflake_tool-2.0.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cbec3ca191c199739c7c7b6034639ab378baa2816619592549b233bce0e8ef5
|
|
| MD5 |
8f3f69dd5d8f4cf86801a3e9b4f028fa
|
|
| BLAKE2b-256 |
f3357869978e17f1624cb9a053148cb6404612cc48e4531c2db2aba99c06b516
|