uuid-utils 0.9.0__tar.gz → 0.11.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.9.0 → uuid_utils-0.11.0}/.github/workflows/ci.yml +65 -51
  2. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/Cargo.lock +55 -38
  3. uuid_utils-0.11.0/Cargo.toml +14 -0
  4. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/PKG-INFO +18 -20
  5. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/README.md +13 -15
  6. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/docs/index.md +12 -16
  7. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/mkdocs.yml +1 -1
  8. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/pyproject.toml +3 -3
  9. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/python/uuid_utils/__init__.py +3 -0
  10. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/python/uuid_utils/__init__.pyi +47 -37
  11. uuid_utils-0.11.0/requirements.txt +5 -0
  12. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/src/lib.rs +29 -5
  13. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/tests/test_uuid.py +6 -1
  14. uuid_utils-0.9.0/Cargo.toml +0 -14
  15. uuid_utils-0.9.0/requirements.txt +0 -5
  16. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/.gitignore +0 -0
  17. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/LICENSE.md +0 -0
  18. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/Makefile +0 -0
  19. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/benchmarks/README.md +0 -0
  20. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/benchmarks/bench_generator.py +0 -0
  21. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/benchmarks/bench_parser.py +0 -0
  22. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/docs/api.md +0 -0
  23. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/python/uuid_utils/compat/__init__.py +0 -0
  24. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/python/uuid_utils/compat/__init__.pyi +0 -0
  25. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/python/uuid_utils/py.typed +0 -0
  26. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/tests/__init__.py +0 -0
  27. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/tests/test_compat/__init__.py +0 -0
  28. {uuid_utils-0.9.0 → uuid_utils-0.11.0}/tests/test_compat/test_compat.py +0 -0
@@ -16,10 +16,10 @@ jobs:
16
16
  name: Check code quality
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
- - uses: actions/checkout@v3
20
- - uses: actions/setup-python@v4
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
21
  with:
22
- python-version: "3.10"
22
+ python-version: "3.12"
23
23
  - name: Install dependencies
24
24
  run: pip install -r requirements.txt
25
25
  - name: Check code
@@ -33,17 +33,17 @@ jobs:
33
33
  strategy:
34
34
  matrix:
35
35
  target: [x86_64, i686]
36
- python-version: ["3.10", "3.11", "3.12"]
36
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
37
37
  steps:
38
- - uses: actions/checkout@v3
39
- - uses: actions/setup-python@v4
38
+ - uses: actions/checkout@v4
39
+ - uses: actions/setup-python@v5
40
40
  with:
41
41
  python-version: "${{ matrix.python-version }}"
42
42
  - name: Build wheels
43
43
  uses: PyO3/maturin-action@v1
44
44
  with:
45
45
  target: ${{ matrix.target }}
46
- args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
46
+ args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
47
47
  sccache: "true"
48
48
  manylinux: auto
49
49
  - name: Install and test
@@ -53,9 +53,9 @@ jobs:
53
53
  pip install pytest
54
54
  pytest -v .
55
55
  - name: Upload wheels
56
- uses: actions/upload-artifact@v3
56
+ uses: actions/upload-artifact@v4
57
57
  with:
58
- name: wheels
58
+ name: wheels-linux-${{ strategy.job-index }}
59
59
  path: dist
60
60
 
61
61
  linux-cross:
@@ -65,23 +65,23 @@ jobs:
65
65
  matrix:
66
66
  target: [aarch64, armv7, ppc64le]
67
67
  steps:
68
- - uses: actions/checkout@v3
69
- - uses: actions/setup-python@v4
68
+ - uses: actions/checkout@v4
69
+ - uses: actions/setup-python@v5
70
70
  with:
71
- python-version: "3.11"
71
+ python-version: "3.12"
72
72
  - name: Build wheels
73
73
  uses: PyO3/maturin-action@v1
74
74
  with:
75
75
  rust-toolchain: stable
76
76
  target: ${{ matrix.target }}
77
77
  manylinux: auto
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
78
+ args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
79
+ - uses: uraimo/run-on-arch-action@v2.8.1
80
80
  if: matrix.target != 'ppc64'
81
81
  name: Install built wheel
82
82
  with:
83
83
  arch: ${{ matrix.target }}
84
- distro: ubuntu20.04
84
+ distro: ubuntu22.04
85
85
  githubToken: ${{ github.token }}
86
86
  install: |
87
87
  apt-get update
@@ -91,9 +91,9 @@ jobs:
91
91
  pip3 install uuid_utils --no-index --find-links dist/ --force-reinstall
92
92
  pytest -v .
93
93
  - name: Upload wheels
94
- uses: actions/upload-artifact@v3
94
+ uses: actions/upload-artifact@v4
95
95
  with:
96
- name: wheels
96
+ name: wheels-linux-cross-${{ strategy.job-index }}
97
97
  path: dist
98
98
 
99
99
  musllinux:
@@ -105,10 +105,10 @@ jobs:
105
105
  - x86_64-unknown-linux-musl
106
106
  - i686-unknown-linux-musl
107
107
  steps:
108
- - uses: actions/checkout@v3
109
- - uses: actions/setup-python@v4
108
+ - uses: actions/checkout@v4
109
+ - uses: actions/setup-python@v5
110
110
  with:
111
- python-version: "3.11"
111
+ python-version: "3.12"
112
112
  architecture: x64
113
113
  - name: Build wheels
114
114
  uses: PyO3/maturin-action@v1
@@ -116,7 +116,7 @@ jobs:
116
116
  rust-toolchain: stable
117
117
  target: ${{ matrix.target }}
118
118
  manylinux: musllinux_1_2
119
- args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
119
+ args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13
120
120
  - name: Install built wheel
121
121
  if: matrix.target == 'x86_64-unknown-linux-musl'
