cuid2


Namecuid2 JSON
Version 2.0.1 PyPI version JSON
download
home_pageNone
SummaryNext generation GUIDs. Collision-resistant ids optimized for horizontal scaling and performance.
upload_time2024-04-16 23:51:52
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseThe MIT License (MIT) Copyright (c) 2023 Gordon Code Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords crypt security uuid guid cuid cryptography
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cuid2

[![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://img.shields.io/badge/python-3.8+-blue.svg)
[![PyPi](https://img.shields.io/pypi/v/cuid2.svg)](https://pypi.python.org/pypi/cuid2)
[![PyPi](https://img.shields.io/pypi/dm/cuid2.svg)](https://pypi.python.org/pypi/cuid2)
[![cuid2](https://snyk.io/advisor/python/cuid2/badge.svg)](https://snyk.io/advisor/python/cuid2)

CUID2 for Python 3. Next generation GUIDs. Collision-resistant ids optimized for 
horizontal scaling and performance.

A port of the [CUID2 reference implementation](https://github.com/paralleldrive/cuid2) 
by [Parallel Drive](https://github.com/paralleldrive) to Python 3.

> :memo: Note: Originally taken from https://github.com/overflowdigital before it 
> was unpublished. Thank you to @joshuathompsonlindley for your original contribution!

## What is CUID2?

* Secure: It's not possible to guess the next ID.
* Collision resistant: It's extremely unlikely to generate the same ID twice.
* Horizontally scalable: Generate IDs on multiple machines without coordination.
* Offline-compatible: Generate IDs without a network connection.
* URL and name-friendly: No special characters.

## Why?

For more information on the theory and usage of CUID2, see the 
[following](https://github.com/paralleldrive/cuid2#why).

## Improvements Over CUID

For more information on the improvements of CUID2 over CUID, see the 
[following](https://github.com/paralleldrive/cuid2#improvements-over-cuid).


## Install
```
pip install cuid2
```

## Usage

You can generate CUIDs directly in the terminal with the following:
```bash
$ cuid2
```

Or you can rely on a CUID wrapper if you don't need any customizations:
```python
from typing import Callable
from cuid2 import cuid_wrapper

cuid_generator: Callable[[], str] = cuid_wrapper()

def main():
  my_cuid: str = cuid_generator()
  next_cuid: str = cuid_generator()
```

Finally, for more explicit control of the CUID generator, you can instantiate the class directly:
```python
from cuid2 import Cuid

CUID_GENERATOR: Cuid = Cuid(length=10)

def main():
  my_cuid: str = CUID_GENERATOR.generate()
  next_cuid: str = CUID_GENERATOR.generate()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cuid2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "crypt, security, uuid, guid, cuid, cryptography",
    "author": null,
    "author_email": "Will Gordon <wgordon@redhat.com>",
    "download_url": "https://files.pythonhosted.org/packages/db/63/97ffc74f33e5a5f913bf073e8250a5b5a64d52d411b09a9c36c902db2cc4/cuid2-2.0.1.tar.gz",
    "platform": null,
    "description": "# cuid2\n\n[![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://img.shields.io/badge/python-3.8+-blue.svg)\n[![PyPi](https://img.shields.io/pypi/v/cuid2.svg)](https://pypi.python.org/pypi/cuid2)\n[![PyPi](https://img.shields.io/pypi/dm/cuid2.svg)](https://pypi.python.org/pypi/cuid2)\n[![cuid2](https://snyk.io/advisor/python/cuid2/badge.svg)](https://snyk.io/advisor/python/cuid2)\n\nCUID2 for Python 3. Next generation GUIDs. Collision-resistant ids optimized for \nhorizontal scaling and performance.\n\nA port of the [CUID2 reference implementation](https://github.com/paralleldrive/cuid2) \nby [Parallel Drive](https://github.com/paralleldrive) to Python 3.\n\n> :memo: Note: Originally taken from https://github.com/overflowdigital before it \n> was unpublished. Thank you to @joshuathompsonlindley for your original contribution!\n\n## What is CUID2?\n\n* Secure: It's not possible to guess the next ID.\n* Collision resistant: It's extremely unlikely to generate the same ID twice.\n* Horizontally scalable: Generate IDs on multiple machines without coordination.\n* Offline-compatible: Generate IDs without a network connection.\n* URL and name-friendly: No special characters.\n\n## Why?\n\nFor more information on the theory and usage of CUID2, see the \n[following](https://github.com/paralleldrive/cuid2#why).\n\n## Improvements Over CUID\n\nFor more information on the improvements of CUID2 over CUID, see the \n[following](https://github.com/paralleldrive/cuid2#improvements-over-cuid).\n\n\n## Install\n```\npip install cuid2\n```\n\n## Usage\n\nYou can generate CUIDs directly in the terminal with the following:\n```bash\n$ cuid2\n```\n\nOr you can rely on a CUID wrapper if you don't need any customizations:\n```python\nfrom typing import Callable\nfrom cuid2 import cuid_wrapper\n\ncuid_generator: Callable[[], str] = cuid_wrapper()\n\ndef main():\n  my_cuid: str = cuid_generator()\n  next_cuid: str = cuid_generator()\n```\n\nFinally, for more explicit control of the CUID generator, you can instantiate the class directly:\n```python\nfrom cuid2 import Cuid\n\nCUID_GENERATOR: Cuid = Cuid(length=10)\n\ndef main():\n  my_cuid: str = CUID_GENERATOR.generate()\n  next_cuid: str = CUID_GENERATOR.generate()\n```\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)\n        \n        Copyright (c) 2023 Gordon Code\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Next generation GUIDs. Collision-resistant ids optimized for horizontal scaling and performance.",
    "version": "2.0.1",
    "project_urls": {
        "Repository": "https://github.com/gordon-code/cuid2/"
    },
    "split_keywords": [
        "crypt",
        " security",
        " uuid",
        " guid",
        " cuid",
        " cryptography"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00d290fce0050c5a9196d259ac8f0c4720c69ec6b5a322612edf3892f0036c5d",
                "md5": "92ad89c9ab6f8c21bab0ef9ee4e851cb",
                "sha256": "943bdf86dc3ed07f32253e1be6e3c34dda8c7bda1c453f851f4ebaaa5a2dcfbf"
            },
            "downloads": -1,
            "filename": "cuid2-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "92ad89c9ab6f8c21bab0ef9ee4e851cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8154,
            "upload_time": "2024-04-16T23:51:50",
            "upload_time_iso_8601": "2024-04-16T23:51:50.953138Z",
            "url": "https://files.pythonhosted.org/packages/00/d2/90fce0050c5a9196d259ac8f0c4720c69ec6b5a322612edf3892f0036c5d/cuid2-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db6397ffc74f33e5a5f913bf073e8250a5b5a64d52d411b09a9c36c902db2cc4",
                "md5": "3333effa43697d8776fa85c64690671f",
                "sha256": "8d262eb467c16b81419361e18e47f41da77c4446dd2cf0640eac2616680bc924"
            },
            "downloads": -1,
            "filename": "cuid2-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3333effa43697d8776fa85c64690671f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7033,
            "upload_time": "2024-04-16T23:51:52",
            "upload_time_iso_8601": "2024-04-16T23:51:52.050222Z",
            "url": "https://files.pythonhosted.org/packages/db/63/97ffc74f33e5a5f913bf073e8250a5b5a64d52d411b09a9c36c902db2cc4/cuid2-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-16 23:51:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gordon-code",
    "github_project": "cuid2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cuid2"
}
        
Elapsed time: 0.21162s