{"id":22687391,"url":"https://github.com/cablehead/python-fity3","last_synced_at":"2025-04-12T20:43:36.062Z","repository":{"id":21928148,"uuid":"25252496","full_name":"cablehead/python-fity3","owner":"cablehead","description":"Fity3 is a Twitter snowflake like scheme generator that fits in 53 bits","archived":false,"fork":false,"pushed_at":"2018-09-09T06:36:28.000Z","size":172,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T18:24:40.384Z","etag":null,"topics":[],"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/cablehead.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2014-10-15T11:54:31.000Z","updated_at":"2022-04-06T19:36:18.000Z","dependencies_parsed_at":"2022-08-05T15:00:58.090Z","dependency_job_id":null,"html_url":"https://github.com/cablehead/python-fity3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cablehead%2Fpython-fity3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cablehead%2Fpython-fity3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cablehead%2Fpython-fity3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cablehead%2Fpython-fity3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cablehead","download_url":"https://codeload.github.com/cablehead/python-fity3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631675,"owners_count":21136555,"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":[],"created_at":"2024-12-09T23:18:11.813Z","updated_at":"2025-04-12T20:43:36.035Z","avatar_url":"https://github.com/cablehead.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Fity3\n-----\n\nFity3 is a Twitter snowflake like scheme generator that fits in 53 bits.\n\n.. image:: https://travis-ci.org/cablehead/python-fity3.svg?branch=master\n       :target: https://travis-ci.org/cablehead/python-fity3\n\nIts scheme is::\n\n    timestamp | worker_id | sequence\n     41 bits  |  8 bits   |  4 bits\n\n`Twitter's snowflake scheme\n\u003chttps://blog.twitter.com/2010/announcing-snowflake\u003e`_ for id generation has a\nbunch of nice properties. An enormous number of roughly-sorted ids can be\ncreated per second in an uncoordinated manner.\n\nHowever it's *painful* working with 64 bit integers in environments that use\nIEEE 754 floating points for numerics. Particularly `JavaScript\n\u003chttps://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake\u003e`_ and the\n`scores for Redis' sorted sets\n\u003chttp://stackoverflow.com/questions/20295544/redis-sorted-set-wrong-score\u003e`_.\n\nThis scheme allows for:\n\n    * 69 years of ids (the same as snowflakes)\n    * at most 256 unique id generating workers\n    * each worker can produce at most 16 ids per millisecond\n    * so at most 4 million ids per second\n\nIf you're building a system in the sweet spot of not being too popular that\nusage will grow to creating more than 4 million new things a second but you\ncould benefit from uncoordinated incrementing id generation and don't want to\npunch yourself in the face every time you request data over a websocket from\nJavaScript, this scheme might be a useful alternative.\n\n.. code:: python\n\n    \u003e\u003e\u003e import fity3\n    \u003e\u003e\u003e f3 = fity3.generator(1)\n    \u003e\u003e\u003e next(f3)\n    14127739136\n    \u003e\u003e\u003e next(f3)\n    14132125952\n    \u003e\u003e\u003e next(f3)\n    14135079168\n\n    # convenience to convert to a unix timestamp\n    \u003e\u003e\u003e fity3.to_timestamp(14135079168)\n    1413374250\n\nLet's just hope we won't be the ones supporting any of these systems in 2079.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcablehead%2Fpython-fity3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcablehead%2Fpython-fity3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcablehead%2Fpython-fity3/lists"}