122
122
  uses: addnab/docker-run-action@v3
@@ -129,9 +129,9 @@ jobs:
129
129
  pip3 install uuid_utils --no-index --find-links /io/dist/ --force-reinstall --break-system-packages
130
130
  python3 -c "import uuid_utils"
131
131
  - name: Upload wheels
132
- uses: actions/upload-artifact@v3
132
+ uses: actions/upload-artifact@v4
133
133
  with:
134
- name: wheels
134
+ name: wheels-musllinux-${{ strategy.job-index }}
135
135
  path: dist
136
136
 
137
137
  musllinux-cross:
@@ -143,39 +143,47 @@ jobs:
143
143
  - target: aarch64-unknown-linux-musl
144
144
  arch: aarch64
145
145
  steps:
146
- - uses: actions/checkout@v3
147
- - uses: actions/setup-python@v4
146
+ - uses: actions/checkout@v4
147
+ - uses: actions/setup-python@v5
148
148
  with:
149
- python-version: "3.11"
149
+ python-version: "3.12"
150
150
  - name: Build wheels
151
151
  uses: PyO3/maturin-action@v1
152
152
  with:
153
153
  rust-toolchain: stable
154
154
  target: ${{ matrix.platform.target }}
155
155
  manylinux: musllinux_1_2
156
- args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
156
+ args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13
157
157
  - name: Upload wheels
158
- uses: actions/upload-artifact@v3
158
+ uses: actions/upload-artifact@v4
159
159
  with:
160
- name: wheels
160
+ name: wheels-musllinux-cross-${{ strategy.job-index }}
161
161
  path: dist
162
162
 
163
163
  windows:
164
164
  name: "Windows: ${{ matrix.platform.target }}"
165
- runs-on: windows-latest
165
+ runs-on: "${{ matrix.platform.os }}"
166
166
  strategy:
167
167
  matrix:
168
168
  platform:
169
169
  - target: x64
170
- interpreter: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
170
+ os: windows-latest
171
+ py_arch: "x64"
172
+ interpreter: "3.13"
171
173
  - target: x86
172
- interpreter: 3.8 3.9 3.10 3.11
174
+ py_arch: "x86"
175
+ os: windows-latest
176
+ interpreter: "3.13"
177
+ - target: aarch64
178
+ py_arch: "arm64"
179
+ os: windows-11-arm
180
+ interpreter: "3.13"
173
181
  steps:
174
- - uses: actions/checkout@v3
175
- - uses: actions/setup-python@v4
182
+ - uses: actions/checkout@v4
183
+ - uses: actions/setup-python@v5
176
184
  with:
177
- python-version: "3.11"
178
- architecture: ${{ matrix.platform.target }}
185
+ python-version: "${{ matrix.platform.interpreter }}"
186
+ architecture: ${{ matrix.platform.py_arch }}
179
187
  - uses: dtolnay/rust-toolchain@stable
180
188
  - name: Build wheels
181
189
  uses: PyO3/maturin-action@v1
@@ -189,56 +197,61 @@ jobs:
189
197
  pip install pytest
190
198
  pytest -v .
191
199
  - name: Upload wheels
192
- uses: actions/upload-artifact@v3
200
+ uses: actions/upload-artifact@v4
193
201
  with:
194
- name: wheels
202
+ name: wheels-windows-${{ strategy.job-index }}
195
203
  path: dist
196
204
 
197
205
  macos:
198
206
  name: "MacOS"
199
207
  runs-on: macos-latest
208
+ strategy:
209
+ matrix:
210
+ py:
211
+ - { i: "3.9 3.10 3.11 3.12 3.13", py: "3.9" }
212
+ - { i: "pypy3.9 pypy3.10", py: "pypy3.10" }
200
213
  steps:
201
- - uses: actions/checkout@v3
202
- - uses: actions/setup-python@v4
214
+ - uses: actions/checkout@v4
215
+ - uses: actions/setup-python@v5
203
216
  with:
204
- python-version: "3.11"
217
+ python-version: "${{ matrix.py.py }}"
205
218
  - uses: dtolnay/rust-toolchain@stable
206
219
  - name: Build wheels - x86_64
207
220
  uses: PyO3/maturin-action@v1
208
221
  with:
209
222
  target: x86_64
210
- args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
223
+ args: --release --out dist -i ${{ matrix.py.i }}
211
224
  sccache: "true"
212
225
  - name: Build wheels - universal2
213
226
  uses: PyO3/maturin-action@v1
214
227
  with:
215
228
  target: universal2-apple-darwin
216
- args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
229
+ args: --release --out dist -i ${{ matrix.py.i }}
217
230
  - name: Install and test uuid_utils
218
231
  run: |
219
232
  pip install uuid_utils --no-index --find-links dist --force-reinstall
220
233
  pip install pytest
221
234
  pytest -v .
222
235
  - name: Upload wheels
223
- uses: actions/upload-artifact@v3
236
+ uses: actions/upload-artifact@v4
224
237
  with:
225
- name: wheels
238
+ name: wheels-macos-${{ strategy.job-index }}
226
239
  path: dist
227
240
 
228
241
  sdist:
229
242
  name: Source Distribution
230
243
  runs-on: ubuntu-latest
231
244
  steps:
232
- - uses: actions/checkout@v3
245
+ - uses: actions/checkout@v4
233
246
  - name: Build sdist
234
247
  uses: PyO3/maturin-action@v1
235
248
  with:
236
249
  command: sdist
237
250
  args: --out dist
238
251
  - name: Upload sdist
239
- uses: actions/upload-artifact@v3
252
+ uses: actions/upload-artifact@v4
240
253
  with:
241
- name: wheels
254
+ name: wheels-sdist
242
255
  path: dist
243
256
 
244
257
  release:
