{"id":13493335,"url":"https://github.com/vd2org/snowflake","last_synced_at":"2025-04-06T05:17:59.365Z","repository":{"id":57468984,"uuid":"385565069","full_name":"vd2org/snowflake","owner":"vd2org","description":"The Snowflake generator done right.","archived":false,"fork":false,"pushed_at":"2024-06-12T08:16:04.000Z","size":60,"stargazers_count":106,"open_issues_count":1,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T04:09:45.494Z","etag":null,"topics":["id","id-generator","ids","snowflake","snowflake-id"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vd2org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-13T10:30:20.000Z","updated_at":"2025-02-28T00:10:58.000Z","dependencies_parsed_at":"2022-09-19T10:10:24.242Z","dependency_job_id":"e9a1d52a-4f6e-4af4-a040-d58ca6218d58","html_url":"https://github.com/vd2org/snowflake","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.4285714285714286,"last_synced_commit":"966d8dfaa15c87691bc19db662fe787e39dd7e70"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vd2org%2Fsnowflake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vd2org%2Fsnowflake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vd2org%2Fsnowflake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vd2org%2Fsnowflake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vd2org","download_url":"https://codeload.github.com/vd2org/snowflake/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247436384,"owners_count":20938552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["id","id-generator","ids","snowflake","snowflake-id"],"created_at":"2024-07-31T19:01:14.286Z","updated_at":"2025-04-06T05:17:59.041Z","avatar_url":"https://github.com/vd2org.png","language":"Python","readme":"# Snowflake\n\nThe Snowflake generator done right.\n\nSee [here](https://en.wikipedia.org/wiki/Snowflake_ID) for additional information.\n\n### Requirements\n\nPython 3.8 and above. No additional dependencies.\n\n### Installation\n\n`pip install snowflake-id`\n\n## Usage\n\n### Using generator\n\n```python\nfrom snowflake import SnowflakeGenerator\n\ngen = SnowflakeGenerator(42)\n\nfor i in range(100):\n    val = next(gen)\n    print(val)\n```\n\n#### Output:\n\n```text\n6820698575169822721\n6820698575169822722\n6820698575169822723\n6820698575174017024\n6820698575174017025\n...\n```\n\n### Parse snowflake id\n\n```python\nfrom snowflake import Snowflake\n\nsf = Snowflake.parse(856165981072306191, 1288834974657)\n\nprint(f\"{sf.timestamp = }\")\nprint(f\"{sf.instance = }\")\nprint(f\"{sf.epoch = }\")\nprint(f\"{sf.seq = }\")\nprint(f\"{sf.seconds = }\")\nprint(f\"{sf.milliseconds = }\")\nprint(f\"{sf.datetime = }\")\nprint(f\"{int(sf) = }\")\n```\n\n#### Output:\n\n```text\nsf.timestamp = 204125876682\nsf.instance = 363\nsf.epoch = 1288834974657\nsf.seq = 15\nsf.seconds = 1492960851.339\nsf.milliseconds = 1492960851339\nsf.datetime = datetime.datetime(2017, 4, 23, 15, 20, 51, 339000)\nint(sf) = 856165981072306191\n```\n\n### Load generator state\n\n```python\nfrom snowflake import SnowflakeGenerator, Snowflake\n\nsf = Snowflake.parse(856165981072306191, 1288834974657)\ngen = SnowflakeGenerator.from_snowflake(sf)\n\nfor i in range(100):\n    val = next(gen)\n    print(val)\n```\n\n#### Output:\n\n```text\n1414934653136449536\n1414934653136449537\n1414934653136449538\n1414934653136449539\n1414934653136449540\n...\n```\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvd2org%2Fsnowflake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvd2org%2Fsnowflake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvd2org%2Fsnowflake/lists"}