uuid-utils 0.6.1__tar.gz → 0.7.0__tar.gz
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-0.6.1 → uuid_utils-0.7.0}/.github/workflows/ci.yml +10 -22
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/Cargo.lock +57 -39
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/Cargo.toml +4 -4
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/PKG-INFO +18 -4
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/README.md +15 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/pyproject.toml +1 -2
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/python/uuid_utils/__init__.pyi +1 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/python/uuid_utils/compat/__init__.py +39 -8
- uuid_utils-0.7.0/requirements.txt +5 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/src/lib.rs +9 -9
- uuid_utils-0.6.1/requirements.txt +0 -5
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/.gitignore +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/LICENSE.md +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/Makefile +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/benchmarks/README.md +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/benchmarks/bench_generator.py +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/benchmarks/bench_parser.py +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/python/uuid_utils/__init__.py +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/python/uuid_utils/compat/__init__.pyi +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/python/uuid_utils/py.typed +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/tests/__init__.py +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/tests/test_compat/__init__.py +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/tests/test_compat/test_compat.py +0 -0
- {uuid_utils-0.6.1 → uuid_utils-0.7.0}/tests/test_uuid.py +0 -0
|
@@ -47,7 +47,7 @@ jobs:
|
|
|
47
47
|
uses: PyO3/maturin-action@v1
|
|
48
48
|
with:
|
|
49
49
|
target: ${{ matrix.target }}
|
|
50
|
-
args: --release --out dist -i 3.
|
|
50
|
+
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
|
|
51
51
|
sccache: "true"
|
|
52
52
|
manylinux: auto
|
|
53
53
|
- name: Install and test
|
|
@@ -79,8 +79,8 @@ jobs:
|
|
|
79
79
|
rust-toolchain: stable
|
|
80
80
|
target: ${{ matrix.target }}
|
|
81
81
|
manylinux: auto
|
|
82
|
-
args: --release --out dist -i 3.
|
|
83
|
-
- uses: uraimo/run-on-arch-action@v2.
|
|
82
|
+
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
|
|
83
|
+
- uses: uraimo/run-on-arch-action@v2.7.2
|
|
84
84
|
if: matrix.target != 'ppc64'
|
|
85
85
|
name: Install built wheel
|
|
86
86
|
with:
|
|
@@ -120,7 +120,7 @@ jobs:
|
|
|
120
120
|
rust-toolchain: stable
|
|
121
121
|
target: ${{ matrix.target }}
|
|
122
122
|
manylinux: musllinux_1_2
|
|
123
|
-
args: --release --out dist -i 3.
|
|
123
|
+
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
|
|
124
124
|
- name: Install built wheel
|
|
125
125
|
if: matrix.target == 'x86_64-unknown-linux-musl'
|
|
126
126
|
uses: addnab/docker-run-action@v3
|
|
@@ -130,8 +130,8 @@ jobs:
|
|
|
130
130
|
run: |
|
|
131
131
|
apk add py3-pip
|
|
132
132
|
pip3 install -U pip pytest
|
|
133
|
-
pip3 install uuid_utils --no-index --find-links /io/dist/ --force-reinstall
|
|
134
|
-
python3 -
|
|
133
|
+
pip3 install uuid_utils --no-index --find-links /io/dist/ --force-reinstall --break-system-packages
|
|
134
|
+
python3 -c "import uuid_utils"
|
|
135
135
|
- name: Upload wheels
|
|
136
136
|
uses: actions/upload-artifact@v3
|
|
137
137
|
with:
|
|
@@ -157,19 +157,7 @@ jobs:
|
|
|
157
157
|
rust-toolchain: stable
|
|
158
158
|
target: ${{ matrix.platform.target }}
|
|
159
159
|
manylinux: musllinux_1_2
|
|
160
|
-
args: --release --out dist -i 3.
|
|
161
|
-
- uses: uraimo/run-on-arch-action@v2.3.0
|
|
162
|
-
name: Install built wheel
|
|
163
|
-
with:
|
|
164
|
-
arch: ${{ matrix.platform.arch }}
|
|
165
|
-
distro: alpine_latest
|
|
166
|
-
githubToken: ${{ github.token }}
|
|
167
|
-
install: |
|
|
168
|
-
apk add py3-pip
|
|
169
|
-
pip3 install -U pip pytest
|
|
170
|
-
run: |
|
|
171
|
-
pip3 install uuid_utils --no-index --find-links dist/ --force-reinstall
|
|
172
|
-
python3 -m pytest -v .
|
|
160
|
+
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
|
|
173
161
|
- name: Upload wheels
|
|
174
162
|
uses: actions/upload-artifact@v3
|
|
175
163
|
with:
|
|
@@ -183,9 +171,9 @@ jobs:
|
|
|
183
171
|
matrix:
|
|
184
172
|
platform:
|
|
185
173
|
- target: x64
|
|
186
|
-
interpreter: 3.
|
|
174
|
+
interpreter: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
|
|
187
175
|
- target: x86
|
|
188
|
-
interpreter: 3.
|
|
176
|
+
interpreter: 3.8 3.9 3.10 3.11
|
|
189
177
|
steps:
|
|
190
178
|
- uses: actions/checkout@v3
|
|
191
179
|
- uses: actions/setup-python@v4
|
|
@@ -223,7 +211,7 @@ jobs:
|
|
|
223
211
|
uses: PyO3/maturin-action@v1
|
|
224
212
|
with:
|
|
225
213
|
target: x86_64
|
|
226
|
-
args: --release --out dist -i 3.
|
|
214
|
+
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
|
|
227
215
|
sccache: "true"
|
|
228
216
|
- name: Build wheels - universal2
|
|
229
217
|
uses: PyO3/maturin-action@v1
|
|
@@ -20,6 +20,12 @@ version = "1.3.2"
|
|
|
20
20
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
21
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
22
22
|
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "bitflags"
|
|
25
|
+
version = "2.5.0"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
|
28
|
+
|
|
23
29
|
[[package]]
|
|
24
30
|
name = "block-buffer"
|
|
25
31
|
version = "0.10.4"
|
|
@@ -44,6 +50,12 @@ version = "1.0.0"
|
|
|
44
50
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
51
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
46
52
|
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "cfg_aliases"
|
|
55
|
+
version = "0.1.1"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
|
58
|
+
|
|
47
59
|
[[package]]
|
|
48
60
|
name = "crypto-common"
|
|
49
61
|
version = "0.1.6"
|
|
@@ -85,17 +97,23 @@ dependencies = [
|
|
|
85
97
|
"wasi",
|
|
86
98
|
]
|
|
87
99
|
|
|
100
|
+
[[package]]
|
|
101
|
+
name = "heck"
|
|
102
|
+
version = "0.4.1"
|
|
103
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
104
|
+
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|
105
|
+
|
|
88
106
|
[[package]]
|
|
89
107
|
name = "indoc"
|
|
90
|
-
version = "
|
|
108
|
+
version = "2.0.5"
|
|
91
109
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
92
|
-
checksum = "
|
|
110
|
+
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
|
93
111
|
|
|
94
112
|
[[package]]
|
|
95
113
|
name = "libc"
|
|
96
|
-
version = "0.2.
|
|
114
|
+
version = "0.2.154"
|
|
97
115
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
98
|
-
checksum = "
|
|
116
|
+
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
|
|
99
117
|
|
|
100
118
|
[[package]]
|
|
101
119
|
name = "lock_api"
|
|
@@ -109,9 +127,9 @@ dependencies = [
|
|
|
109
127
|
|
|
110
128
|
[[package]]
|
|
111
129
|
name = "mac_address"
|
|
112
|
-
version = "1.1.
|
|
130
|
+
version = "1.1.6"
|
|
113
131
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
114
|
-
checksum = "
|
|
132
|
+
checksum = "5aa12182b93606fff55b70a5cfe6130eaf7407c2ea4f2c2bcc8b113b67c9928f"
|
|
115
133
|
dependencies = [
|
|
116
134
|
"nix",
|
|
117
135
|
"winapi",
|
|
@@ -127,15 +145,6 @@ dependencies = [
|
|
|
127
145
|
"digest",
|
|
128
146
|
]
|
|
129
147
|
|
|
130
|
-
[[package]]
|
|
131
|
-
name = "memoffset"
|
|
132
|
-
version = "0.6.5"
|
|
133
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
134
|
-
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
|
135
|
-
dependencies = [
|
|
136
|
-
"autocfg",
|
|
137
|
-
]
|
|
138
|
-
|
|
139
148
|
[[package]]
|
|
140
149
|
name = "memoffset"
|
|
141
150
|
version = "0.9.0"
|
|
@@ -147,15 +156,15 @@ dependencies = [
|
|
|
147
156
|
|
|
148
157
|
[[package]]
|
|
149
158
|
name = "nix"
|
|
150
|
-
version = "0.
|
|
159
|
+
version = "0.28.0"
|
|
151
160
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
152
|
-
checksum = "
|
|
161
|
+
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
|
153
162
|
dependencies = [
|
|
154
|
-
"bitflags",
|
|
155
|
-
"cc",
|
|
163
|
+
"bitflags 2.5.0",
|
|
156
164
|
"cfg-if",
|
|
165
|
+
"cfg_aliases",
|
|
157
166
|
"libc",
|
|
158
|
-
"memoffset
|
|
167
|
+
"memoffset",
|
|
159
168
|
]
|
|
160
169
|
|
|
161
170
|
[[package]]
|
|
@@ -187,6 +196,12 @@ dependencies = [
|
|
|
187
196
|
"windows-targets",
|
|
188
197
|
]
|
|
189
198
|
|
|
199
|
+
[[package]]
|
|
200
|
+
name = "portable-atomic"
|
|
201
|
+
version = "1.6.0"
|
|
202
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
203
|
+
checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
|
|
204
|
+
|
|
190
205
|
[[package]]
|
|
191
206
|
name = "ppv-lite86"
|
|
192
207
|
version = "0.2.17"
|
|
@@ -204,15 +219,16 @@ dependencies = [
|
|
|
204
219
|
|
|
205
220
|
[[package]]
|
|
206
221
|
name = "pyo3"
|
|
207
|
-
version = "0.
|
|
222
|
+
version = "0.21.2"
|
|
208
223
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
209
|
-
checksum = "
|
|
224
|
+
checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
|
|
210
225
|
dependencies = [
|
|
211
226
|
"cfg-if",
|
|
212
227
|
"indoc",
|
|
213
228
|
"libc",
|
|
214
|
-
"memoffset
|
|
229
|
+
"memoffset",
|
|
215
230
|
"parking_lot",
|
|
231
|
+
"portable-atomic",
|
|
216
232
|
"pyo3-build-config",
|
|
217
233
|
"pyo3-ffi",
|
|
218
234
|
"pyo3-macros",
|
|
@@ -221,9 +237,9 @@ dependencies = [
|
|
|
221
237
|
|
|
222
238
|
[[package]]
|
|
223
239
|
name = "pyo3-build-config"
|
|
224
|
-
version = "0.
|
|
240
|
+
version = "0.21.2"
|
|
225
241
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
226
|
-
checksum = "
|
|
242
|
+
checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
|
|
227
243
|
dependencies = [
|
|
228
244
|
"once_cell",
|
|
229
245
|
"python3-dll-a",
|
|
@@ -232,9 +248,9 @@ dependencies = [
|
|
|
232
248
|
|
|
233
249
|
[[package]]
|
|
234
250
|
name = "pyo3-ffi"
|
|
235
|
-
version = "0.
|
|
251
|
+
version = "0.21.2"
|
|
236
252
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
237
|
-
checksum = "
|
|
253
|
+
checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
|
|
238
254
|
dependencies = [
|
|
239
255
|
"libc",
|
|
240
256
|
"pyo3-build-config",
|
|
@@ -242,9 +258,9 @@ dependencies = [
|
|
|
242
258
|
|
|
243
259
|
[[package]]
|
|
244
260
|
name = "pyo3-macros"
|
|
245
|
-
version = "0.
|
|
261
|
+
version = "0.21.2"
|
|
246
262
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
-
checksum = "
|
|
263
|
+
checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
|
|
248
264
|
dependencies = [
|
|
249
265
|
"proc-macro2",
|
|
250
266
|
"pyo3-macros-backend",
|
|
@@ -254,11 +270,13 @@ dependencies = [
|
|
|
254
270
|
|
|
255
271
|
[[package]]
|
|
256
272
|
name = "pyo3-macros-backend"
|
|
257
|
-
version = "0.
|
|
273
|
+
version = "0.21.2"
|
|
258
274
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
259
|
-
checksum = "
|
|
275
|
+
checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
|
|
260
276
|
dependencies = [
|
|
277
|
+
"heck",
|
|
261
278
|
"proc-macro2",
|
|
279
|
+
"pyo3-build-config",
|
|
262
280
|
"quote",
|
|
263
281
|
"syn",
|
|
264
282
|
]
|
|
@@ -317,7 +335,7 @@ version = "0.3.5"
|
|
|
317
335
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
318
336
|
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
|
319
337
|
dependencies = [
|
|
320
|
-
"bitflags",
|
|
338
|
+
"bitflags 1.3.2",
|
|
321
339
|
]
|
|
322
340
|
|
|
323
341
|
[[package]]
|
|
@@ -340,9 +358,9 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
|
|
|
340
358
|
|
|
341
359
|
[[package]]
|
|
342
360
|
name = "syn"
|
|
343
|
-
version = "
|
|
361
|
+
version = "2.0.43"
|
|
344
362
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
345
|
-
checksum = "
|
|
363
|
+
checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53"
|
|
346
364
|
dependencies = [
|
|
347
365
|
"proc-macro2",
|
|
348
366
|
"quote",
|
|
@@ -369,15 +387,15 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
|
|
369
387
|
|
|
370
388
|
[[package]]
|
|
371
389
|
name = "unindent"
|
|
372
|
-
version = "0.
|
|
390
|
+
version = "0.2.3"
|
|
373
391
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
374
|
-
checksum = "
|
|
392
|
+
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
|
|
375
393
|
|
|
376
394
|
[[package]]
|
|
377
395
|
name = "uuid"
|
|
378
|
-
version = "1.
|
|
396
|
+
version = "1.8.0"
|
|
379
397
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
380
|
-
checksum = "
|
|
398
|
+
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
|
|
381
399
|
dependencies = [
|
|
382
400
|
"atomic",
|
|
383
401
|
"getrandom",
|
|
@@ -388,7 +406,7 @@ dependencies = [
|
|
|
388
406
|
|
|
389
407
|
[[package]]
|
|
390
408
|
name = "uuid-utils"
|
|
391
|
-
version = "0.
|
|
409
|
+
version = "0.7.0"
|
|
392
410
|
dependencies = [
|
|
393
411
|
"mac_address",
|
|
394
412
|
"pyo3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "uuid-utils"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.7.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
|
|
6
6
|
[lib]
|
|
@@ -8,7 +8,7 @@ name = "uuid_utils"
|
|
|
8
8
|
crate-type = ["cdylib"]
|
|
9
9
|
|
|
10
10
|
[dependencies]
|
|
11
|
-
mac_address = "1.1.
|
|
12
|
-
pyo3 = { version = "0.
|
|
11
|
+
mac_address = "1.1.6"
|
|
12
|
+
pyo3 = { version = "0.21.2", features = ["extension-module", "generate-import-lib"] }
|
|
13
13
|
rand = "0.8.5"
|
|
14
|
-
uuid = { version = "1.
|
|
14
|
+
uuid = { version = "1.8.0", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: uuid_utils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Programming Language :: Python
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
7
7
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
9
8
|
Classifier: Programming Language :: Python :: 3.8
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -19,7 +18,7 @@ License-File: LICENSE.md
|
|
|
19
18
|
Summary: Drop-in replacement for Python UUID in Rust
|
|
20
19
|
Keywords: rust,uuid
|
|
21
20
|
Author-email: Amin Alaee <me@aminalaee.dev>
|
|
22
|
-
Requires-Python: >=3.
|
|
21
|
+
Requires-Python: >=3.8
|
|
23
22
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
24
23
|
Project-URL: Documentation, https://github.com/aminalaee/uuid-utils
|
|
25
24
|
Project-URL: Issues, https://github.com/aminalaee/uuid-utils/issues
|
|
@@ -85,6 +84,21 @@ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
|
|
|
85
84
|
UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
|
|
86
85
|
```
|
|
87
86
|
|
|
87
|
+
## Compat module
|
|
88
|
+
|
|
89
|
+
In some cases you might need `UUID` instances to be returned
|
|
90
|
+
from the standrad-library `uuid`, not a custom `UUID` class.
|
|
91
|
+
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.
|
|
93
|
+
|
|
94
|
+
```py
|
|
95
|
+
>>> import uuid_utils.compat as uuid
|
|
96
|
+
|
|
97
|
+
>>> # make a random UUID
|
|
98
|
+
>>> uuid.uuid4()
|
|
99
|
+
UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
|
|
100
|
+
```
|
|
101
|
+
|
|
88
102
|
## Benchmarks
|
|
89
103
|
|
|
90
104
|
| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
|
|
@@ -58,6 +58,21 @@ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
|
|
|
58
58
|
UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
## Compat module
|
|
62
|
+
|
|
63
|
+
In some cases you might need `UUID` instances to be returned
|
|
64
|
+
from the standrad-library `uuid`, not a custom `UUID` class.
|
|
65
|
+
In that case you can use the `uuid_utils.compat` which comes with a performance penalty
|
|
66
|
+
in comparison with the `uuid_utils` default behaviour, but still faster than the standard-library.
|
|
67
|
+
|
|
68
|
+
```py
|
|
69
|
+
>>> import uuid_utils.compat as uuid
|
|
70
|
+
|
|
71
|
+
>>> # make a random UUID
|
|
72
|
+
>>> uuid.uuid4()
|
|
73
|
+
UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
|
|
74
|
+
```
|
|
75
|
+
|
|
61
76
|
## Benchmarks
|
|
62
77
|
|
|
63
78
|
| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
|
|
@@ -7,13 +7,12 @@ name = "uuid_utils"
|
|
|
7
7
|
description = "Drop-in replacement for Python UUID in Rust"
|
|
8
8
|
authors = [{ name = "Amin Alaee", email = "me@aminalaee.dev" }]
|
|
9
9
|
keywords = ["rust", "uuid"]
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
11
|
classifiers = [
|
|
12
12
|
"Development Status :: 3 - Alpha",
|
|
13
13
|
"Programming Language :: Python",
|
|
14
14
|
"Programming Language :: Python :: 3",
|
|
15
15
|
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
-
"Programming Language :: Python :: 3.7",
|
|
17
16
|
"Programming Language :: Python :: 3.8",
|
|
18
17
|
"Programming Language :: Python :: 3.9",
|
|
19
18
|
"Programming Language :: Python :: 3.10",
|
|
@@ -1,31 +1,62 @@
|
|
|
1
|
-
import
|
|
1
|
+
from uuid import (
|
|
2
|
+
NAMESPACE_DNS,
|
|
3
|
+
NAMESPACE_OID,
|
|
4
|
+
NAMESPACE_URL,
|
|
5
|
+
NAMESPACE_X500,
|
|
6
|
+
RESERVED_FUTURE,
|
|
7
|
+
RESERVED_MICROSOFT,
|
|
8
|
+
RESERVED_NCS,
|
|
9
|
+
RFC_4122,
|
|
10
|
+
UUID,
|
|
11
|
+
getnode,
|
|
12
|
+
)
|
|
2
13
|
|
|
3
14
|
import uuid_utils
|
|
4
15
|
|
|
16
|
+
__all__ = [
|
|
17
|
+
"NAMESPACE_DNS",
|
|
18
|
+
"NAMESPACE_OID",
|
|
19
|
+
"NAMESPACE_URL",
|
|
20
|
+
"NAMESPACE_X500",
|
|
21
|
+
"RESERVED_FUTURE",
|
|
22
|
+
"RESERVED_MICROSOFT",
|
|
23
|
+
"RESERVED_NCS",
|
|
24
|
+
"RFC_4122",
|
|
25
|
+
"UUID",
|
|
26
|
+
"getnode",
|
|
27
|
+
"uuid1",
|
|
28
|
+
"uuid3",
|
|
29
|
+
"uuid4",
|
|
30
|
+
"uuid5",
|
|
31
|
+
"uuid6",
|
|
32
|
+
"uuid7",
|
|
33
|
+
"uuid8",
|
|
34
|
+
]
|
|
35
|
+
|
|
5
36
|
|
|
6
37
|
def uuid1(node=None, clock_seq=None):
|
|
7
38
|
"""Generate a UUID from a host ID, sequence number, and the current time.
|
|
8
39
|
If 'node' is not given, getnode() is used to obtain the hardware
|
|
9
40
|
address. If 'clock_seq' is given, it is used as the sequence number;
|
|
10
41
|
otherwise a random 14-bit sequence number is chosen."""
|
|
11
|
-
return
|
|
42
|
+
return UUID(int=uuid_utils.uuid1(node, clock_seq).int)
|
|
12
43
|
|
|
13
44
|
|
|
14
45
|
def uuid3(namespace, name):
|
|
15
46
|
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
|
|
16
47
|
namespace = uuid_utils.UUID(namespace.hex) if namespace else namespace
|
|
17
|
-
return
|
|
48
|
+
return UUID(int=uuid_utils.uuid3(namespace, name).int)
|
|
18
49
|
|
|
19
50
|
|
|
20
51
|
def uuid4():
|
|
21
52
|
"""Generate a random UUID."""
|
|
22
|
-
return
|
|
53
|
+
return UUID(int=uuid_utils.uuid4().int)
|
|
23
54
|
|
|
24
55
|
|
|
25
56
|
def uuid5(namespace, name):
|
|
26
57
|
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
|
|
27
58
|
namespace = uuid_utils.UUID(namespace.hex) if namespace else namespace
|
|
28
|
-
return
|
|
59
|
+
return UUID(int=uuid_utils.uuid5(namespace, name).int)
|
|
29
60
|
|
|
30
61
|
|
|
31
62
|
def uuid6(node=None, timestamp=None):
|
|
@@ -33,14 +64,14 @@ def uuid6(node=None, timestamp=None):
|
|
|
33
64
|
This is similar to version 1 UUIDs,
|
|
34
65
|
except that it is lexicographically sortable by timestamp.
|
|
35
66
|
"""
|
|
36
|
-
return
|
|
67
|
+
return UUID(int=uuid_utils.uuid6(node, timestamp).int)
|
|
37
68
|
|
|
38
69
|
|
|
39
70
|
def uuid7(timestamp=None):
|
|
40
71
|
"""Generate a version 7 UUID using a time value and random bytes."""
|
|
41
|
-
return
|
|
72
|
+
return UUID(int=uuid_utils.uuid7(timestamp).int)
|
|
42
73
|
|
|
43
74
|
|
|
44
75
|
def uuid8(bytes):
|
|
45
76
|
"""Generate a custom UUID comprised almost entirely of user-supplied bytes.."""
|
|
46
|
-
return
|
|
77
|
+
return UUID(bytes=uuid_utils.uuid8(bytes).bytes)
|
|
@@ -42,8 +42,8 @@ impl UUID {
|
|
|
42
42
|
#[new]
|
|
43
43
|
fn new(
|
|
44
44
|
hex: Option<&str>,
|
|
45
|
-
bytes: Option<&PyBytes
|
|
46
|
-
bytes_le: Option<&PyBytes
|
|
45
|
+
bytes: Option<&Bound<'_, PyBytes>>,
|
|
46
|
+
bytes_le: Option<&Bound<'_, PyBytes>>,
|
|
47
47
|
fields: Option<(u32, u16, u16, u8, u8, u64)>,
|
|
48
48
|
int: Option<u128>,
|
|
49
49
|
version: Option<u8>,
|
|
@@ -124,7 +124,7 @@ impl UUID {
|
|
|
124
124
|
(self.__str__(),)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
pub fn __deepcopy__(&self, py: Python, _memo: &PyDict) -> Py<PyAny> {
|
|
127
|
+
pub fn __deepcopy__(&self, py: Python, _memo: &Bound<'_, PyDict>) -> Py<PyAny> {
|
|
128
128
|
self.clone().into_py(py)
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -139,13 +139,13 @@ impl UUID {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
#[getter]
|
|
142
|
-
fn bytes_le<'py>(&self, py: Python<'py>) ->
|
|
142
|
+
fn bytes_le<'py>(&self, py: Python<'py>) -> Bound<'py, PyBytes> {
|
|
143
143
|
let bytes = *self.uuid.as_bytes();
|
|
144
144
|
let bytes = [
|
|
145
145
|
bytes[3], bytes[2], bytes[1], bytes[0], bytes[5], bytes[4], bytes[7], bytes[6],
|
|
146
146
|
bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15],
|
|
147
147
|
];
|
|
148
|
-
PyBytes::
|
|
148
|
+
PyBytes::new_bound(py, &bytes)
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
#[getter]
|
|
@@ -255,7 +255,7 @@ impl UUID {
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
#[staticmethod]
|
|
258
|
-
fn from_bytes(bytes: &PyBytes) -> PyResult<UUID> {
|
|
258
|
+
fn from_bytes(bytes: &Bound<'_, PyBytes>) -> PyResult<UUID> {
|
|
259
259
|
let bytes: Bytes = bytes.extract()?;
|
|
260
260
|
Ok(UUID {
|
|
261
261
|
uuid: Uuid::from_bytes(bytes),
|
|
@@ -263,7 +263,7 @@ impl UUID {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
#[staticmethod]
|
|
266
|
-
fn from_bytes_le(bytes: &PyBytes) -> PyResult<UUID> {
|
|
266
|
+
fn from_bytes_le(bytes: &Bound<'_, PyBytes>) -> PyResult<UUID> {
|
|
267
267
|
let bytes: Bytes = bytes.extract()?;
|
|
268
268
|
Ok(UUID {
|
|
269
269
|
uuid: Uuid::from_bytes_le(bytes),
|
|
@@ -372,7 +372,7 @@ fn uuid7(timestamp: Option<u64>) -> PyResult<UUID> {
|
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
#[pyfunction]
|
|
375
|
-
fn uuid8(bytes: &PyBytes) -> PyResult<UUID> {
|
|
375
|
+
fn uuid8(bytes: &Bound<'_, PyBytes>) -> PyResult<UUID> {
|
|
376
376
|
let bytes: Bytes = bytes.extract()?;
|
|
377
377
|
Ok(UUID {
|
|
378
378
|
uuid: Uuid::new_v8(bytes),
|
|
@@ -411,7 +411,7 @@ fn getnode() -> PyResult<u64> {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
#[pymodule]
|
|
414
|
-
fn _uuid_utils(
|
|
414
|
+
fn _uuid_utils(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
415
415
|
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
|
|
416
416
|
m.add_class::<UUID>()?;
|
|
417
417
|
m.add_function(wrap_pyfunction!(uuid1, m)?)?;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|