uuid-utils 0.6.1__tar.gz → 0.8.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.

Files changed (28) hide show
  1. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/.github/workflows/ci.yml +28 -32
  2. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/Cargo.lock +57 -39
  3. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/Cargo.toml +4 -4
  4. uuid_utils-0.8.0/Makefile +39 -0
  5. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/PKG-INFO +36 -17
  6. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/README.md +33 -13
  7. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/benchmarks/bench_generator.py +4 -4
  8. uuid_utils-0.8.0/docs/api.md +27 -0
  9. uuid_utils-0.8.0/docs/index.md +105 -0
  10. uuid_utils-0.8.0/mkdocs.yml +45 -0
  11. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/pyproject.toml +10 -5
  12. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/python/uuid_utils/__init__.pyi +27 -11
  13. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/python/uuid_utils/compat/__init__.py +39 -8
  14. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/python/uuid_utils/compat/__init__.pyi +45 -7
  15. uuid_utils-0.8.0/requirements.txt +5 -0
  16. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/src/lib.rs +41 -21
  17. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/tests/test_compat/test_compat.py +0 -1
  18. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/tests/test_uuid.py +19 -5
  19. uuid_utils-0.6.1/Makefile +0 -28
  20. uuid_utils-0.6.1/requirements.txt +0 -5
  21. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/.gitignore +0 -0
  22. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/LICENSE.md +0 -0
  23. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/benchmarks/README.md +0 -0
  24. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/benchmarks/bench_parser.py +0 -0
  25. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/python/uuid_utils/__init__.py +0 -0
  26. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/python/uuid_utils/py.typed +0 -0
  27. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/tests/__init__.py +0 -0
  28. {uuid_utils-0.6.1 → uuid_utils-0.8.0}/tests/test_compat/__init__.py +0 -0
@@ -8,9 +8,6 @@ on:
8
8
  - "*"
9
9
  pull_request:
10
10
 
11
- permissions:
12
- contents: read
13
-
14
11
  env:
15
12
  RUSTFLAGS: "--cfg uuid_unstable"
16
13
 
@@ -26,28 +23,27 @@ jobs:
26
23
  - name: Install dependencies
27
24
  run: pip install -r requirements.txt
28
25
  - name: Check code
29
- run: |
30
- black --check --diff .
31
- isort --check --project=uuid_utils .
32
- mypy .
33
- ruff .
26
+ run: make lint
27
+ - name: Check docs
28
+ run: make docs_build
34
29
 
35
30
  linux:
36
- name: "Linux: ${{ matrix.target }}"
31
+ name: "Linux: ${{ matrix.target }} Python ${{ matrix.python-version }}"
37
32
  runs-on: ubuntu-latest
38
33
  strategy:
39
34
  matrix:
40
35
  target: [x86_64, i686]
36
+ python-version: ["3.10", "3.11", "3.12"]
41
37
  steps:
42
38
  - uses: actions/checkout@v3
43
39
  - uses: actions/setup-python@v4
44
40
  with:
45
- python-version: "3.11"
41
+ python-version: "${{ matrix.python-version }}"
46
42
  - name: Build wheels
47
43
  uses: PyO3/maturin-action@v1
48
44
  with:
49
45
  target: ${{ matrix.target }}
50
- args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
46
+ args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
51
47
  sccache: "true"
52
48
  manylinux: auto
53
49
  - name: Install and test
@@ -79,8 +75,8 @@ jobs:
79
75
  rust-toolchain: stable
80
76
  target: ${{ matrix.target }}
81
77
  manylinux: auto
82
- args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
83
- - uses: uraimo/run-on-arch-action@v2.3.0
78
+ args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
79
+ - uses: uraimo/run-on-arch-action@v2.7.2
84
80
  if: matrix.target != 'ppc64'
85
81
  name: Install built wheel
86
82
  with:
@@ -120,7 +116,7 @@ jobs:
120
116
  rust-toolchain: stable
121
117
  target: ${{ matrix.target }}
122
118
  manylinux: musllinux_1_2
123
- args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12
119
+ args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
124
120
  - name: Install built wheel
125
121
  if: matrix.target == 'x86_64-unknown-linux-musl'
