uuid-utils 0.7.0__cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl → 0.9.0__cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of uuid-utils might be problematic. Click here for more details.
- uuid_utils/__init__.pyi +26 -11
- uuid_utils/_uuid_utils.cpython-310-i386-linux-gnu.so +0 -0
- uuid_utils/compat/__init__.pyi +45 -7
- {uuid_utils-0.7.0.dist-info → uuid_utils-0.9.0.dist-info}/METADATA +22 -17
- uuid_utils-0.9.0.dist-info/RECORD +10 -0
- {uuid_utils-0.7.0.dist-info → uuid_utils-0.9.0.dist-info}/WHEEL +1 -1
- uuid_utils-0.7.0.dist-info/RECORD +0 -10
- {uuid_utils-0.7.0.dist-info → uuid_utils-0.9.0.dist-info}/license_files/LICENSE.md +0 -0
uuid_utils/__init__.pyi
CHANGED
|
@@ -60,12 +60,15 @@ class UUID:
|
|
|
60
60
|
variant the UUID variant (one of the constants RESERVED_NCS,
|
|
61
61
|
RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)
|
|
62
62
|
|
|
63
|
-
version the UUID version number
|
|
64
|
-
when the variant is RFC_4122)
|
|
63
|
+
version the UUID version number
|
|
65
64
|
|
|
66
65
|
is_safe An enum indicating whether the UUID has been generated in
|
|
67
66
|
a way that is safe for multiprocessing applications, via
|
|
68
67
|
uuid_generate_time_safe(3).
|
|
68
|
+
|
|
69
|
+
timestamp The timestamp of the UUID in milliseconds since epoch.
|
|
70
|
+
Only works for UUID versions 1, 6 and 7,
|
|
71
|
+
otherwise raises ValueError.
|
|
69
72
|
"""
|
|
70
73
|
|
|
71
74
|
def __init__(
|
|
@@ -139,31 +142,43 @@ def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID:
|
|
|
139
142
|
otherwise a random 14-bit sequence number is chosen."""
|
|
140
143
|
...
|
|
141
144
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
if sys.version_info >= (3, 12):
|
|
146
|
+
def uuid3(namespace: UUID, name: str | bytes) -> UUID:
|
|
147
|
+
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
|
|
148
|
+
...
|
|
149
|
+
else:
|
|
150
|
+
def uuid3(namespace: UUID, name: str) -> UUID:
|
|
151
|
+
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
|
|
152
|
+
...
|
|
145
153
|
|
|
146
154
|
def uuid4() -> UUID:
|
|
147
155
|
"""Generate a random UUID."""
|
|
148
156
|
...
|
|
149
157
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
158
|
+
if sys.version_info >= (3, 12):
|
|
159
|
+
def uuid5(namespace: UUID, name: str | bytes) -> UUID:
|
|
160
|
+
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
|
|
161
|
+
...
|
|
162
|
+
else:
|
|
163
|
+
def uuid5(namespace: UUID, name: str) -> UUID:
|
|
164
|
+
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
|
|
165
|
+
...
|
|
153
166
|
|
|
154
|
-
def uuid6(
|
|
167
|
+
def uuid6(
|
|
168
|
+
node: _Int | None = None, timestamp: _Int | None = None, nanos: _Int | None = None
|
|
169
|
+
) -> UUID:
|
|
155
170
|
"""Generate a version 6 UUID using the given timestamp and a host ID.
|
|
156
171
|
This is similar to version 1 UUIDs,
|
|
157
172
|
except that it is lexicographically sortable by timestamp.
|
|
158
173
|
"""
|
|
159
174
|
...
|
|
160
175
|
|
|
161
|
-
def uuid7(timestamp: _Int | None = None) -> UUID:
|
|
176
|
+
def uuid7(timestamp: _Int | None = None, nanos: _Int | None = None) -> UUID:
|
|
162
177
|
"""Generate a version 7 UUID using a time value and random bytes."""
|
|
163
178
|
...
|
|
164
179
|
|
|
165
180
|
def uuid8(bytes: _Bytes) -> UUID:
|
|
166
|
-
"""Generate a custom UUID comprised almost entirely of user-supplied bytes
|
|
181
|
+
"""Generate a custom UUID comprised almost entirely of user-supplied bytes."""
|
|
167
182
|
...
|
|
168
183
|
|
|
169
184
|
NAMESPACE_DNS: UUID
|
|
Binary file
|
uuid_utils/compat/__init__.pyi
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
import sys
|
|
2
|
+
from uuid import (
|
|
3
|
+
NAMESPACE_DNS,
|
|
4
|
+
NAMESPACE_OID,
|
|
5
|
+
NAMESPACE_URL,
|
|
6
|
+
NAMESPACE_X500,
|
|
7
|
+
RESERVED_FUTURE,
|
|
8
|
+
RESERVED_MICROSOFT,
|
|
9
|
+
RESERVED_NCS,
|
|
10
|
+
RFC_4122,
|
|
11
|
+
UUID,
|
|
12
|
+
SafeUUID,
|
|
13
|
+
getnode,
|
|
14
|
+
)
|
|
2
15
|
|
|
3
16
|
from typing_extensions import TypeAlias
|
|
4
17
|
|
|
18
|
+
__all__ = [
|
|
19
|
+
"NAMESPACE_DNS",
|
|
20
|
+
"NAMESPACE_OID",
|
|
21
|
+
"NAMESPACE_URL",
|
|
22
|
+
"NAMESPACE_X500",
|
|
23
|
+
"RESERVED_FUTURE",
|
|
24
|
+
"RESERVED_MICROSOFT",
|
|
25
|
+
"RESERVED_NCS",
|
|
26
|
+
"RFC_4122",
|
|
27
|
+
"UUID",
|
|
28
|
+
"SafeUUID",
|
|
29
|
+
"getnode",
|
|
30
|
+
]
|
|
31
|
+
|
|
5
32
|
# Because UUID has properties called int and bytes we need to rename these temporarily.
|
|
6
33
|
_Int: TypeAlias = int
|
|
7
34
|
_Bytes: TypeAlias = bytes
|
|
@@ -13,17 +40,28 @@ def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID:
|
|
|
13
40
|
otherwise a random 14-bit sequence number is chosen."""
|
|
14
41
|
...
|
|
15
42
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
43
|
+
if sys.version_info >= (3, 12):
|
|
44
|
+
def uuid3(namespace: UUID, name: str | bytes) -> UUID:
|
|
45
|
+
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
|
|
46
|
+
...
|
|
47
|
+
|
|
48
|
+
else:
|
|
49
|
+
def uuid3(namespace: UUID, name: str) -> UUID:
|
|
50
|
+
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
|
|
51
|
+
...
|
|
19
52
|
|
|
20
53
|
def uuid4() -> UUID:
|
|
21
54
|
"""Generate a random UUID."""
|
|
22
55
|
...
|
|
23
56
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
57
|
+
if sys.version_info >= (3, 12):
|
|
58
|
+
def uuid5(namespace: UUID, name: str | bytes) -> UUID:
|
|
59
|
+
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
|
|
60
|
+
...
|
|
61
|
+
else:
|
|
62
|
+
def uuid5(namespace: UUID, name: str) -> UUID:
|
|
63
|
+
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
|
|
64
|
+
...
|
|
27
65
|
|
|
28
66
|
def uuid6(node: _Int | None = None, timestamp: _Int | None = None) -> UUID:
|
|
29
67
|
"""Generate a version 6 UUID using the given timestamp and a host ID.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: uuid_utils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Programming Language :: Python
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -41,8 +41,8 @@ Python UUID implementation using Rust's UUID library.
|
|
|
41
41
|
This will make `uuid4` function around 10x faster.
|
|
42
42
|
|
|
43
43
|
This package can be a drop-in replacement to the standard library UUID
|
|
44
|
-
which implements existing UUID versions like
|
|
45
|
-
and also adds draft UUID versions like
|
|
44
|
+
which implements existing UUID versions like v4 in Rust
|
|
45
|
+
and also adds draft UUID versions like v6.
|
|
46
46
|
|
|
47
47
|
Avaialble UUID versions:
|
|
48
48
|
|
|
@@ -57,10 +57,15 @@ Avaialble UUID versions:
|
|
|
57
57
|
<sup>Please note that UUID versions 6, 7 and 8 are still in draft RFC.</sup><br>
|
|
58
58
|
|
|
59
59
|
## Installation
|
|
60
|
-
|
|
60
|
+
Using `pip`:
|
|
61
61
|
```shell
|
|
62
62
|
$ pip install uuid-utils
|
|
63
63
|
```
|
|
64
|
+
or, using `conda`:
|
|
65
|
+
|
|
66
|
+
```shell
|
|
67
|
+
$ conda install -c conda-forge uuid-utils
|
|
68
|
+
```
|
|
64
69
|
|
|
65
70
|
## Example
|
|
66
71
|
|
|
@@ -84,12 +89,12 @@ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
|
|
|
84
89
|
UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
|
|
85
90
|
```
|
|
86
91
|
|
|
87
|
-
##
|
|
92
|
+
## Compatibility
|
|
88
93
|
|
|
89
|
-
In some cases you might need `UUID` instances to be returned
|
|
94
|
+
In some cases, for example if you are using `Django`, you might need `UUID` instances to be returned
|
|
90
95
|
from the standrad-library `uuid`, not a custom `UUID` class.
|
|
91
96
|
In that case you can use the `uuid_utils.compat` which comes with a performance penalty
|
|
92
|
-
in comparison with the `uuid_utils` default behaviour, but still faster than the standard-library.
|
|
97
|
+
in comparison with the `uuid_utils` default behaviour, but is still faster than the standard-library.
|
|
93
98
|
|
|
94
99
|
```py
|
|
95
100
|
>>> import uuid_utils.compat as uuid
|
|
@@ -101,16 +106,16 @@ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
|
|
|
101
106
|
|
|
102
107
|
## Benchmarks
|
|
103
108
|
|
|
104
|
-
|
|
|
105
|
-
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
| UUID from bytes
|
|
112
|
-
|
|
|
113
|
-
| UUID from fields | 0.028
|
|
109
|
+
| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
|
|
110
|
+
| ---------------- | ----- | ----- | ----- | ------------- | ------------- | ------------- |
|
|
111
|
+
| UUID v1 | 0.058 | 0.059 | 0.058 | 0.005 (12.0x) | 0.005 (11.9x) | 0.005 (12.0x) |
|
|
112
|
+
| UUID v3 | 0.063 | 0.064 | 0.063 | 0.008 (7.9x) | 0.008 (8.1x) | 0.008 (8.0x) |
|
|
113
|
+
| UUID v4 | 0.041 | 0.041 | 0.041 | 0.004 (11.1x) | 0.004 (10.8x) | 0.004 (10.9x) |
|
|
114
|
+
| UUID v5 | 0.064 | 0.066 | 0.065 | 0.008 (8.1x) | 0.008 (8.1x) | 0.008 (8.1x) |
|
|
115
|
+
| UUID from hex | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.6x) |
|
|
116
|
+
| UUID from bytes | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.7x) |
|
|
117
|
+
| UUID from int | 0.024 | 0.025 | 0.024 | 0.004 (6.6x) | 0.004 (6.7x) | 0.004 (6.6x) |
|
|
118
|
+
| UUID from fields | 0.028 | 0.028 | 0.028 | 0.009 (3.1x) | 0.009 (3.1x) | 0.009 (3.1x) |
|
|
114
119
|
|
|
115
120
|
## How to develop locally
|
|
116
121
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
uuid_utils-0.9.0.dist-info/METADATA,sha256=mxwKWe--g0Dxq9rmFlHP7Fe-dGiecGqGyW7gBZd5azc,4644
|
|
2
|
+
uuid_utils-0.9.0.dist-info/WHEEL,sha256=IIOAy2nyU09fJd9TV8gHoOW5zRDP_OFdGvvd63Smv7Y,121
|
|
3
|
+
uuid_utils-0.9.0.dist-info/license_files/LICENSE.md,sha256=DEf1K0xIS9BMeOfJaVQu6jGv5kT1h_O4qMzOhjUsYEY,1487
|
|
4
|
+
uuid_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
uuid_utils/__init__.pyi,sha256=-Ar3_QVwpdIGtIWW-JuPVCoh-cN26YesW1X6l81WR4g,6627
|
|
6
|
+
uuid_utils/compat/__init__.pyi,sha256=Qv8zmz1maatMXQ9Q_f9dkm8YUJoj4VaMUll_DR_SyM4,2259
|
|
7
|
+
uuid_utils/compat/__init__.py,sha256=-pGwZJmEoRzNmqteXXtcbjzO7KO3-xekYT02GjImtmM,2071
|
|
8
|
+
uuid_utils/__init__.py,sha256=teEvYB7oh34wISOjZYdA011-7VdeLKfQGjR615_-lCc,622
|
|
9
|
+
uuid_utils/_uuid_utils.cpython-310-i386-linux-gnu.so,sha256=NHv7uleKZd3q5Gb4kw8KRDHrEvXIYBQQNfFU3-WdhF8,703672
|
|
10
|
+
uuid_utils-0.9.0.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
uuid_utils-0.7.0.dist-info/METADATA,sha256=XpVI7UmfHTsaPEOz1jRzrKQs_8jnpcz8o6G0mRjX3h8,4625
|
|
2
|
-
uuid_utils-0.7.0.dist-info/WHEEL,sha256=GgttKTxmcVRZ2H_jvZt8pARpZrYvqX6iR_giZ_wRyJM,121
|
|
3
|
-
uuid_utils-0.7.0.dist-info/license_files/LICENSE.md,sha256=DEf1K0xIS9BMeOfJaVQu6jGv5kT1h_O4qMzOhjUsYEY,1487
|
|
4
|
-
uuid_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
uuid_utils/__init__.py,sha256=teEvYB7oh34wISOjZYdA011-7VdeLKfQGjR615_-lCc,622
|
|
6
|
-
uuid_utils/__init__.pyi,sha256=JNQmgdNecusC7zFZiZTosO9d08yGm3sOCITC6PHF2P4,6058
|
|
7
|
-
uuid_utils/compat/__init__.py,sha256=-pGwZJmEoRzNmqteXXtcbjzO7KO3-xekYT02GjImtmM,2071
|
|
8
|
-
uuid_utils/compat/__init__.pyi,sha256=msxBDRkxWjdSRFmCeP2O2J6pib2qkJoZEaoC5hcF8X8,1425
|
|
9
|
-
uuid_utils/_uuid_utils.cpython-310-i386-linux-gnu.so,sha256=OT9auE0G8NciFPLQzNqayfY4CjW_9_iY6be5bpEecpE,3702464
|
|
10
|
-
uuid_utils-0.7.0.dist-info/RECORD,,
|
|
File without changes
|