uuid-utils 0.8.0__tar.gz → 0.10.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.8.0 → uuid_utils-0.10.0}/.github/workflows/ci.yml +51 -50
  2. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/Cargo.lock +38 -146
  3. uuid_utils-0.10.0/Cargo.toml +14 -0
  4. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/PKG-INFO +15 -13
  5. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/README.md +12 -10
  6. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/docs/index.md +12 -10
  7. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/pyproject.toml +2 -2
  8. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/python/uuid_utils/__init__.py +3 -0
  9. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/python/uuid_utils/__init__.pyi +47 -37
  10. uuid_utils-0.10.0/requirements.txt +5 -0
  11. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/src/lib.rs +32 -4
  12. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/tests/test_uuid.py +6 -1
  13. uuid_utils-0.8.0/Cargo.toml +0 -14
  14. uuid_utils-0.8.0/requirements.txt +0 -5
  15. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/.gitignore +0 -0
  16. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/LICENSE.md +0 -0
  17. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/Makefile +0 -0
  18. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/benchmarks/README.md +0 -0
  19. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/benchmarks/bench_generator.py +0 -0
  20. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/benchmarks/bench_parser.py +0 -0
  21. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/docs/api.md +0 -0
  22. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/mkdocs.yml +0 -0
  23. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/python/uuid_utils/compat/__init__.py +0 -0
  24. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/python/uuid_utils/compat/__init__.pyi +0 -0
  25. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/python/uuid_utils/py.typed +0 -0
  26. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/tests/__init__.py +0 -0
  27. {uuid_utils-0.8.0 → uuid_utils-0.10.0}/tests/test_compat/__init__.py +0 -0
  28. {uuid_utils-0.8.0 → uuid_utils-0.10.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:
@@ -63,25 +63,25 @@ jobs:
63
63
  runs-on: ubuntu-latest
64
64
  strategy:
65
65
  matrix:
66
- target: [aarch64, armv7, s390x, ppc64le]
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,21 +143,21 @@ 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:
@@ -167,14 +167,14 @@ jobs:
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
+ interpreter: 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
171
171
  - target: x86
172
- interpreter: 3.8 3.9 3.10 3.11
172
+ interpreter: 3.9 3.10 3.11 3.12
173
173
  steps:
174
- - uses: actions/checkout@v3
175
- - uses: actions/setup-python@v4
174
+ - uses: actions/checkout@v4
175
+ - uses: actions/setup-python@v5
176
176
  with:
177
- python-version: "3.11"
177
+ python-version: "3.12"
178
178
  architecture: ${{ matrix.platform.target }}
179
179
  - uses: dtolnay/rust-toolchain@stable
180
180
  - name: Build wheels
@@ -189,56 +189,56 @@ jobs:
189
189
  pip install pytest
190
190
  pytest -v .
191
191
  - name: Upload wheels
192
- uses: actions/upload-artifact@v3
192
+ uses: actions/upload-artifact@v4
193
193
  with:
194
- name: wheels
194
+ name: wheels-windows-${{ strategy.job-index }}
195
195
  path: dist
196
196
 
197
197
  macos:
198
198
  name: "MacOS"
199
199
  runs-on: macos-latest
200
200
  steps:
201
- - uses: actions/checkout@v3
202
- - uses: actions/setup-python@v4
201
+ - uses: actions/checkout@v4
202
+ - uses: actions/setup-python@v5
203
203
  with:
204
- python-version: "3.11"
204
+ python-version: "3.12"
205
205
  - uses: dtolnay/rust-toolchain@stable
206
206
  - name: Build wheels - x86_64
207
207
  uses: PyO3/maturin-action@v1
208
208
  with:
209
209
  target: x86_64
210
- args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
210
+ args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
211
211
  sccache: "true"
212
212
  - name: Build wheels - universal2
213
213
  uses: PyO3/maturin-action@v1
214
214
  with:
215
215
  target: universal2-apple-darwin
216
- args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
216
+ args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
217
217
  - name: Install and test uuid_utils
218
218
  run: |
219
219
  pip install uuid_utils --no-index --find-links dist --force-reinstall
220
220
  pip install pytest
221
221
  pytest -v .
222
222
  - name: Upload wheels
223
- uses: actions/upload-artifact@v3
223
+ uses: actions/upload-artifact@v4
224
224
  with:
225
- name: wheels
225
+ name: wheels-macos
226
226
  path: dist
227
227
 
228
228
  sdist:
229
229
  name: Source Distribution
230
230
  runs-on: ubuntu-latest
231
231
  steps:
232
- - uses: actions/checkout@v3
232
+ - uses: actions/checkout@v4
233
233
  - name: Build sdist
234
234
  uses: PyO3/maturin-action@v1
235
235
  with:
236
236
  command: sdist
237
237
  args: --out dist
238
238
  - name: Upload sdist
239
- uses: actions/upload-artifact@v3
239
+ uses: actions/upload-artifact@v4
240
240
  with:
241
- name: wheels
241
+ name: wheels-sdist
242
242
  path: dist
243
243
 
244
244
  release:
@@ -247,9 +247,10 @@ jobs:
247
247
  if: "startsWith(github.ref, 'refs/tags/')"
248
248
  needs: [lint, linux, linux-cross, musllinux, musllinux-cross, windows, macos, sdist]
249
249
  steps:
250
- - uses: actions/download-artifact@v3
250
+ - uses: actions/download-artifact@v4.1.8
251
251
  with:
252
- name: wheels
252
+ pattern: wheels-*
253
+ merge-multiple: true
253
254
  - name: Publish to PyPI
254
255
  uses: PyO3/maturin-action@v1
255
256
  env:
@@ -264,7 +265,7 @@ jobs:
264
265
  if: "startsWith(github.ref, 'refs/tags/')"
265
266
  needs: [release]
266
267
  steps:
267
- - uses: actions/checkout@v3
268
+ - uses: actions/checkout@v4
268
269
  - name: Build and publish docs
269
270
  run: |
270
271
  pip install -r requirements.txt
@@ -4,9 +4,12 @@ version = 3
4
4
 
5
5
  [[package]]
6
6
  name = "atomic"
7
- version = "0.5.3"
7
+ version = "0.6.0"
8
8
  source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"
9
+ checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994"
10
+ dependencies = [
11
+ "bytemuck",
12
+ ]
10
13
 
11
14
  [[package]]
12
15
  name = "autocfg"
@@ -14,12 +17,6 @@ version = "1.1.0"
14
17
  source = "registry+https://github.com/rust-lang/crates.io-index"
15
18
  checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
16
19
 
17
- [[package]]
18
- name = "bitflags"
19
- version = "1.3.2"
20
- source = "registry+https://github.com/rust-lang/crates.io-index"
21
- checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
22
-
23
20
  [[package]]
24
21
  name = "bitflags"
25
22
  version = "2.5.0"
@@ -35,6 +32,12 @@ dependencies = [
35
32
  "generic-array",
36
33
  ]
37
34
 
35
+ [[package]]
36
+ name = "bytemuck"
37
+ version = "1.16.1"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
40
+
38
41
  [[package]]
39
42
  name = "cc"
40
43
  version = "1.0.83"
@@ -99,9 +102,9 @@ dependencies = [
99
102
 
100
103
  [[package]]
101
104
  name = "heck"
102
- version = "0.4.1"
105
+ version = "0.5.0"
103
106
  source = "registry+https://github.com/rust-lang/crates.io-index"
104
- checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
107
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
105
108
 
106
109
  [[package]]
107
110
  name = "indoc"
@@ -115,21 +118,11 @@ version = "0.2.154"
115
118
  source = "registry+https://github.com/rust-lang/crates.io-index"
116
119
  checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
117
120
 
118
- [[package]]
119
- name = "lock_api"
120
- version = "0.4.10"
121
- source = "registry+https://github.com/rust-lang/crates.io-index"
122
- checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
123
- dependencies = [
124
- "autocfg",
125
- "scopeguard",
126
- ]
127
-
128
121
  [[package]]
129
122
  name = "mac_address"
130
- version = "1.1.6"
123
+ version = "1.1.7"
131
124
  source = "registry+https://github.com/rust-lang/crates.io-index"
132
- checksum = "5aa12182b93606fff55b70a5cfe6130eaf7407c2ea4f2c2bcc8b113b67c9928f"
125
+ checksum = "8836fae9d0d4be2c8b4efcdd79e828a2faa058a90d005abf42f91cac5493a08e"
133
126
  dependencies = [
134
127
  "nix",
135
128
  "winapi",
@@ -160,7 +153,7 @@ version = "0.28.0"
160
153
  source = "registry+https://github.com/rust-lang/crates.io-index"
161
154
  checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
162
155
  dependencies = [
163
- "bitflags 2.5.0",
156
+ "bitflags",
164
157
  "cfg-if",
165
158
  "cfg_aliases",
166
159
  "libc",
@@ -173,29 +166,6 @@ version = "1.18.0"
173
166
  source = "registry+https://github.com/rust-lang/crates.io-index"
174
167
  checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
175
168
 
176
- [[package]]
177
- name = "parking_lot"
178
- version = "0.12.1"
179
- source = "registry+https://github.com/rust-lang/crates.io-index"
180
- checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
181
- dependencies = [
182
- "lock_api",
183
- "parking_lot_core",
184
- ]
185
-
186
- [[package]]
187
- name = "parking_lot_core"
188
- version = "0.9.8"
189
- source = "registry+https://github.com/rust-lang/crates.io-index"
190
- checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
191
- dependencies = [
192
- "cfg-if",
193
- "libc",
194
- "redox_syscall",
195
- "smallvec",
196
- "windows-targets",
197
- ]
198
-
199
169
  [[package]]
200
170
  name = "portable-atomic"
201
171
  version = "1.6.0"
@@ -210,24 +180,24 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
210
180
 
211
181
  [[package]]
212
182
  name = "proc-macro2"
213
- version = "1.0.67"
183
+ version = "1.0.86"
214
184
  source = "registry+https://github.com/rust-lang/crates.io-index"
215
- checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
185
+ checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
216
186
  dependencies = [
217
187
  "unicode-ident",
218
188
  ]
219
189
 
220
190
  [[package]]
221
191
  name = "pyo3"
222
- version = "0.21.2"
192
+ version = "0.23.1"
223
193
  source = "registry+https://github.com/rust-lang/crates.io-index"
224
- checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
194
+ checksum = "7ebb0c0cc0de9678e53be9ccf8a2ab53045e6e3a8be03393ceccc5e7396ccb40"
225
195
  dependencies = [
226
196
  "cfg-if",
227
197
  "indoc",
228
198
  "libc",
229
199
  "memoffset",
230
- "parking_lot",
200
+ "once_cell",
231
201
  "portable-atomic",
232
202
  "pyo3-build-config",
233
203
  "pyo3-ffi",
@@ -237,9 +207,9 @@ dependencies = [
237
207
 
238
208
  [[package]]
239
209
  name = "pyo3-build-config"
240
- version = "0.21.2"
210
+ version = "0.23.1"
241
211
  source = "registry+https://github.com/rust-lang/crates.io-index"
242
- checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
212
+ checksum = "80e3ce69c4ec34476534b490e412b871ba03a82e35604c3dfb95fcb6bfb60c09"
243
213
  dependencies = [
244
214
  "once_cell",
245
215
  "python3-dll-a",
@@ -248,9 +218,9 @@ dependencies = [
248
218
 
249
219
  [[package]]
250
220
  name = "pyo3-ffi"
251
- version = "0.21.2"
221
+ version = "0.23.1"
252
222
  source = "registry+https://github.com/rust-lang/crates.io-index"
253
- checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
223
+ checksum = "3b09f311c76b36dfd6dd6f7fa6f9f18e7e46a1c937110d283e80b12ba2468a75"
254
224
  dependencies = [
255
225
  "libc",
256
226
  "pyo3-build-config",
@@ -258,9 +228,9 @@ dependencies = [
258
228
 
259
229
  [[package]]
260
230
  name = "pyo3-macros"
261
- version = "0.21.2"
231
+ version = "0.23.1"
262
232
  source = "registry+https://github.com/rust-lang/crates.io-index"
263
- checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
233
+ checksum = "fd4f74086536d1e1deaff99ec0387481fb3325c82e4e48be0e75ab3d3fcb487a"
264
234
  dependencies = [
265
235
  "proc-macro2",
266
236
  "pyo3-macros-backend",
@@ -270,9 +240,9 @@ dependencies = [
270
240
 
271
241
  [[package]]
272
242
  name = "pyo3-macros-backend"
273
- version = "0.21.2"
243
+ version = "0.23.1"
274
244
  source = "registry+https://github.com/rust-lang/crates.io-index"
275
- checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
245
+ checksum = "9e77dfeb76b32bbf069144a5ea0a36176ab59c8db9ce28732d0f06f096bbfbc8"
276
246
  dependencies = [
277
247
  "heck",
278
248
  "proc-macro2",
@@ -292,9 +262,9 @@ dependencies = [
292
262
 
293
263
  [[package]]
294
264
  name = "quote"
295
- version = "1.0.33"
265
+ version = "1.0.36"
296
266
  source = "registry+https://github.com/rust-lang/crates.io-index"
297
- checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
267
+ checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
298
268
  dependencies = [
299
269
  "proc-macro2",
300
270
  ]
@@ -329,38 +299,17 @@ dependencies = [
329
299
  "getrandom",
330
300
  ]
331
301
 
332
- [[package]]
333
- name = "redox_syscall"
334
- version = "0.3.5"
335
- source = "registry+https://github.com/rust-lang/crates.io-index"
336
- checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
337
- dependencies = [
338
- "bitflags 1.3.2",
339
- ]
340
-
341
- [[package]]
342
- name = "scopeguard"
343
- version = "1.2.0"
344
- source = "registry+https://github.com/rust-lang/crates.io-index"
345
- checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
346
-
347
302
  [[package]]
348
303
  name = "sha1_smol"
349
304
  version = "1.0.0"
350
305
  source = "registry+https://github.com/rust-lang/crates.io-index"
351
306
  checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
352
307
 
353
- [[package]]
354
- name = "smallvec"
355
- version = "1.11.1"
356
- source = "registry+https://github.com/rust-lang/crates.io-index"
357
- checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
358
-
359
308
  [[package]]
360
309
  name = "syn"
361
- version = "2.0.43"
310
+ version = "2.0.68"
362
311
  source = "registry+https://github.com/rust-lang/crates.io-index"
363
- checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53"
312
+ checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9"
364
313
  dependencies = [
365
314
  "proc-macro2",
366
315
  "quote",
@@ -369,9 +318,9 @@ dependencies = [
369
318
 
370
319
  [[package]]
371
320
  name = "target-lexicon"
372
- version = "0.12.11"
321
+ version = "0.12.14"
373
322
  source = "registry+https://github.com/rust-lang/crates.io-index"
374
- checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a"
323
+ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
375
324
 
376
325
  [[package]]
377
326
  name = "typenum"
@@ -393,9 +342,9 @@ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
393
342
 
394
343
  [[package]]
395
344
  name = "uuid"
396
- version = "1.8.0"
345
+ version = "1.11.0"
397
346
  source = "registry+https://github.com/rust-lang/crates.io-index"
398
- checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
347
+ checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
399
348
  dependencies = [
400
349
  "atomic",
401
350
  "getrandom",
@@ -406,7 +355,7 @@ dependencies = [
406
355
 
407
356
  [[package]]
408
357
  name = "uuid-utils"
409
- version = "0.8.0"
358
+ version = "0.10.0"
410
359
  dependencies = [
411
360
  "mac_address",
412
361
  "pyo3",
@@ -447,60 +396,3 @@ name = "winapi-x86_64-pc-windows-gnu"
447
396
  version = "0.4.0"
448
397
  source = "registry+https://github.com/rust-lang/crates.io-index"
449
398
  checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
450
-
451
- [[package]]
452
- name = "windows-targets"
453
- version = "0.48.5"
454
- source = "registry+https://github.com/rust-lang/crates.io-index"
455
- checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
456
- dependencies = [
457
- "windows_aarch64_gnullvm",
458
- "windows_aarch64_msvc",
459
- "windows_i686_gnu",
460
- "windows_i686_msvc",
461
- "windows_x86_64_gnu",
462
- "windows_x86_64_gnullvm",
463
- "windows_x86_64_msvc",
464
- ]
465
-
466
- [[package]]
467
- name = "windows_aarch64_gnullvm"
468
- version = "0.48.5"
469
- source = "registry+https://github.com/rust-lang/crates.io-index"
470
- checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
471
-
472
- [[package]]
473
- name = "windows_aarch64_msvc"
474
- version = "0.48.5"
475
- source = "registry+https://github.com/rust-lang/crates.io-index"
476
- checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
477
-
478
- [[package]]
479
- name = "windows_i686_gnu"
480
- version = "0.48.5"
481
- source = "registry+https://github.com/rust-lang/crates.io-index"
482
- checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
483
-
484
- [[package]]
485
- name = "windows_i686_msvc"
486
- version = "0.48.5"
487
- source = "registry+https://github.com/rust-lang/crates.io-index"
488
- checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
489
-
490
- [[package]]
491
- name = "windows_x86_64_gnu"
492
- version = "0.48.5"
493
- source = "registry+https://github.com/rust-lang/crates.io-index"
494
- checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
495
-
496
- [[package]]
497
- name = "windows_x86_64_gnullvm"
498
- version = "0.48.5"
499
- source = "registry+https://github.com/rust-lang/crates.io-index"
500
- checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
501
-
502
- [[package]]
503
- name = "windows_x86_64_msvc"
504
- version = "0.48.5"
505
- source = "registry+https://github.com/rust-lang/crates.io-index"
506
- checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
@@ -0,0 +1,14 @@
1
+ [package]
2
+ name = "uuid-utils"
3
+ version = "0.10.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.23.1", features = ["extension-module", "generate-import-lib", 'abi3-py39'] }
13
+ rand = "0.8.5"
14
+ uuid = { version = "1.11.0", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
@@ -1,15 +1,15 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uuid_utils
3
- Version: 0.8.0
3
+ Version: 0.10.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
@@ -18,7 +18,7 @@ License-File: LICENSE.md
18
18
  Summary: Drop-in replacement for Python UUID 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
@@ -106,16 +106,18 @@ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
106
106
 
107
107
  ## Benchmarks
108
108
 
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) |
109
+ | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
110
+ |------------------|---------|---------|---------|-----------------|-----------------|-----------------|
111
+ | UUID v1 | 0.061 | 0.299 | 0.194 | 0.019 (3.3x) | 0.019 (15.4x) | 0.019 (10.1x) |
112
+ | UUID v3 | 0.267 | 0.307 | 0.293 | 0.035 (7.6x) | 0.041 (7.5x) | 0.039 (7.5x) |
113
+ | UUID v4 | 0.145 | 0.301 | 0.249 | 0.004 (38.5x) | 0.005 (54.8x) | 0.005 (53.0x) |
114
+ | UUID v5 | 0.058 | 0.189 | 0.146 | 0.008 (7.6x) | 0.038 (5.0x) | 0.016 (9.0x) |
115
+ | UUID from hex | 0.128 | 0.139 | 0.135 | 0.016 (8.2x) | 0.017 (8.0x) | 0.016 (8.3x) |
116
+ | UUID from bytes | 0.031 | 0.135 | 0.093 | 0.016 (2.0x) | 0.016 (8.6x) | 0.016 (5.9x) |
117
+ | UUID from int | 0.027 | 0.102 | 0.043 | 0.003 (8.3x) | 0.004 (25.0x) | 0.003 (12.4x) |
118
+ | UUID from fields | 0.031 | 0.162 | 0.077 | 0.005 (6.0x) | 0.005 (30.6x) | 0.005 (14.7x) |
119
+
120
+ <sup>Benchmark results might vary in different environments, but in most cases the uuid_utils should outperform stdlib uuid.</sup><br>
119
121
 
120
122
  ## How to develop locally
121
123
 
@@ -80,16 +80,18 @@ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
80
80
 
81
81
  ## Benchmarks
82
82
 
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) |
83
+ | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
84
+ |------------------|---------|---------|---------|-----------------|-----------------|-----------------|
85
+ | UUID v1 | 0.061 | 0.299 | 0.194 | 0.019 (3.3x) | 0.019 (15.4x) | 0.019 (10.1x) |
86
+ | UUID v3 | 0.267 | 0.307 | 0.293 | 0.035 (7.6x) | 0.041 (7.5x) | 0.039 (7.5x) |
87
+ | UUID v4 | 0.145 | 0.301 | 0.249 | 0.004 (38.5x) | 0.005 (54.8x) | 0.005 (53.0x) |
88
+ | UUID v5 | 0.058 | 0.189 | 0.146 | 0.008 (7.6x) | 0.038 (5.0x) | 0.016 (9.0x) |
89
+ | UUID from hex | 0.128 | 0.139 | 0.135 | 0.016 (8.2x) | 0.017 (8.0x) | 0.016 (8.3x) |
90
+ | UUID from bytes | 0.031 | 0.135 | 0.093 | 0.016 (2.0x) | 0.016 (8.6x) | 0.016 (5.9x) |
91
+ | UUID from int | 0.027 | 0.102 | 0.043 | 0.003 (8.3x) | 0.004 (25.0x) | 0.003 (12.4x) |
92
+ | UUID from fields | 0.031 | 0.162 | 0.077 | 0.005 (6.0x) | 0.005 (30.6x) | 0.005 (14.7x) |
93
+
94
+ <sup>Benchmark results might vary in different environments, but in most cases the uuid_utils should outperform stdlib uuid.</sup><br>
93
95
 
94
96
  ## How to develop locally
95
97
 
@@ -80,16 +80,18 @@ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
80
80
 
81
81
  ## Benchmarks
82
82
 
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) |
83
+ | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
84
+ |------------------|---------|---------|---------|-----------------|-----------------|-----------------|
85
+ | UUID v1 | 0.061 | 0.299 | 0.194 | 0.019 (3.3x) | 0.019 (15.4x) | 0.019 (10.1x) |
86
+ | UUID v3 | 0.267 | 0.307 | 0.293 | 0.035 (7.6x) | 0.041 (7.5x) | 0.039 (7.5x) |
87
+ | UUID v4 | 0.145 | 0.301 | 0.249 | 0.004 (38.5x) | 0.005 (54.8x) | 0.005 (53.0x) |
88
+ | UUID v5 | 0.058 | 0.189 | 0.146 | 0.008 (7.6x) | 0.038 (5.0x) | 0.016 (9.0x) |
89
+ | UUID from hex | 0.128 | 0.139 | 0.135 | 0.016 (8.2x) | 0.017 (8.0x) | 0.016 (8.3x) |
90
+ | UUID from bytes | 0.031 | 0.135 | 0.093 | 0.016 (2.0x) | 0.016 (8.6x) | 0.016 (5.9x) |
91
+ | UUID from int | 0.027 | 0.102 | 0.043 | 0.003 (8.3x) | 0.004 (25.0x) | 0.003 (12.4x) |
92
+ | UUID from fields | 0.031 | 0.162 | 0.077 | 0.005 (6.0x) | 0.005 (30.6x) | 0.005 (14.7x) |
93
+
94
+ <sup>Benchmark results might vary in different environments, but in most cases the uuid_utils should outperform stdlib uuid.</sup><br>
93
95
 
94
96
  ## How to develop locally
95
97
 
@@ -7,17 +7,17 @@ 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.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);
@@ -48,6 +52,7 @@ impl UUID {
48
52
  };
49
53
 
50
54
  #[new]
55
+ #[pyo3(signature = (hex=None, bytes=None, bytes_le=None, fields=None, int=None, version=None))]
51
56
  fn new(
52
57
  hex: Option<&str>,
53
58
  bytes: Option<&Bound<'_, PyBytes>>,
@@ -133,7 +138,7 @@ impl UUID {
133
138
  }
134
139
 
135
140
  pub fn __deepcopy__(&self, py: Python, _memo: &Bound<'_, PyDict>) -> Py<PyAny> {
136
- self.clone().into_py(py)
141
+ self.clone().into_pyobject(py).unwrap().into_any().unbind()
137
142
  }
138
143
 
139
144
  #[getter]
@@ -153,7 +158,7 @@ impl UUID {
153
158
  bytes[3], bytes[2], bytes[1], bytes[0], bytes[5], bytes[4], bytes[7], bytes[6],
154
159
  bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15],
155
160
  ];
156
- PyBytes::new_bound(py, &bytes)
161
+ PyBytes::new(py, &bytes)
157
162
  }
158
163
 
159
164
  #[getter]
@@ -305,9 +310,15 @@ impl UUID {
305
310
  uuid: Uuid::from_u128(int),
306
311
  })
307
312
  }
313
+
314
+ #[getter]
315
+ fn is_safe(&self) -> *mut ffi::PyObject {
316
+ return SAFE_UUID_UNKNOWN.load(Ordering::Relaxed);
317
+ }
308
318
  }
309
319
 
310
320
  #[pyfunction]
321
+ #[pyo3(signature = (node=None, clock_seq=None))]
311
322
  fn uuid1(node: Option<u64>, clock_seq: Option<u64>) -> PyResult<UUID> {
312
323
  let node = match node {
313
324
  Some(node) => node.to_ne_bytes(),
@@ -356,6 +367,7 @@ fn uuid5(namespace: &UUID, name: StringOrBytes) -> PyResult<UUID> {
356
367
  }
357
368
 
358
369
  #[pyfunction]
370
+ #[pyo3(signature = (node=None, timestamp=None, nanos=None))]
359
371
  fn uuid6(node: Option<u64>, timestamp: Option<u64>, nanos: Option<u32>) -> PyResult<UUID> {
360
372
  let node = match node {
361
373
  Some(node) => node.to_ne_bytes(),
@@ -377,6 +389,7 @@ fn uuid6(node: Option<u64>, timestamp: Option<u64>, nanos: Option<u32>) -> PyRes
377
389
  }
378
390
 
379
391
  #[pyfunction]
392
+ #[pyo3(signature = (timestamp=None, nanos=None))]
380
393
  fn uuid7(timestamp: Option<u64>, nanos: Option<u32>) -> PyResult<UUID> {
381
394
  let uuid = match timestamp {
382
395
  Some(timestamp) => {
@@ -425,6 +438,9 @@ fn _getnode() -> u64 {
425
438
  node
426
439
  }
427
440
 
441
+ // ptr to python stdlib uuid.SafeUUID.unknown
442
+ static SAFE_UUID_UNKNOWN: AtomicPtr<ffi::PyObject> = AtomicPtr::new(null_mut());
443
+
428
444
  #[pyfunction]
429
445
  fn getnode() -> PyResult<u64> {
430
446
  Ok(_getnode())
@@ -432,6 +448,18 @@ fn getnode() -> PyResult<u64> {
432
448
 
433
449
  #[pymodule]
434
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
+
435
463
  m.add("__version__", env!("CARGO_PKG_VERSION"))?;
436
464
  m.add_class::<UUID>()?;
437
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.8.0"
4
- edition = "2021"
5
-
6
- [lib]
7
- name = "uuid_utils"
8
- crate-type = ["cdylib"]
9
-
10
- [dependencies]
11
- mac_address = "1.1.6"
12
- pyo3 = { version = "0.21.2", features = ["extension-module", "generate-import-lib"] }
13
- rand = "0.8.5"
14
- uuid = { version = "1.8.0", 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
File without changes