126
122
  uses: addnab/docker-run-action@v3
@@ -130,8 +126,8 @@ jobs:
130
126
  run: |
131
127
  apk add py3-pip
132
128
  pip3 install -U pip pytest
133
- pip3 install uuid_utils --no-index --find-links /io/dist/ --force-reinstall
134
- python3 -m pytest -v
129
+ pip3 install uuid_utils --no-index --find-links /io/dist/ --force-reinstall --break-system-packages
130
+ python3 -c "import uuid_utils"
135
131
  - name: Upload wheels
136
132
  uses: actions/upload-artifact@v3
137
133
  with:
@@ -157,19 +153,7 @@ jobs:
157
153
  rust-toolchain: stable
158
154
  target: ${{ matrix.platform.target }}
159
155
  manylinux: musllinux_1_2
160
- args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12
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 .
156
+ args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
173
157
  - name: Upload wheels
174
158
  uses: actions/upload-artifact@v3
175
159
  with:
@@ -183,9 +167,9 @@ jobs:
183
167
  matrix:
184
168
  platform:
185
169
  - target: x64
186
- interpreter: 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
170
+ interpreter: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
187
171
  - target: x86
188
- interpreter: 3.7 3.8 3.9 3.10 3.11
172
+ interpreter: 3.8 3.9 3.10 3.11
189
173
  steps:
190
174
  - uses: actions/checkout@v3
191
175
  - uses: actions/setup-python@v4
@@ -223,7 +207,7 @@ jobs:
223
207
  uses: PyO3/maturin-action@v1
224
208
  with:
225
209
  target: x86_64
226
- args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
210
+ args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
227
211
  sccache: "true"
228
212
  - name: Build wheels - universal2
229
213
  uses: PyO3/maturin-action@v1
@@ -273,3 +257,15 @@ jobs:
273
257
  with:
274
258
  command: upload
275
259
  args: --skip-existing *
260
+
261
+ docs:
262
+ name: Publish docs
263
+ runs-on: ubuntu-latest
264
+ if: "startsWith(github.ref, 'refs/tags/')"
265
+ needs: [release]
266
+ steps:
267
+ - uses: actions/checkout@v3
268
+ - name: Build and publish docs
269
+ run: |
270
+ pip install -r requirements.txt
271
+ make docs_build && make docs_deploy
@@ -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 = "1.0.9"
108
+ version = "2.0.5"
91
109
  source = "registry+https://github.com/rust-lang/crates.io-index"
92
- checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
110
+ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
93
111
 
94
112
  [[package]]
95
113
  name = "libc"
96
- version = "0.2.148"
114
+ version = "0.2.154"
97
115
  source = "registry+https://github.com/rust-lang/crates.io-index"
98
- checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
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.5"
130
+ version = "1.1.6"
113
131
  source = "registry+https://github.com/rust-lang/crates.io-index"
114
- checksum = "4863ee94f19ed315bf3bc00299338d857d4b5bc856af375cc97d237382ad3856"
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.23.2"
159
+ version = "0.28.0"
151
160
  source = "registry+https://github.com/rust-lang/crates.io-index"
152
- checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
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 0.6.5",
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.19.2"
222
+ version = "0.21.2"
208
223
  source = "registry+https://github.com/rust-lang/crates.io-index"
