# 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.
```text
+------------------------------------------------------------------------------+
| 1 Bit Unused | 41 Bit Timestamp | 10 Bit Machine ID | 12 Bit Sequence ID |
+------------------------------------------------------------------------------+
```
## Install
```shell
pip install snowflake-tool
```
## Usage
```python
from snowflake import Snowflake
gen = Snowflake(1)
for i in range(int(1e5)):
print(next(gen))
```
Of course, you could also generate one id by generator:
```python
from snowflake import Snowflake
gen = Snowflake(1)
print(gen.generate())
```
### Reference:
1. [twitter-archive/snowflake: Snowflake is a network service for generating unique ID numbers at high scale with some simple guarantees. (github.com)](https://github.com/twitter-archive/snowflake)
2. [bwmarrin/snowflake: A simple to use Go (golang) package to generate or parse Twitter snowflake IDs (github.com)](https://github.com/bwmarrin/snowflake)
3. [Snowflake ID - Wikipedia](https://en.wikipedia.org/wiki/Snowflake_ID)
Raw data
{
"_id": null,
"home_page": "https://github.com/novice2194/snowflake-tool",
"name": "snowflake-tool",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,snowflake,id generator",
"author": "novice2194",
"author_email": "2194150786@qq.com",
"download_url": "https://files.pythonhosted.org/packages/f3/fa/eb53bbdb918c384a89c9ef17bc414103430ad130bad06c2c47131f33089c/snowflake-tool-1.0.0.tar.gz",
"platform": null,
"description": "# Snowflake-tool\r\nSnowflake tool is a Python library that implements the Snowflake algorithm and is used to generate Snowflake ID.\r\n\r\nThe default Twitter format shown below.\r\n\r\n```text\r\n+------------------------------------------------------------------------------+\r\n| 1 Bit Unused | 41 Bit Timestamp | 10 Bit Machine ID | 12 Bit Sequence ID |\r\n+------------------------------------------------------------------------------+\r\n```\r\n## Install\r\n\r\n```shell\r\npip install snowflake-tool\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom snowflake import Snowflake\r\n\r\ngen = Snowflake(1)\r\nfor i in range(int(1e5)):\r\n print(next(gen))\r\n```\r\n\r\nOf course, you could also generate one id by generator:\r\n\r\n```python\r\nfrom snowflake import Snowflake\r\n\r\ngen = Snowflake(1)\r\nprint(gen.generate())\r\n```\r\n\r\n### Reference:\r\n1. [twitter-archive/snowflake: Snowflake is a network service for generating unique ID numbers at high scale with some simple guarantees. (github.com)](https://github.com/twitter-archive/snowflake)\r\n2. [bwmarrin/snowflake: A simple to use Go (golang) package to generate or parse Twitter snowflake IDs (github.com)](https://github.com/bwmarrin/snowflake)\r\n3. [Snowflake ID - Wikipedia](https://en.wikipedia.org/wiki/Snowflake_ID)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple snowflake id generator",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/novice2194/snowflake-tool"
},
"split_keywords": [
"python",
"snowflake",
"id generator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3b2b60035632dcd28e80f537981b3fe4351a9256d92efe815cd49a730655b587",
"md5": "bc761a9564341565e951ba46876d1895",
"sha256": "080d970e7b6c6b64ed980051f1af5604c4d1f7a2ecdefbda46c09dbd64b798eb"
},
"downloads": -1,
"filename": "snowflake_tool-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc761a9564341565e951ba46876d1895",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4209,
"upload_time": "2023-06-13T08:04:07",
"upload_time_iso_8601": "2023-06-13T08:04:07.033103Z",
"url": "https://files.pythonhosted.org/packages/3b/2b/60035632dcd28e80f537981b3fe4351a9256d92efe815cd49a730655b587/snowflake_tool-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f3faeb53bbdb918c384a89c9ef17bc414103430ad130bad06c2c47131f33089c",
"md5": "0756ec0e8eccbccebe4a4826b026c84a",
"sha256": "c5a680e4baf82bd2e1bbc50e27d5304a58508b2ca5d0a201e6ceae8bc7b55ab0"
},
"downloads": -1,
"filename": "snowflake-tool-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "0756ec0e8eccbccebe4a4826b026c84a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4018,
"upload_time": "2023-06-13T08:04:09",
"upload_time_iso_8601": "2023-06-13T08:04:09.132183Z",
"url": "https://files.pythonhosted.org/packages/f3/fa/eb53bbdb918c384a89c9ef17bc414103430ad130bad06c2c47131f33089c/snowflake-tool-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-13 08:04:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "novice2194",
"github_project": "snowflake-tool",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "snowflake-tool"
}