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:
Metadata
Release files for snowflake-tool 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| snowflake_tool-2.0.3.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| snowflake_tool-2.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / snowflake_tool-2.0.3.tar.gz
| Download URL | snowflake_tool-2.0.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d8a98435206124c2700ca3f3d0de7186e662b6baa0b3d96fb0d41539bb6c7c6
|
|
BLAKE2b-256 checksum How to use checksums |
063f8d08581e89fa374867b0d2facc458bd8d814a87cb2f9dc542400803c7c94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / snowflake_tool-2.0.3-py3-none-any.whl
| Download URL | snowflake_tool-2.0.3-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cbec3ca191c199739c7c7b6034639ab378baa2816619592549b233bce0e8ef5
|
|
BLAKE2b-256 checksum How to use checksums |
f3357869978e17f1624cb9a053148cb6404612cc48e4531c2db2aba99c06b516
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|