209
- checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38"
224
+ checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
210
225
  dependencies = [
211
226
  "cfg-if",
212
227
  "indoc",
213
228
  "libc",
214
- "memoffset 0.9.0",
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.19.2"
240
+ version = "0.21.2"
225
241
  source = "registry+https://github.com/rust-lang/crates.io-index"
226
- checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5"
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.19.2"
251
+ version = "0.21.2"
236
252
  source = "registry+https://github.com/rust-lang/crates.io-index"
237
- checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9"
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.19.2"
261
+ version = "0.21.2"
246
262
  source = "registry+https://github.com/rust-lang/crates.io-index"
247
- checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1"
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.19.2"
273
+ version = "0.21.2"
258
274
  source = "registry+https://github.com/rust-lang/crates.io-index"
259
- checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536"
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 = "1.0.109"
361
+ version = "2.0.43"
344
362
  source = "registry+https://github.com/rust-lang/crates.io-index"
345
- checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
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.1.11"
390
+ version = "0.2.3"
373
391
  source = "registry+https://github.com/rust-lang/crates.io-index"
374
- checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
392
+ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
375
393
 
376
394
  [[package]]
377
395
  name = "uuid"
378
- version = "1.4.1"
396
+ version = "1.8.0"
379
397
  source = "registry+https://github.com/rust-lang/crates.io-index"
380
- checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d"
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.6.1"
409
+ version = "0.8.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.6.1"
3
+ version = "0.8.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.5"
12
- pyo3 = { version = "0.19.2", features = ["extension-module", "generate-import-lib"] }
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.4.1", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
14
+ uuid = { version = "1.8.0", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
@@ -0,0 +1,39 @@
1
+ .DEFAULT_GOAL := all
2
+
3
+ .PHONY: build
4
+ build:
5
+ RUSTFLAGS="--cfg uuid_unstable" maturin develop --release
6
+
7
+ .PHONY: format
8
+ format:
9
+ ruff check --fix python/ tests/
10
+ ruff format python/ tests/
11
+ cargo fmt
12
+
13
+ .PHONY: lint
14
+ lint:
15
+ ruff check python/ tests/
16
+ ruff format --check --diff python/ tests/
17
+ mypy python/ tests/
18
+ .PHONY: test
19
+ test:
20
+ pytest tests -vvv
21
+
22
+ .PHONY: bench
23
+ bench:
24
+ richbench benchmarks/
25
+
26
+ .PHONY: docs_build
27
+ docs_build:
28
+ mkdocs build
29
+
30
+ .PHONY: docs_serve
31
+ docs_serve:
32
+ mkdocs serve --dev-addr localhost:8080
33
+
34
+ .PHONY: docs_deploy
35
+ docs_deploy:
36
+ mkdocs gh-deploy --force
37
+
38
+ .PHONY: all
39
+ all: format build lint test
@@ -1,11 +1,10 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: uuid_utils
3
- Version: 0.6.1
3
+ Version: 0.8.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.7
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
@@ -42,8 +41,8 @@ Python UUID implementation using Rust's UUID library.
42
41
  This will make `uuid4` function around 10x faster.
43
42
 
44
43
  This package can be a drop-in replacement to the standard library UUID
45
- which implements existing UUID versions like V4 in Rust
46
- and also adds draft UUID versions like V6.
44
+ which implements existing UUID versions like v4 in Rust
45
+ and also adds draft UUID versions like v6.
47
46
 
48
47
  Avaialble UUID versions:
49
48
 
@@ -58,10 +57,15 @@ Avaialble UUID versions:
58
57
  <sup>Please note that UUID versions 6, 7 and 8 are still in draft RFC.</sup><br>
59
58
 
60
59
  ## Installation
61
-
60
+ Using `pip`:
62
61
  ```shell
63
62
  $ pip install uuid-utils
64
63
  ```
64
+ or, using `conda`:
65
+
66
+ ```shell
67
+ $ conda install -c conda-forge uuid-utils
68
+ ```
65
69
 
66
70
  ## Example
67
71
 
@@ -85,18 +89,33 @@ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
85
89
  UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
86
90
  ```
87
91
 
92
+ ## Compatibility
93
+
94
+ In some cases, for example if you are using `Django`, you might need `UUID` instances to be returned
95
+ from the standrad-library `uuid`, not a custom `UUID` class.
96
+ In that case you can use the `uuid_utils.compat` which comes with a performance penalty
97
+ in comparison with the `uuid_utils` default behaviour, but is still faster than the standard-library.
98
+
99
+ ```py
100
+ >>> import uuid_utils.compat as uuid
101
+
102
+ >>> # make a random UUID
103
+ >>> uuid.uuid4()
104
+ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
105
+ ```
106
+
88
107
  ## Benchmarks
89
108
 
90
- | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
91
- |-----------------|---------|---------|---------|-----------------|-----------------|-----------------|
92
- | UUID V1 | 0.058 | 0.059 | 0.058 | 0.005 (12.0x) | 0.005 (11.9x) | 0.005 (12.0x) |
93
- | UUID V3 | 0.063 | 0.064 | 0.063 | 0.008 (7.9x) | 0.008 (8.1x) | 0.008 (8.0x) |
94
- | UUID V4 | 0.041 | 0.041 | 0.041 | 0.004 (11.1x) | 0.004 (10.8x) | 0.004 (10.9x) |
95
- | UUID V5 | 0.064 | 0.066 | 0.065 | 0.008 (8.1x) | 0.008 (8.1x) | 0.008 (8.1x) |
96
- | UUID from hex | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.6x) |
97
- | UUID from bytes | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.7x) |
98
- | UUID from int | 0.024 | 0.025 | 0.024 | 0.004 (6.6x) | 0.004 (6.7x) | 0.004 (6.6x) |
99
- | UUID from fields | 0.028 | 0.028 | 0.028 | 0.009 (3.1x) | 0.009 (3.1x) | 0.009 (3.1x) |
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) |
100
119
 
101
120
  ## How to develop locally
102
121
 
@@ -15,8 +15,8 @@ Python UUID implementation using Rust's UUID library.
15
15
  This will make `uuid4` function around 10x faster.
16
16
 
17
17
  This package can be a drop-in replacement to the standard library UUID
18
- which implements existing UUID versions like V4 in Rust
19
- and also adds draft UUID versions like V6.
18
+ which implements existing UUID versions like v4 in Rust
19
+ and also adds draft UUID versions like v6.
20
20
 
21
21
  Avaialble UUID versions:
22
22
 
@@ -31,10 +31,15 @@ Avaialble UUID versions:
31
31
  <sup>Please note that UUID versions 6, 7 and 8 are still in draft RFC.</sup><br>
32
32
 
33
33
  ## Installation
34
-
34
+ Using `pip`:
35
35
  ```shell
36
36
  $ pip install uuid-utils
37
37
  ```
38
+ or, using `conda`:
39
+
40
+ ```shell
41
+ $ conda install -c conda-forge uuid-utils
42
+ ```
38
43
 
39
44
  ## Example
40
45
 
@@ -58,18 +63,33 @@ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
58
63
  UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
59
64
  ```
60
65
 
66
+ ## Compatibility
67
+
68
+ In some cases, for example if you are using `Django`, you might need `UUID` instances to be returned
69
+ from the standrad-library `uuid`, not a custom `UUID` class.
70
+ In that case you can use the `uuid_utils.compat` which comes with a performance penalty
71
+ in comparison with the `uuid_utils` default behaviour, but is still faster than the standard-library.
72
+
73
+ ```py
74
+ >>> import uuid_utils.compat as uuid
75
+
76
+ >>> # make a random UUID
77
+ >>> uuid.uuid4()
78
+ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
79
+ ```
80
+
61
81
  ## Benchmarks
62
82
 
63
- | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
64
- |-----------------|---------|---------|---------|-----------------|-----------------|-----------------|
65
- | UUID V1 | 0.058 | 0.059 | 0.058 | 0.005 (12.0x) | 0.005 (11.9x) | 0.005 (12.0x) |
66
- | UUID V3 | 0.063 | 0.064 | 0.063 | 0.008 (7.9x) | 0.008 (8.1x) | 0.008 (8.0x) |
67
- | UUID V4 | 0.041 | 0.041 | 0.041 | 0.004 (11.1x) | 0.004 (10.8x) | 0.004 (10.9x) |
68
- | UUID V5 | 0.064 | 0.066 | 0.065 | 0.008 (8.1x) | 0.008 (8.1x) | 0.008 (8.1x) |
69
- | UUID from hex | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.6x) |
70
- | UUID from bytes | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.7x) |
71
- | UUID from int | 0.024 | 0.025 | 0.024 | 0.004 (6.6x) | 0.004 (6.7x) | 0.004 (6.6x) |
72
- | UUID from fields | 0.028 | 0.028 | 0.028 | 0.009 (3.1x) | 0.009 (3.1x) | 0.009 (3.1x) |
83
+ | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
84
+ | ---------------- | ----- | ----- | ----- | ------------- | ------------- | ------------- |
85
+ | UUID v1 | 0.058 | 0.059 | 0.058 | 0.005 (12.0x) | 0.005 (11.9x) | 0.005 (12.0x) |
86
+ | UUID v3 | 0.063 | 0.064 | 0.063 | 0.008 (7.9x) | 0.008 (8.1x) | 0.008 (8.0x) |
87
+ | UUID v4 | 0.041 | 0.041 | 0.041 | 0.004 (11.1x) | 0.004 (10.8x) | 0.004 (10.9x) |
88
+ | UUID v5 | 0.064 | 0.066 | 0.065 | 0.008 (8.1x) | 0.008 (8.1x) | 0.008 (8.1x) |
89
+ | UUID from hex | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.6x) |
90
+ | UUID from bytes | 0.024 | 0.025 | 0.024 | 0.004 (6.7x) | 0.004 (6.6x) | 0.004 (6.7x) |
91
+ | UUID from int | 0.024 | 0.025 | 0.024 | 0.004 (6.6x) | 0.004 (6.7x) | 0.004 (6.6x) |
92
+ | UUID from fields | 0.028 | 0.028 | 0.028 | 0.009 (3.1x) | 0.009 (3.1x) | 0.009 (3.1x) |
73
93
 
