{"id":20949866,"url":"https://github.com/curt/branflake","last_synced_at":"2026-04-27T14:31:05.071Z","repository":{"id":65521565,"uuid":"286613058","full_name":"curt/branflake","owner":"curt","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-02T00:52:59.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-29T16:19:16.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/curt.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}},"created_at":"2020-08-11T01:10:35.000Z","updated_at":"2023-01-10T09:18:58.000Z","dependencies_parsed_at":"2023-01-27T04:45:13.939Z","dependency_job_id":null,"html_url":"https://github.com/curt/branflake","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/curt/branflake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curt%2Fbranflake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curt%2Fbranflake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curt%2Fbranflake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curt%2Fbranflake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/curt","download_url":"https://codeload.github.com/curt/branflake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curt%2Fbranflake/sbom","scorecard":{"id":312948,"data":{"date":"2025-08-11","repo":{"name":"github.com/curt/branflake","commit":"7a3a158a646ec383ecaf5b20588f2a7972ae1b55"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T23:31:39.625Z","repository_id":65521565,"created_at":"2025-08-17T23:31:39.625Z","updated_at":"2025-08-17T23:31:39.625Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32341447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-19T00:44:19.115Z","updated_at":"2026-04-27T14:31:05.054Z","avatar_url":"https://github.com/curt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Branflake\n=========\n\nA modified, simplified 128-bit pseudo-flake ID generator for Python.\n\nAbout\n-----\n\nI recently had a need for Python code that would generate lexically and numerically increasing identifiers. However, most of the \"flake ID\" packages I found included a worker component and an intra-microsecond sequencing. For my needs, having a time portion with microsecond precision is more than sufficient, so long as the rest of the identifier is random enough to avoid a collision. Within any microsecond, I don't care about the sequence.\n\nScratching an itch, I put together a minimal library and called it __Branflake__. It combines a 64-bit microsecond time component with a 64-bit random number. For my needs, it's more than enough to keep the likelihood of a collision infinitesimal.\n\nA Branflake can be represented either as a numerically increasing `int` or as a lexically increasing hex-coded `string`. It can be persisted in a database or shared online as an `int` or a hex-coded `string` and be reconstituted later from either.\n\nRequirements\n------------\n\nPython \u003e= 3.6\n\nInstallation\n------------\n\nIdeally, in a Python virtual environment.\n\n        $ pip install branflake\n\nUsage\n-----\n\nFirst, of course, import the class definition from the package.\n\n        $ python\n        \u003e\u003e\u003e from branflake import Branflake\n\nDepending on your setup, you may need to use `python3` instead of `python`.\n\nTo create a new Branflake is straightforward.\n\n        \u003e\u003e\u003e flake = Branflake()\n        \u003e\u003e\u003e flake\n        \u003cBranflake 29461407052892765126374337862832989\u003e\n\nTo persist a Branflake as an `int`, use the `to_int` method.\n\n        \u003e\u003e\u003e i = flake.to_int()\n        \u003e\u003e\u003e i\n        29461407052892765126374337862832989\n\nTo reconstitute the Branflake later from the `int`, use the `from_int` method.\n\n        \u003e\u003e\u003e reflake = Branflake.from_int(i)\n        \u003e\u003e\u003e reflake\n        \u003cBranflake 29461407052892765126374337862832989\u003e\n\nTo get the `time` structure corresponding to the time part of the Branflake, use the `to_gmtime` method.\n\n        \u003e\u003e\u003e struct = reflake.to_gmtime()\n        \u003e\u003e\u003e struct\n        time.struct_time(tm_year=2020, tm_mon=8, tm_mday=11, tm_hour=0, tm_min=34, tm_sec=36, tm_wday=1, tm_yday=224, tm_isdst=0)\n\nLimitations\n-----------\n\nPython treats the `None` object and a zero `int` the same for true-false logic. Rather than code around this, the earliest possible valid Branflake corresponds to _one microsecond_ after the beginning of the epoch.\n\nThe earliest possible Branflake corresponds to January 1, 1970. The `int` representation has 20 digits.\n\n        \u003e\u003e\u003e min_branflake = Branflake.from_bytes(b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00')\n        \u003e\u003e\u003e min_branflake.to_int()\n        18446744073709551616\n        \u003e\u003e\u003e len(str(min_branflake))\n        20\n        \u003e\u003e\u003e min_branflake.to_gmtime()\n        time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)\n\nThe latest possible Branflake corresponds to January 19, 586524. The `int` representation has 39 digits.\n\n        \u003e\u003e\u003e max_branflake = Branflake.from_bytes(b'\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff')\n        \u003e\u003e\u003e max_branflake.to_int()\n        340282366920938463463374607431768211455\n        \u003e\u003e\u003e len(str(max_branflake))\n        39\n        \u003e\u003e\u003e max_branflake.to_gmtime()\n        time.struct_time(tm_year=586524, tm_mon=1, tm_mday=19, tm_hour=8, tm_min=1, tm_sec=49, tm_wday=2, tm_yday=19, tm_isdst=0)\n\nRemarks\n-------\n\nThe `int` representation of a Branflake is numerically increasing across the entire valid range. However, strictly speaking, it is not lexically increasing without padding it with leading zeroes to make it 39 digits. Still, even without the padding, it can be considered lexically increasing over certain ranges of time.\n\nFor example, since the year 1987, the `int` representation has had 35 digits. It will continue to have 35 digits until the year 2141.\n\n        \u003e\u003e\u003e low_branflake = Branflake.from_int(10000000000000000000000000000000000)\n        \u003e\u003e\u003e low_branflake.to_gmtime()\n        time.struct_time(tm_year=1987, tm_mon=3, tm_mday=7, tm_hour=7, tm_min=38, tm_sec=6, tm_wday=5, tm_yday=66, tm_isdst=0)\n        \u003e\u003e\u003e high_branflake = Branflake.from_int(99999999999999999999999999999999999)\n        \u003e\u003e\u003e high_branflake.to_gmtime()\n        time.struct_time(tm_year=2141, tm_mon=10, tm_mday=14, tm_hour=4, tm_min=21, tm_sec=2, tm_wday=5, tm_yday=287, tm_isdst=0)\n\nTherefore, if you assume the time portion of a Branflake will fall inside this range, you can use the `\u003c` and `\u003e` operators on `int` representations even if they've been converted to `string`.\n\nLicense\n-------\n\nMIT license.\n\nAuthor\n------\n\nThe package is written and maintained by Curt Gilman.\n\nName\n----\n\nSnowflake was the name of the [original project at Twitter](https://github.com/twitter-archive/snowflake) that inspired a number of implementations. For that reason, I wanted to choose a name that had _flake_ in it.\n\n_Cornflake_ was already taken in the [Python Package Index](https://pypi.org/), so that was out. It apparently has nothing to do with flake ID generation.\n\n_Frostedflake_ was a name that crossed my mind. It sounded delicious but was a bit of a mouthful.\n\n_Branflake_ seemed like a good choice. It may be part of a healthy and nutritious breakfast.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurt%2Fbranflake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurt%2Fbranflake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurt%2Fbranflake/lists"}