@@ -247,9 +260,10 @@ jobs:
247
260
  if: "startsWith(github.ref, 'refs/tags/')"
248
261
  needs: [lint, linux, linux-cross, musllinux, musllinux-cross, windows, macos, sdist]
249
262
  steps:
250
- - uses: actions/download-artifact@v3
263
+ - uses: actions/download-artifact@v4.1.8
251
264
  with:
252
- name: wheels
265
+ pattern: wheels-*
266
+ merge-multiple: true
253
267
  - name: Publish to PyPI
254
268
  uses: PyO3/maturin-action@v1
255
269
  env:
@@ -264,7 +278,7 @@ jobs:
264
278
  if: "startsWith(github.ref, 'refs/tags/')"
265
279
  needs: [release]
266
280
  steps:
267
- - uses: actions/checkout@v3
281
+ - uses: actions/checkout@v4
268
282
  - name: Build and publish docs
269
283
  run: |
270
284
  pip install -r requirements.txt
@@ -1,6 +1,6 @@
1
1
  # This file is automatically @generated by Cargo.
2
2
  # It is not intended for manual editing.
3
- version = 3
3
+ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "atomic"
@@ -55,9 +55,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
55
55
 
56
56
  [[package]]
57
57
  name = "cfg_aliases"
58
- version = "0.1.1"
58
+ version = "0.2.1"
59
59
  source = "registry+https://github.com/rust-lang/crates.io-index"
60
- checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
60
+ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
61
61
 
62
62
  [[package]]
63
63
  name = "crypto-common"
