generated from kgod/ai-review-template
提交
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,143 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: uuid_utils
|
||||
Version: 0.16.0
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Programming Language :: Python :: 3.13
|
||||
Classifier: Programming Language :: Python :: 3.14
|
||||
Classifier: Programming Language :: Rust
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Operating System :: OS Independent
|
||||
License-File: LICENSE.md
|
||||
Summary: Fast, drop-in replacement for Python's uuid module, powered by Rust.
|
||||
Keywords: rust,uuid
|
||||
Author-email: Amin Alaee <mohammadamin.alaee@gmail.com>
|
||||
License-Expression: BSD-3-Clause
|
||||
Requires-Python: >=3.10
|
||||
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
||||
Project-URL: Documentation, https://github.com/aminalaee/uuid-utils
|
||||
Project-URL: Issues, https://github.com/aminalaee/uuid-utils/issues
|
||||
Project-URL: Source, https://github.com/aminalaee/uuid-utils
|
||||
|
||||
# Python UUID Utils
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://pypi.org/project/uuid-utils/)
|
||||

|
||||
[](https://pypi.org/project/uuid-utils)
|
||||
[](https://codspeed.io/aminalaee/uuid-utils?utm_source=badge)
|
||||
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
Fast, drop-in replacement for Python's uuid module, powered by Rust.
|
||||
|
||||
Available UUID versions:
|
||||
|
||||
- `uuid1` - Version 1 UUIDs using a timestamp and monotonic counter.
|
||||
- `uuid3` - Version 3 UUIDs based on the MD5 hash of some data.
|
||||
- `uuid4` - Version 4 UUIDs with random data.
|
||||
- `uuid5` - Version 5 UUIDs based on the SHA1 hash of some data.
|
||||
- `uuid6` - Version 6 UUIDs using a timestamp and monotonic counter.
|
||||
- `uuid7` - Version 7 UUIDs using a Unix timestamp ordered by time.
|
||||
- `uuid8` - Version 8 UUIDs using user-defined data.
|
||||
|
||||
## Installation
|
||||
Using `pip`:
|
||||
```shell
|
||||
pip install uuid-utils
|
||||
```
|
||||
or, using `conda`:
|
||||
|
||||
```shell
|
||||
conda install -c conda-forge uuid-utils
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```shell
|
||||
>>> import uuid_utils as uuid
|
||||
|
||||
>>> # make a random UUID
|
||||
>>> uuid.uuid4()
|
||||
UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
|
||||
|
||||
>>> # make a random UUID using a Unix timestamp which is time-ordered.
|
||||
>>> uuid.uuid7()
|
||||
UUID('018afa4a-0d21-7e6c-b857-012bc678552b')
|
||||
|
||||
>>> # make a UUID using a SHA-1 hash of a namespace UUID and a name
|
||||
>>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
|
||||
UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
|
||||
|
||||
>>> # make a UUID using an MD5 hash of a namespace UUID and a name
|
||||
>>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
|
||||
UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
|
||||
```
|
||||
|
||||
## Compatibility with Python UUID
|
||||
|
||||
Some frameworks (e.g. Django) require `UUID` instances from the standard-library `uuid` module,
|
||||
not a custom subclass. Use `uuid_utils.compat` for a drop-in replacement that returns stdlib
|
||||
`uuid.UUID` instances while still outperforming the standard library.
|
||||
|
||||
```py
|
||||
>>> import uuid_utils.compat as uuid
|
||||
|
||||
>>> uuid.uuid4()
|
||||
UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||

|
||||
|
||||
```
|
||||
╭───────────────────────────────── benchdiff ──────────────────────────────────╮
|
||||
│ │
|
||||
│ Benchmark Min Median Max × │
|
||||
│ ─────────────────────────────────────────────────────────────────────────── │
|
||||
│ uuid4() │
|
||||
│ stdlib_uuid4 1178.260ns 1189.167ns 1260.025ns 19.2 │
|
||||
│ compat_uuid4 248.325ns 251.257ns 271.325ns 4.07 │
|
||||
│ uuid_utils_uuid4 60.212ns 61.642ns 62.068ns 1.00 │
|
||||
│ uuid7() │
|
||||
│ stdlib_uuid7 1327.365ns 1336.479ns 1615.529ns 15.7 │
|
||||
│ compat_uuid7 277.427ns 279.572ns 286.819ns 3.30 │
|
||||
│ uuid_utils_uuid7 83.582ns 84.654ns 93.588ns 1.00 │
|
||||
│ UUID from hex │
|
||||
│ stdlib_from_hex 443.457ns 463.514ns 472.753ns 5.47 │
|
||||
│ uuid_utils_from_hex 84.256ns 84.639ns 85.301ns 1.00 │
|
||||
│ UUID from bytes │
|
||||
│ stdlib_from_bytes 398.878ns 400.830ns 403.030ns 3.80 │
|
||||
│ uuid_utils_from_byt… 103.698ns 105.417ns 106.426ns 1.00 │
|
||||
│ │
|
||||
│ ──────────────────────────────────────────────────────────────────────────── │
|
||||
│ Python 3.14.4 │
|
||||
│ Platform macOS-26.3.1 │
|
||||
│ CPU Apple M3 Pro │
|
||||
│ Rounds 10 × 100,000 calls │
|
||||
│ Date 2026-05-13 21:24:22 │
|
||||
╰──────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
## How to develop locally
|
||||
|
||||
```shell
|
||||
make build
|
||||
make test
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```shell
|
||||
maturin develop --release
|
||||
```
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
uuid_utils-0.16.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
uuid_utils-0.16.0.dist-info/METADATA,sha256=_TZAF-YVvrIr8fjDaoFH7DgmWYOJrplMihPX8Pgy6V0,6475
|
||||
uuid_utils-0.16.0.dist-info/RECORD,,
|
||||
uuid_utils-0.16.0.dist-info/WHEEL,sha256=7JL-UNaeAKwqD3UoxVviXWxHIGMKiaMe0XUDAEHKDIs,97
|
||||
uuid_utils-0.16.0.dist-info/licenses/LICENSE.md,sha256=IJMw6B06iYYOnseem_iUvnBfB1Wjhp13qgkfxKL5GQM,1513
|
||||
uuid_utils-0.16.0.dist-info/sboms/uuid-utils.cyclonedx.json,sha256=gDH_UJtIgVY-me8WQMkkIwPJ5-jvZLJDuF7bMqu2ioo,44044
|
||||
uuid_utils/__init__.py,sha256=jlWHngERC2oJ3U25sejyEet5hP5cuIdxuVPAjml0T4c,1185
|
||||
uuid_utils/__init__.pyi,sha256=eAfgbHwuotjJ0Pt3Vx9vxPOsg74dgbvmLx_9_RIXFsw,7629
|
||||
uuid_utils/__pycache__/__init__.cpython-312.pyc,,
|
||||
uuid_utils/_uuid_utils.cp312-win_amd64.pyd,sha256=NJp727WjvxJrM9x67J8Uu3LNaihupklNUMUpY8V1NpY,348160
|
||||
uuid_utils/compat/__init__.py,sha256=e6dE4Sc_fCgraaNPE_ZU8kDD-i8PgqTKZSwlSUVgyQQ,2516
|
||||
uuid_utils/compat/__init__.pyi,sha256=UpiUFKpPkUu2zR6kuvmro8H2FGlew1cU1YKgwGvX4Ac,2261
|
||||
uuid_utils/compat/__pycache__/__init__.cpython-312.pyc,,
|
||||
uuid_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
@@ -0,0 +1,4 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: maturin (1.13.3)
|
||||
Root-Is-Purelib: false
|
||||
Tag: cp312-cp312-win_amd64
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright © 2023, Amin Alaee.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user