74
94
  ## How to develop locally
75
95
 
@@ -46,8 +46,8 @@ def uuid_utils_uuid5() -> None:
46
46
 
47
47
 
48
48
  __benchmarks__ = [
49
- (uuid_uuid1, uuid_utils_uuid1, "UUID V1"),
50
- (uuid_uuid3, uuid_utils_uuid3, "UUID V3"),
51
- (uuid_uuid4, uuid_utils_uuid4, "UUID V4"),
52
- (uuid_uuid5, uuid_utils_uuid5, "UUID V5"),
49
+ (uuid_uuid1, uuid_utils_uuid1, "UUID v1"),
50
+ (uuid_uuid3, uuid_utils_uuid3, "UUID v3"),
51
+ (uuid_uuid4, uuid_utils_uuid4, "UUID v4"),
52
+ (uuid_uuid5, uuid_utils_uuid5, "UUID v5"),
53
53
  ]
@@ -0,0 +1,27 @@
1
+ class `uuid_utils.UUID`
2
+
3
+ | Property | Description |
4
+ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
5
+ | `bytes` | the UUID as a 16-byte string (containing the six integer fields in big-endian byte order) |
6
+ | `bytes_le` | the UUID as a 16-byte string (with time_low, time_mid, and time_hi_version in little-endian byte order) |
7
+ | `fields` | a tuple of the six integer fields of the UUID, which are also available as six individual attributes and two derived attributes |
8
+ | `hex` | the UUID as a 32-character hexadecimal string |
9
+ | `int` | the UUID as a 128-bit integer |
10
+ | `urn` | the UUID as a URN as specified in RFC 4122 |
11
+ | `variant` | the UUID variant (one of the constants RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE) |
12
+ | `version` | the UUID version number |
13
+ | `is_safe` | An enum indicating whether the UUID has been generated in a way that is safe for multiprocessing applications, via `uuid_generate_time_safe(3)` |
14
+ | `timestamp` | The timestamp of the UUID in milliseconds since epoch. Only works for UUID versions 1, 6 and 7, otherwise raises `ValueError`. |
15
+
16
+ module `uuid_utils`
17
+
18
+ | Function | Description |
19
+ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20
+ | `uuid1` | Generate a UUID from a host ID, sequence number, and the current time. If `node` is not given, `getnode()` is used to obtain the hardware address. If `clock_seq` is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen. |
21
+ | `uuid3` | Generate a UUID from the MD5 hash of a namespace UUID and a name. |
22
+ | `uuid4` | Generate a random UUID. |
23
+ | `uuid5` | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. |
24
+ | `uuid6` | Generate a version 6 UUID using the given timestamp and a host ID. This is similar to version 1 UUIDs, except that it is lexicographically sortable by timestamp. |
25
+ | `uuid7` | Generate a version 7 UUID using a time value and random bytes. |
26
+ | `uuid8` | Generate a custom UUID comprised almost entirely of user-supplied bytes. |
27
+ | `getnode` | Get the hardware address as a 48-bit positive integer. |