{"id":13724986,"url":"https://github.com/sqids/sqids-python","last_synced_at":"2025-12-29T23:07:34.513Z","repository":{"id":176747000,"uuid":"658041935","full_name":"sqids/sqids-python","owner":"sqids","description":"Official Python port of Sqids. Generate short unique IDs from numbers.","archived":false,"fork":false,"pushed_at":"2024-08-08T20:35:49.000Z","size":84,"stargazers_count":370,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-01T14:07:07.385Z","etag":null,"topics":["hashids","id","id-generator","python","short-id","short-url","sqids","uid","unique-id","unique-id-generator"],"latest_commit_sha":null,"homepage":"https://sqids.org/python","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/sqids.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-06-24T15:29:01.000Z","updated_at":"2024-10-28T21:18:48.000Z","dependencies_parsed_at":"2023-11-13T08:27:11.516Z","dependency_job_id":"d12ebfd0-fc52-48d3-86ae-60fccb1778ed","html_url":"https://github.com/sqids/sqids-python","commit_stats":null,"previous_names":["sqids/sqids-python"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqids","download_url":"https://codeload.github.com/sqids/sqids-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224645157,"owners_count":17346085,"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":["hashids","id","id-generator","python","short-id","short-url","sqids","uid","unique-id","unique-id-generator"],"created_at":"2024-08-03T01:02:08.840Z","updated_at":"2025-12-29T23:07:34.504Z","avatar_url":"https://github.com/sqids.png","language":"Python","readme":"# [Sqids Python](https://sqids.org/python)\n\n[![PyPI package](https://badge.fury.io/py/sqids.svg)](https://pypi.org/project/sqids/)\n[![Github Actions](https://img.shields.io/github/actions/workflow/status/sqids/sqids-python/tests.yml)](https://github.com/sqids/sqids-python/actions)\n[![Downloads](https://img.shields.io/pypi/dm/sqids)](https://pypi.org/project/sqids/)\n\n[Sqids](https://sqids.org/python) (*pronounced \"squids\"*) is a small library that lets you **generate unique IDs from numbers**. It's good for link shortening, fast \u0026 URL-safe ID generation and decoding back into numbers for quicker database lookups.\n\nFeatures:\n\n- **Encode multiple numbers** - generate short IDs from one or several non-negative numbers\n- **Quick decoding** - easily decode IDs back into numbers\n- **Unique IDs** - generate unique IDs by shuffling the alphabet once\n- **ID padding** - provide minimum length to make IDs more uniform\n- **URL safe** - auto-generated IDs do not contain common profanity\n- **Randomized output** - Sequential input provides nonconsecutive IDs\n- **Many implementations** - Support for [40+ programming languages](https://sqids.org/)\n\n## 🧰 Use-cases\n\nGood for:\n\n- Generating IDs for public URLs (eg: link shortening)\n- Generating IDs for internal systems (eg: event tracking)\n- Decoding for quicker database lookups (eg: by primary keys)\n\nNot good for:\n\n- Sensitive data (this is not an encryption library)\n- User IDs (can be decoded revealing user count)\n\n## 🚀 Getting started\n\nInstall the package from PyPI, e. g. with pip:\n\n```bash\npip install sqids\n```\n\nImport the `Sqids` class from the `sqids` package:\n\n```python\nfrom sqids import Sqids\nsqids = Sqids()\n```\n\n## 👩‍💻 Examples\n\nSimple encode \u0026 decode:\n\n```python\nsqids = Sqids()\nid = sqids.encode([1, 2, 3]) # \"86Rf07\"\nnumbers = sqids.decode(id) # [1, 2, 3]\n```\n\n\u003e **Note**\n\u003e 🚧 Because of the algorithm's design, **multiple IDs can decode back into the same sequence of numbers**. If it's important to your design that IDs are canonical, you have to manually re-encode decoded numbers and check that the generated ID matches.\n\nEnforce a *minimum* length for IDs:\n\n```python\nsqids = Sqids(min_length=10)\nid = sqids.encode([1, 2, 3]) # \"86Rf07xd4z\"\nnumbers = sqids.decode(id) # [1, 2, 3]\n```\n\nRandomize IDs by providing a custom alphabet:\n\n```python\nsqids = Sqids(alphabet=\"FxnXM1kBN6cuhsAvjW3Co7l2RePyY8DwaU04Tzt9fHQrqSVKdpimLGIJOgb5ZE\")\nid = sqids.encode([1, 2, 3]) # \"B4aajs\"\nnumbers = sqids.decode(id) # [1, 2, 3]\n```\n\nPrevent specific words from appearing anywhere in the auto-generated IDs:\n\n```python\nsqids = Sqids(blocklist=[\"86Rf07\"])\nid = sqids.encode([1, 2, 3]) # \"se8ojk\"\nnumbers = sqids.decode(id) # [1, 2, 3]\n```\n\n## 📝 License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":["Python","Text Processing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqids%2Fsqids-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqids%2Fsqids-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqids%2Fsqids-python/lists"}