cuid2-2.0.1
توضیحات
Next generation GUIDs. Collision-resistant ids optimized for horizontal scaling and performance.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cuid2-2.0.1 |
| نام | cuid2 |
| نسخه کتابخانه | 2.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Will Gordon <wgordon@redhat.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/cuid2/ |
| مجوز | The 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. |
# cuid2
[](https://img.shields.io/badge/python-3.8+-blue.svg)
[](https://pypi.python.org/pypi/cuid2)
[](https://pypi.python.org/pypi/cuid2)
[](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()
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl cuid2-2.0.1:
pip install cuid2-2.0.1.whl
نصب پکیج tar.gz cuid2-2.0.1:
pip install cuid2-2.0.1.tar.gz