@@ -91,12 +91,13 @@ dependencies = [
91
91
 
92
92
  [[package]]
93
93
  name = "getrandom"
94
- version = "0.2.10"
94
+ version = "0.3.2"
95
95
  source = "registry+https://github.com/rust-lang/crates.io-index"
96
- checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
96
+ checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
97
97
  dependencies = [
98
98
  "cfg-if",
99
99
  "libc",
100
+ "r-efi",
100
101
  "wasi",
101
102
  ]
102
103
 
@@ -114,15 +115,15 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
114
115
 
115
116
  [[package]]
116
117
  name = "libc"
117
- version = "0.2.154"
118
+ version = "0.2.171"
118
119
  source = "registry+https://github.com/rust-lang/crates.io-index"
119
- checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
120
+ checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
120
121
 
121
122
  [[package]]
122
123
  name = "mac_address"
123
- version = "1.1.7"
124
+ version = "1.1.8"
124
125
  source = "registry+https://github.com/rust-lang/crates.io-index"
125
- checksum = "8836fae9d0d4be2c8b4efcdd79e828a2faa058a90d005abf42f91cac5493a08e"
126
+ checksum = "c0aeb26bf5e836cc1c341c8106051b573f1766dfa05aa87f0b98be5e51b02303"
126
127
  dependencies = [
127
128
  "nix",
128
129
  "winapi",
@@ -149,9 +150,9 @@ dependencies = [
149
150
 
150
151
  [[package]]
151
152
  name = "nix"
152
- version = "0.28.0"
153
+ version = "0.29.0"
153
154
  source = "registry+https://github.com/rust-lang/crates.io-index"
154
- checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
155
+ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
155
156
  dependencies = [
156
157
  "bitflags",
157
158
  "cfg-if",
@@ -189,11 +190,10 @@ dependencies = [
189
190
 
190
191
  [[package]]
191
192
  name = "pyo3"
192
- version = "0.22.0"
193
+ version = "0.25.0"
193
194
  source = "registry+https://github.com/rust-lang/crates.io-index"
194
- checksum = "1962a33ed2a201c637fc14a4e0fd4e06e6edfdeee6a5fede0dab55507ad74cf7"
195
+ checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4"
195
196
  dependencies = [
196
- "cfg-if",
197
197
  "indoc",
198
198
  "libc",
199
199
  "memoffset",
@@ -207,9 +207,9 @@ dependencies = [
207
207
 
208
208
  [[package]]
209
209
  name = "pyo3-build-config"
210
- version = "0.22.0"
210
+ version = "0.25.0"
211
211
  source = "registry+https://github.com/rust-lang/crates.io-index"
212
- checksum = "ab7164b2202753bd33afc7f90a10355a719aa973d1f94502c50d06f3488bc420"
212
+ checksum = "755ea671a1c34044fa165247aaf6f419ca39caa6003aee791a0df2713d8f1b6d"
213
213
  dependencies = [
214
214
  "once_cell",
215
215
  "python3-dll-a",
@@ -218,9 +218,9 @@ dependencies = [
218
218
 
219
219
  [[package]]
220
220
  name = "pyo3-ffi"
221
- version = "0.22.0"
221
+ version = "0.25.0"
222
222
  source = "registry+https://github.com/rust-lang/crates.io-index"
223
- checksum = "c6424906ca49013c0829c5c1ed405e20e2da2dc78b82d198564880a704e6a7b7"
223
+ checksum = "fc95a2e67091e44791d4ea300ff744be5293f394f1bafd9f78c080814d35956e"
224
224
  dependencies = [
225
225
  "libc",
226
226
  "pyo3-build-config",
@@ -228,9 +228,9 @@ dependencies = [
228
228
 
229
229
  [[package]]
230
230
  name = "pyo3-macros"
231
- version = "0.22.0"
231
+ version = "0.25.0"
232
232
  source = "registry+https://github.com/rust-lang/crates.io-index"
233
- checksum = "82b2f19e153122d64afd8ce7aaa72f06a00f52e34e1d1e74b6d71baea396460a"
233
+ checksum = "a179641d1b93920829a62f15e87c0ed791b6c8db2271ba0fd7c2686090510214"
234
234
  dependencies = [
235
235
  "proc-macro2",
236
236
  "pyo3-macros-backend",
@@ -240,9 +240,9 @@ dependencies = [
240
240
 
241
241
  [[package]]
242
242
  name = "pyo3-macros-backend"
243
- version = "0.22.0"
243
+ version = "0.25.0"
244
244
  source = "registry+https://github.com/rust-lang/crates.io-index"
245
- checksum = "dd698c04cac17cf0fe63d47790ab311b8b25542f5cb976b65c374035c50f1eef"
245
+ checksum = "9dff85ebcaab8c441b0e3f7ae40a6963ecea8a9f5e74f647e33fcf5ec9a1e89e"
246
246
  dependencies = [
247
247
  "heck",
248
248
  "proc-macro2",
@@ -253,9 +253,9 @@ dependencies = [
253
253
 
254
254
  [[package]]
255
255
  name = "python3-dll-a"
256
- version = "0.2.9"
256
+ version = "0.2.13"
257
257
  source = "registry+https://github.com/rust-lang/crates.io-index"
258
- checksum = "d5f07cd4412be8fa09a721d40007c483981bbe072cd6a21f2e83e04ec8f8343f"
258
+ checksum = "49fe4227a288cf9493942ad0220ea3f185f4d1f2a14f197f7344d6d02f4ed4ed"
259
259
  dependencies = [
260
260
  "cc",
261
261
  ]
@@ -269,22 +269,27 @@ dependencies = [
269
269
  "proc-macro2",
270
270
  ]
271
271
 
272
+ [[package]]
273
+ name = "r-efi"
274
+ version = "5.2.0"
275
+ source = "registry+https://github.com/rust-lang/crates.io-index"
276
+ checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
277
+
272
278
  [[package]]
273
279
  name = "rand"
274
- version = "0.8.5"
280
+ version = "0.9.1"
275
281
  source = "registry+https://github.com/rust-lang/crates.io-index"
276
- checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
282
+ checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
277
283
  dependencies = [
278
- "libc",
279
284
  "rand_chacha",
280
285
  "rand_core",
281
286
  ]
282
287
 
283
288
  [[package]]
284
289
  name = "rand_chacha"
285
- version = "0.3.1"
290
+ version = "0.9.0"
286
291
  source = "registry+https://github.com/rust-lang/crates.io-index"
287
- checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
292
+ checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
288
293
  dependencies = [
289
294
  "ppv-lite86",
290
295
  "rand_core",
@@ -292,9 +297,9 @@ dependencies = [
292
297
 
293
298
  [[package]]
294
299
  name = "rand_core"
295
- version = "0.6.4"
300
+ version = "0.9.3"
296
301
  source = "registry+https://github.com/rust-lang/crates.io-index"
297
- checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
302
+ checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
298
303
  dependencies = [
299
304
  "getrandom",
300
305
  ]
@@ -318,9 +323,9 @@ dependencies = [
318
323
 
319
324
  [[package]]
320
325
  name = "target-lexicon"
321
- version = "0.12.14"
326
+ version = "0.13.2"
322
327
  source = "registry+https://github.com/rust-lang/crates.io-index"
323
- checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
328
+ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
324
329
 
325
330
  [[package]]
326
331
  name = "typenum"
@@ -342,9 +347,9 @@ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
342
347
 
343
348
  [[package]]
344
349
  name = "uuid"
345
- version = "1.9.1"
350
+ version = "1.16.0"
346
351
  source = "registry+https://github.com/rust-lang/crates.io-index"
347
- checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439"
352
+ checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
348
353
  dependencies = [
349
354
  "atomic",
350
355
  "getrandom",
@@ -355,7 +360,7 @@ dependencies = [
355
360
 
356
361
  [[package]]
357
362
  name = "uuid-utils"
358
- version = "0.9.0"
363
+ version = "0.11.0"
359
364
  dependencies = [
360
365
  "mac_address",
361
366
  "pyo3",
@@ -371,9 +376,12 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
371
376
 
372
377
  [[package]]
373
378
  name = "wasi"
374
- version = "0.11.0+wasi-snapshot-preview1"
379
+ version = "0.14.2+wasi-0.2.4"
375
380
  source = "registry+https://github.com/rust-lang/crates.io-index"
376
- checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
381
+ checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
382
+ dependencies = [
383
+ "wit-bindgen-rt",
384
+ ]
377
385
 
378
386
  [[package]]
379
387
  name = "winapi"
@@ -396,3 +404,12 @@ name = "winapi-x86_64-pc-windows-gnu"
396
404
  version = "0.4.0"
397
405
  source = "registry+https://github.com/rust-lang/crates.io-index"
398
406
  checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
407
+
408
+ [[package]]
409
+ name = "wit-bindgen-rt"
410
+ version = "0.39.0"
411
+ source = "registry+https://github.com/rust-lang/crates.io-index"
412
+ checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
413
+ dependencies = [
414
+ "bitflags",
415
+ ]
@@ -0,0 +1,14 @@
1
+ [package]
2
+ name = "uuid-utils"
3
+ version = "0.11.0"
4
+ edition = "2021"
5
+
6
+ [lib]
7
+ name = "uuid_utils"
8
+ crate-type = ["cdylib"]
9
+
10
+ [dependencies]
11
+ mac_address = "1.1.8"
12
+ pyo3 = { version = "0.25.0", features = ["extension-module", "generate-import-lib", 'abi3-py39'] }
13
+ rand = "0.9.1"
14
+ uuid = { version = "1.16.0", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
@@ -1,24 +1,24 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: uuid_utils
3
- Version: 0.9.0
3
+ Version: 0.11.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.8
9
8
  Classifier: Programming Language :: Python :: 3.9
10
9
  Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: Programming Language :: Rust
14
14
  Classifier: Intended Audience :: Developers
15
15
  Classifier: License :: OSI Approved :: BSD License
16
16
  Classifier: Operating System :: OS Independent
17
17
  License-File: LICENSE.md
18
- Summary: Drop-in replacement for Python UUID in Rust
18
+ Summary: Drop-in replacement for Python UUID with bindings in Rust
19
19
  Keywords: rust,uuid
20
20
  Author-email: Amin Alaee <me@aminalaee.dev>
21
- Requires-Python: >=3.8
21
+ Requires-Python: >=3.9
22
22
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
23
23
  Project-URL: Documentation, https://github.com/aminalaee/uuid-utils
24
24
  Project-URL: Issues, https://github.com/aminalaee/uuid-utils/issues
@@ -40,9 +40,7 @@ Project-URL: Source, https://github.com/aminalaee/uuid-utils
40
40
  Python UUID implementation using Rust's UUID library.
41
41
  This will make `uuid4` function around 10x faster.
42
42
 
43
- This package can be a drop-in replacement to the standard library UUID
44
- which implements existing UUID versions like v4 in Rust
45
- and also adds draft UUID versions like v6.
43
+ This package can be a drop-in replacement to the standard library UUID.
46
44
 
47
45
  Avaialble UUID versions:
48
46
 
@@ -54,8 +52,6 @@ Avaialble UUID versions:
54
52
  - `uuid7` - Version 7 UUIDs using a Unix timestamp ordered by time.
55
53
  - `uuid8` - Version 8 UUIDs using user-defined data.
56
54
 
57
- <sup>Please note that UUID versions 6, 7 and 8 are still in draft RFC.</sup><br>
58
-
59
55
  ## Installation
60
56
  Using `pip`:
61
57
  ```shell
@@ -106,16 +102,18 @@ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
106
102
 
107
103
  ## Benchmarks
108
104
 
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) |
105
+ | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
106
+ |------------------|---------|---------|---------|-----------------|-----------------|-----------------|
107
+ | UUID v1 | 0.061 | 0.299 | 0.194 | 0.019 (3.3x) | 0.019 (15.4x) | 0.019 (10.1x) |
108
+ | UUID v3 | 0.267 | 0.307 | 0.293 | 0.035 (7.6x) | 0.041 (7.5x) | 0.039 (7.5x) |
109
+ | UUID v4 | 0.145 | 0.301 | 0.249 | 0.004 (38.5x) | 0.005 (54.8x) | 0.005 (53.0x) |
110
+ | UUID v5 | 0.058 | 0.189 | 0.146 | 0.008 (7.6x) | 0.038 (5.0x) | 0.016 (9.0x) |
111
+ | UUID from hex | 0.128 | 0.139 | 0.135 | 0.016 (8.2x) | 0.017 (8.0x) | 0.016 (8.3x) |
112
+ | UUID from bytes | 0.031 | 0.135 | 0.093 | 0.016 (2.0x) | 0.016 (8.6x) | 0.016 (5.9x) |
113
+ | UUID from int | 0.027 | 0.102 | 0.043 | 0.003 (8.3x) | 0.004 (25.0x) | 0.003 (12.4x) |
114
+ | UUID from fields | 0.031 | 0.162 | 0.077 | 0.005 (6.0x) | 0.005 (30.6x) | 0.005 (14.7x) |
115
+
116
+ <sup>Benchmark results might vary in different environments, but in most cases the uuid_utils should outperform stdlib uuid.</sup><br>
119
117
 
120
118
  ## How to develop locally
121
119
 
@@ -14,9 +14,7 @@
14
14
  Python UUID implementation using Rust's UUID library.
15
15
  This will make `uuid4` function around 10x faster.
16
16
 
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.
17
+ This package can be a drop-in replacement to the standard library UUID.
20
18
 
21
19
  Avaialble UUID versions:
22
20
 
@@ -28,8 +26,6 @@ Avaialble UUID versions:
28
26
  - `uuid7` - Version 7 UUIDs using a Unix timestamp ordered by time.
29
27
  - `uuid8` - Version 8 UUIDs using user-defined data.
30
28
 
31
- <sup>Please note that UUID versions 6, 7 and 8 are still in draft RFC.</sup><br>
32
-
33
29
  ## Installation
34
30
  Using `pip`:
35
31
  ```shell
@@ -80,16 +76,18 @@ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
80
76
 
81
77
  ## Benchmarks
82
78
 
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) |
79
+ | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
80
+ |------------------|---------|---------|---------|-----------------|-----------------|-----------------|
81
+ | UUID v1 | 0.061 | 0.299 | 0.194 | 0.019 (3.3x) | 0.019 (15.4x) | 0.019 (10.1x) |
82
+ | UUID v3 | 0.267 | 0.307 | 0.293 | 0.035 (7.6x) | 0.041 (7.5x) | 0.039 (7.5x) |
83
+ | UUID v4 | 0.145 | 0.301 | 0.249 | 0.004 (38.5x) | 0.005 (54.8x) | 0.005 (53.0x) |
84
+ | UUID v5 | 0.058 | 0.189 | 0.146 | 0.008 (7.6x) | 0.038 (5.0x) | 0.016 (9.0x) |
85
+ | UUID from hex | 0.128 | 0.139 | 0.135 | 0.016 (8.2x) | 0.017 (8.0x) | 0.016 (8.3x) |
86
+ | UUID from bytes | 0.031 | 0.135 | 0.093 | 0.016 (2.0x) | 0.016 (8.6x) | 0.016 (5.9x) |
87
+ | UUID from int | 0.027 | 0.102 | 0.043 | 0.003 (8.3x) | 0.004 (25.0x) | 0.003 (12.4x) |
88
+ | UUID from fields | 0.031 | 0.162 | 0.077 | 0.005 (6.0x) | 0.005 (30.6x) | 0.005 (14.7x) |
89
+
90
+ <sup>Benchmark results might vary in different environments, but in most cases the uuid_utils should outperform stdlib uuid.</sup><br>
93
91
 
94
92
  ## How to develop locally
95
93
 
@@ -14,10 +14,6 @@
14
14
  Python UUID implementation using Rust's UUID library.
15
15
  This will make `uuid4` function around 10x faster.
16
16
 
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.
20
-
21
17
  Avaialble UUID versions:
22
18
 
23
19
  - `uuid1` - Version 1 UUIDs using a timestamp and monotonic counter.
@@ -28,8 +24,6 @@ Avaialble UUID versions:
28
24
  - `uuid7` - Version 7 UUIDs using a Unix timestamp ordered by time.
29
25
  - `uuid8` - Version 8 UUIDs using user-defined data.
30
26
 
31
- <sup>Please note that UUID versions 6, 7 and 8 are still in draft RFC.</sup><br>
32
-
33
27
  ## Installation
34
28
  Using `pip`:
35
29
  ```shell
@@ -80,16 +74,18 @@ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
80
74
 
81
75
  ## Benchmarks
82
76
 
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) |
77
+ | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
78
+ |------------------|---------|---------|---------|-----------------|-----------------|-----------------|
79
+ | UUID v1 | 0.061 | 0.299 | 0.194 | 0.019 (3.3x) | 0.019 (15.4x) | 0.019 (10.1x) |
80
+ | UUID v3 | 0.267 | 0.307 | 0.293 | 0.035 (7.6x) | 0.041 (7.5x) | 0.039 (7.5x) |
81
+ | UUID v4 | 0.145 | 0.301 | 0.249 | 0.004 (38.5x) | 0.005 (54.8x) | 0.005 (53.0x) |
82
+ | UUID v5 | 0.058 | 0.189 | 0.146 | 0.008 (7.6x) | 0.038 (5.0x) | 0.016 (9.0x) |
83
+ | UUID from hex | 0.128 | 0.139 | 0.135 | 0.016 (8.2x) | 0.017 (8.0x) | 0.016 (8.3x) |
84
+ | UUID from bytes | 0.031 | 0.135 | 0.093 | 0.016 (2.0x) | 0.016 (8.6x) | 0.016 (5.9x) |
85
+ | UUID from int | 0.027 | 0.102 | 0.043 | 0.003 (8.3x) | 0.004 (25.0x) | 0.003 (12.4x) |
86
+ | UUID from fields | 0.031 | 0.162 | 0.077 | 0.005 (6.0x) | 0.005 (30.6x) | 0.005 (14.7x) |
87
+
88
+ <sup>Benchmark results might vary in different environments, but in most cases the uuid_utils should outperform stdlib uuid.</sup><br>
93
89
 
94
90
  ## How to develop locally
95
91
 
@@ -1,6 +1,6 @@
1
1
  site_name: UUID-Utils
2
2
  site_description: Python bindings to Rust UUID
3
- site_url: https://aminalaee.dev/uuid-utils
3
+ site_url: https://aminalaee.github.io/uuid-utils
4
4
 
5
5
  theme:
6
6
  name: "material"
@@ -4,20 +4,20 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "uuid_utils"
7
- description = "Drop-in replacement for Python UUID in Rust"
7
+ description = "Drop-in replacement for Python UUID with bindings in Rust"
8
8
  authors = [{ name = "Amin Alaee", email = "me@aminalaee.dev" }]
9
9
  keywords = ["rust", "uuid"]
10
- requires-python = ">=3.8"
10
+ requires-python = ">=3.9"
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.8",
17
16
  "Programming Language :: Python :: 3.9",
18
17
  "Programming Language :: Python :: 3.10",
19
18
  "Programming Language :: Python :: 3.11",
20
19
  "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
21
  "Programming Language :: Rust",
22
22
  "Intended Audience :: Developers",
23
23
  "License :: OSI Approved :: BSD License",
@@ -1,3 +1,5 @@
1
+ from uuid import SafeUUID
2
+
1
3
  from ._uuid_utils import (
2
4
  NAMESPACE_DNS,
3
5
  NAMESPACE_OID,
@@ -29,6 +31,7 @@ __all__ = [
29
31
  "RESERVED_NCS",
30
32
  "RFC_4122",
31
33
  "UUID",
34
+ "SafeUUID",
32
35
  "__version__",
33
36
  "getnode",
34
37
  "uuid1",
@@ -1,21 +1,14 @@
1
+ import builtins
1
2
  import sys
2
- from enum import Enum
3
+ from uuid import SafeUUID
3
4
 
4
- from _typeshed import Unused
5
5
  from typing_extensions import TypeAlias
6
6
 
7
7
  # Because UUID has properties called int and bytes we need to rename these temporarily.
8
- _Int: TypeAlias = int
9
- _Bytes: TypeAlias = bytes
10
8
  _FieldsType: TypeAlias = tuple[int, int, int, int, int, int]
11
9
 
12
10
  __version__: str
13
11
 
14
- class SafeUUID(Enum):
15
- safe: int
16
- unsafe: int
17
- unknown: None
18
-
19
12
  class UUID:
20
13
  """Instances of the UUID class represent UUIDs as specified in RFC 4122.
21
14
  UUID objects are immutable, hashable, and usable as dictionary keys.
@@ -74,44 +67,44 @@ class UUID:
74
67
  def __init__(
75
68
  self,
76
69
  hex: str | None = None,
77
- bytes: _Bytes | None = None,
78
- bytes_le: _Bytes | None = None,
70
+ bytes: builtins.bytes | None = None,
71
+ bytes_le: builtins.bytes | None = None,
79
72
  fields: _FieldsType | None = None,
80
- int: _Int | None = None,
81
- version: _Int | None = None,
73
+ int: builtins.int | None = None,
74
+ version: builtins.int | None = None,
82
75
  *,
83
76
  is_safe: SafeUUID = ...,
84
77
  ) -> None: ...
85
78
  @property
86
79
  def is_safe(self) -> SafeUUID: ...
87
80
  @property
88
- def bytes(self) -> _Bytes: ...
81
+ def bytes(self) -> builtins.bytes: ...
89
82
  @property
90
- def bytes_le(self) -> _Bytes: ...
83
+ def bytes_le(self) -> builtins.bytes: ...
91
84
  @property
92
- def clock_seq(self) -> _Int: ...
85
+ def clock_seq(self) -> builtins.int: ...
93
86
  @property
94
- def clock_seq_hi_variant(self) -> _Int: ...
87
+ def clock_seq_hi_variant(self) -> builtins.int: ...
95
88
  @property
96
- def clock_seq_low(self) -> _Int: ...
89
+ def clock_seq_low(self) -> builtins.int: ...
97
90
  @property
98
91
  def fields(self) -> _FieldsType: ...
99
92
  @property
100
93
  def hex(self) -> str: ...
101
94
  @property
102
- def int(self) -> _Int: ...
95
+ def int(self) -> builtins.int: ...
103
96
  @property
104
- def node(self) -> _Int: ...
97
+ def node(self) -> builtins.int: ...
105
98
  @property
106
- def time(self) -> _Int: ...
99
+ def time(self) -> builtins.int: ...
107
100
  @property
108
- def time_hi_version(self) -> _Int: ...
101
+ def time_hi_version(self) -> builtins.int: ...
109
102
  @property
110
- def time_low(self) -> _Int: ...
103
+ def time_low(self) -> builtins.int: ...
111
104
  @property
112
- def time_mid(self) -> _Int: ...
105
+ def time_mid(self) -> builtins.int: ...
113
106
  @property
114
- def timestamp(self) -> _Int:
107
+ def timestamp(self) -> builtins.int:
115
108
  """Get UUID timestamp milliseconds since epoch.
116
109
  Only works for UUID versions 1, 6 and 7, otherwise raises ValueError."""
117
110
  ...
@@ -121,21 +114,16 @@ class UUID:
121
114
  @property
122
115
  def variant(self) -> str: ...
123
116
  @property
124
- def version(self) -> _Int | None: ...
125
- def __int__(self) -> _Int: ...
117
+ def version(self) -> builtins.int | None: ...
118
+ def __int__(self) -> builtins.int: ...
126
119
  def __eq__(self, other: object) -> bool: ...
127
120
  def __lt__(self, other: UUID) -> bool: ...
128
121
  def __le__(self, other: UUID) -> bool: ...
129
122
  def __gt__(self, other: UUID) -> bool: ...
130
123
  def __ge__(self, other: UUID) -> bool: ...
131
124
 
132
- if sys.version_info >= (3, 9):
133
- def getnode() -> int: ...
134
-
135
- else:
136
- def getnode(*, getters: Unused = None) -> int: ... # undocumented
137
-
138
- def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID:
125
+ def getnode() -> int: ...
126
+ def uuid1(node: int | None = None, clock_seq: int | None = None) -> UUID:
139
127
  """Generate a UUID from a host ID, sequence number, and the current time.
140
128
  If 'node' is not given, getnode() is used to obtain the hardware
141
129
  address. If 'clock_seq' is given, it is used as the sequence number;
@@ -165,7 +153,7 @@ else:
165
153
  ...
166
154
 
167
155
  def uuid6(
168
- node: _Int | None = None, timestamp: _Int | None = None, nanos: _Int | None = None
156
+ node: int | None = None, timestamp: int | None = None, nanos: int | None = None
169
157
  ) -> UUID:
170
158
  """Generate a version 6 UUID using the given timestamp and a host ID.
171
159
  This is similar to version 1 UUIDs,
@@ -173,11 +161,11 @@ def uuid6(
173
161
  """
174
162
  ...
175
163
 
176
- def uuid7(timestamp: _Int | None = None, nanos: _Int | None = None) -> UUID:
164
+ def uuid7(timestamp: int | None = None, nanos: int | None = None) -> UUID:
177
165
  """Generate a version 7 UUID using a time value and random bytes."""
178
166
  ...
179
167
 
180
- def uuid8(bytes: _Bytes) -> UUID:
168
+ def uuid8(bytes: bytes) -> UUID:
181
169
  """Generate a custom UUID comprised almost entirely of user-supplied bytes."""
182
170
  ...
183
171
 
@@ -189,3 +177,25 @@ RESERVED_NCS: str
189
177
  RFC_4122: str
190
178
  RESERVED_MICROSOFT: str
191
179
  RESERVED_FUTURE: str
180
+
181
+ __all__ = [
182
+ "NAMESPACE_DNS",
183
+ "NAMESPACE_OID",
184
+ "NAMESPACE_URL",
185
+ "NAMESPACE_X500",
186
+ "RESERVED_FUTURE",
187
+ "RESERVED_MICROSOFT",
188
+ "RESERVED_NCS",
189
+ "RFC_4122",
190
+ "UUID",
191
+ "SafeUUID",
192
+ "__version__",
193
+ "getnode",
194
+ "uuid1",
195
+ "uuid3",
196
+ "uuid4",
197
+ "uuid5",
198
+ "uuid6",
199
+ "uuid7",
200
+ "uuid8",
201
+ ]
@@ -0,0 +1,5 @@
1
+ mkdocs==1.6.1
2
+ mkdocs-material==9.5.34
3
+ mypy==1.11.2
4
+ pytest==8.3.2
5
+ ruff==0.6.4
@@ -1,14 +1,18 @@
1
1
  use mac_address::get_mac_address;
2
2
  use pyo3::{
3
3
  exceptions::{PyTypeError, PyValueError},
4
+ ffi,
4
5
  prelude::*,
5
6
  pyclass::CompareOp,
6
7
  types::{PyBytes, PyDict},
7
8
  };
8
9
  use rand::RngCore;
9
- use std::hash::Hasher;
10
- use std::sync::atomic::{AtomicU64, Ordering};
11
10
  use std::{collections::hash_map::DefaultHasher, hash::Hash};
11
+ use std::{hash::Hasher, sync::atomic::AtomicPtr};
12
+ use std::{
13
+ ptr::null_mut,
14
+ sync::atomic::{AtomicU64, Ordering},
15
+ };
12
16
  use uuid::{Builder, Bytes, Context, Timestamp, Uuid, Variant, Version};
13
17
 
14
18
  static NODE: AtomicU64 = AtomicU64::new(0);
@@ -134,7 +138,7 @@ impl UUID {
134
138
  }
135
139
 
136
140
  pub fn __deepcopy__(&self, py: Python, _memo: &Bound<'_, PyDict>) -> Py<PyAny> {
137
- self.clone().into_py(py)
141
+ self.clone().into_pyobject(py).unwrap().into_any().unbind()
138
142
  }
139
143
 
140
144
  #[getter]
@@ -154,7 +158,7 @@ impl UUID {
154
158
  bytes[3], bytes[2], bytes[1], bytes[0], bytes[5], bytes[4], bytes[7], bytes[6],
155
159
  bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15],
156
160
  ];
157
- PyBytes::new_bound(py, &bytes)
161
+ PyBytes::new(py, &bytes)
158
162
  }
159
163
 
160
164
  #[getter]
@@ -306,6 +310,11 @@ impl UUID {
306
310
  uuid: Uuid::from_u128(int),
307
311
  })
308
312
  }
313
+
314
+ #[getter]
315
+ fn is_safe(&self) -> *mut ffi::PyObject {
316
+ return SAFE_UUID_UNKNOWN.load(Ordering::Relaxed);
317
+ }
309
318
  }
310
319
 
311
320
  #[pyfunction]
@@ -412,7 +421,7 @@ fn _getnode() -> u64 {
412
421
  Ok(Some(mac_address)) => mac_address.bytes(),
413
422
  _ => {
414
423
  let mut bytes = [0u8; 6];
415
- rand::thread_rng().fill_bytes(&mut bytes);
424
+ rand::rng().fill_bytes(&mut bytes);
416
425
  bytes[0] = bytes[0] | 0x01;
417
426
  bytes
418
427
  }
@@ -429,6 +438,9 @@ fn _getnode() -> u64 {
429
438
  node
430
439
  }
431
440
 
441
+ // ptr to python stdlib uuid.SafeUUID.unknown
442
+ static SAFE_UUID_UNKNOWN: AtomicPtr<ffi::PyObject> = AtomicPtr::new(null_mut());
443
+
432
444
  #[pyfunction]
433
445
  fn getnode() -> PyResult<u64> {
434
446
  Ok(_getnode())
@@ -436,6 +448,18 @@ fn getnode() -> PyResult<u64> {
436
448
 
437
449
  #[pymodule]
438
450
  fn _uuid_utils(m: &Bound<'_, PyModule>) -> PyResult<()> {
451
+ let safe_uuid_unknown = Python::with_gil(|py| {
452
+ return PyModule::import(py, "uuid")
453
+ .unwrap()
454
+ .getattr("SafeUUID")
455
+ .unwrap()
456
+ .getattr("unknown")
457
+ .unwrap()
458
+ .unbind();
459
+ });
460
+
461
+ SAFE_UUID_UNKNOWN.store(safe_uuid_unknown.into_ptr(), Ordering::Relaxed);
462
+
439
463
  m.add("__version__", env!("CARGO_PKG_VERSION"))?;
440
464
  m.add_class::<UUID>()?;
441
465
  m.add_function(wrap_pyfunction!(uuid1, m)?)?;
@@ -2,7 +2,7 @@ import copy
2
2
  import pickle
3
3
  import sys
4
4
  from datetime import datetime
5
- from uuid import UUID, getnode
5
+ from uuid import UUID, SafeUUID, getnode
6
6
 
7
7
  import pytest
8
8
  import uuid_utils
@@ -200,6 +200,11 @@ def test_copy() -> None:
200
200
  assert copy.deepcopy(uuid) == uuid
201
201
 
202
202
 
203
+ def test_is_safe() -> None:
204
+ assert uuid_utils.uuid1().is_safe is SafeUUID.unknown
205
+ assert uuid_utils.uuid4().is_safe is SafeUUID.unknown
206
+
207
+
203
208
  @pytest.mark.xfail(sys.platform == "linux", reason="Might fail in Github Actions")
204
209
  def test_getnode() -> None:
205
210
  assert uuid_utils.getnode() == getnode()
@@ -1,14 +0,0 @@
1
- [package]
2
- name = "uuid-utils"
3
- version = "0.9.0"
4
- edition = "2021"
5
-
6
- [lib]
7
- name = "uuid_utils"
8
- crate-type = ["cdylib"]
9
-
10
- [dependencies]
11
- mac_address = "1.1.7"
12
- pyo3 = { version = "0.22.0", features = ["extension-module", "generate-import-lib"] }
13
- rand = "0.8.5"
14
- uuid = { version = "1.9.1", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
@@ -1,5 +0,0 @@
1
- mkdocs==1.6.0
2
- mkdocs-material==9.5.26
3
- mypy==1.10.0
4
- pytest==8.2.0
5
- ruff==0.4.8
File without changes
File without changes
File without changes
File without changes