uuid-utils 0.5.0__cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.7.0__cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of uuid-utils might be problematic. Click here for more details.

uuid_utils/__init__.py CHANGED
@@ -9,6 +9,7 @@ from ._uuid_utils import (
9
9
  RFC_4122,
10
10
  UUID,
11
11
  __version__,
12
+ getnode,
12
13
  uuid1,
13
14
  uuid3,
14
15
  uuid4,
@@ -29,6 +30,7 @@ __all__ = [
29
30
  "RFC_4122",
30
31
  "UUID",
31
32
  "__version__",
33
+ "getnode",
32
34
  "uuid1",
33
35
  "uuid3",
34
36
  "uuid4",
uuid_utils/__init__.pyi CHANGED
@@ -112,6 +112,7 @@ class UUID:
112
112
  """Get UUID timestamp milliseconds since epoch.
113
113
  Only works for UUID versions 1, 6 and 7, otherwise raises ValueError."""
114
114
  ...
115
+
115
116
  @property
116
117
  def urn(self) -> str: ...
117
118
  @property
@@ -131,7 +132,7 @@ if sys.version_info >= (3, 9):
131
132
  else:
132
133
  def getnode(*, getters: Unused = None) -> int: ... # undocumented
133
134
 
134
- def uuid1(node: _Int, clock_seq: _Int | None = None) -> UUID:
135
+ def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID:
135
136
  """Generate a UUID from a host ID, sequence number, and the current time.
136
137
  If 'node' is not given, getnode() is used to obtain the hardware
137
138
  address. If 'clock_seq' is given, it is used as the sequence number;
@@ -150,7 +151,7 @@ def uuid5(namespace: UUID, name: str) -> UUID:
150
151
  """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
151
152
  ...
152
153
 
153
- def uuid6(node: _Int, timestamp: _Int | None = None) -> UUID:
154
+ def uuid6(node: _Int | None = None, timestamp: _Int | None = None) -> UUID:
154
155
  """Generate a version 6 UUID using the given timestamp and a host ID.
155
156
  This is similar to version 1 UUIDs,
156
157
  except that it is lexicographically sortable by timestamp.
@@ -0,0 +1,77 @@
1
+ from uuid import (
2
+ NAMESPACE_DNS,
3
+ NAMESPACE_OID,
4
+ NAMESPACE_URL,
5
+ NAMESPACE_X500,
6
+ RESERVED_FUTURE,
7
+ RESERVED_MICROSOFT,
8
+ RESERVED_NCS,
9
+ RFC_4122,
10
+ UUID,
11
+ getnode,
12
+ )
13
+
14
+ import uuid_utils
15
+
16
+ __all__ = [
17
+ "NAMESPACE_DNS",
18
+ "NAMESPACE_OID",
19
+ "NAMESPACE_URL",
20
+ "NAMESPACE_X500",
21
+ "RESERVED_FUTURE",
22
+ "RESERVED_MICROSOFT",
23
+ "RESERVED_NCS",
24
+ "RFC_4122",
25
+ "UUID",
26
+ "getnode",
27
+ "uuid1",
28
+ "uuid3",
29
+ "uuid4",
30
+ "uuid5",
31
+ "uuid6",
32
+ "uuid7",
33
+ "uuid8",
34
+ ]
35
+
36
+
37
+ def uuid1(node=None, clock_seq=None):
38
+ """Generate a UUID from a host ID, sequence number, and the current time.
39
+ If 'node' is not given, getnode() is used to obtain the hardware
40
+ address. If 'clock_seq' is given, it is used as the sequence number;
41
+ otherwise a random 14-bit sequence number is chosen."""
42
+ return UUID(int=uuid_utils.uuid1(node, clock_seq).int)
43
+
44
+
45
+ def uuid3(namespace, name):
46
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
47
+ namespace = uuid_utils.UUID(namespace.hex) if namespace else namespace
48
+ return UUID(int=uuid_utils.uuid3(namespace, name).int)
49
+
50
+
51
+ def uuid4():
52
+ """Generate a random UUID."""
53
+ return UUID(int=uuid_utils.uuid4().int)
54
+
55
+
56
+ def uuid5(namespace, name):
57
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
58
+ namespace = uuid_utils.UUID(namespace.hex) if namespace else namespace
59
+ return UUID(int=uuid_utils.uuid5(namespace, name).int)
60
+
61
+
62
+ def uuid6(node=None, timestamp=None):
63
+ """Generate a version 6 UUID using the given timestamp and a host ID.
64
+ This is similar to version 1 UUIDs,
65
+ except that it is lexicographically sortable by timestamp.
66
+ """
67
+ return UUID(int=uuid_utils.uuid6(node, timestamp).int)
68
+
69
+
70
+ def uuid7(timestamp=None):
71
+ """Generate a version 7 UUID using a time value and random bytes."""
72
+ return UUID(int=uuid_utils.uuid7(timestamp).int)
73
+
74
+
75
+ def uuid8(bytes):
76
+ """Generate a custom UUID comprised almost entirely of user-supplied bytes.."""
77
+ return UUID(bytes=uuid_utils.uuid8(bytes).bytes)
@@ -0,0 +1,41 @@
1
+ from uuid import UUID
2
+
3
+ from typing_extensions import TypeAlias
4
+
5
+ # Because UUID has properties called int and bytes we need to rename these temporarily.
6
+ _Int: TypeAlias = int
7
+ _Bytes: TypeAlias = bytes
8
+
9
+ def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID:
10
+ """Generate a UUID from a host ID, sequence number, and the current time.
11
+ If 'node' is not given, getnode() is used to obtain the hardware
12
+ address. If 'clock_seq' is given, it is used as the sequence number;
13
+ otherwise a random 14-bit sequence number is chosen."""
14
+ ...
15
+
16
+ def uuid3(namespace: UUID, name: str) -> UUID:
17
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
18
+ ...
19
+
20
+ def uuid4() -> UUID:
21
+ """Generate a random UUID."""
22
+ ...
23
+
24
+ def uuid5(namespace: UUID, name: str) -> UUID:
25
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
26
+ ...
27
+
28
+ def uuid6(node: _Int | None = None, timestamp: _Int | None = None) -> UUID:
29
+ """Generate a version 6 UUID using the given timestamp and a host ID.
30
+ This is similar to version 1 UUIDs,
31
+ except that it is lexicographically sortable by timestamp.
32
+ """
33
+ ...
34
+
35
+ def uuid7(timestamp: _Int | None = None) -> UUID:
36
+ """Generate a version 7 UUID using a time value and random bytes."""
37
+ ...
38
+
39
+ def uuid8(bytes: _Bytes) -> UUID:
40
+ """Generate a custom UUID comprised almost entirely of user-supplied bytes.."""
41
+ ...
@@ -1,11 +1,10 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: uuid_utils
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Programming Language :: Python
6
6
  Classifier: Programming Language :: Python :: 3
7
7
  Classifier: Programming Language :: Python :: 3 :: Only
8
- Classifier: Programming Language :: Python :: 3.7
9
8
  Classifier: Programming Language :: Python :: 3.8
10
9
  Classifier: Programming Language :: Python :: 3.9
11
10
  Classifier: Programming Language :: Python :: 3.10
@@ -19,7 +18,7 @@ License-File: LICENSE.md
19
18
  Summary: Drop-in replacement for Python UUID in Rust
20
19
  Keywords: rust,uuid
21
20
  Author-email: Amin Alaee <me@aminalaee.dev>
22
- Requires-Python: >=3.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
@@ -85,6 +84,21 @@ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
85
84
  UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
86
85
  ```
87
86
 
87
+ ## Compat module
88
+
89
+ In some cases you might need `UUID` instances to be returned
90
+ from the standrad-library `uuid`, not a custom `UUID` class.
91
+ In that case you can use the `uuid_utils.compat` which comes with a performance penalty
92
+ in comparison with the `uuid_utils` default behaviour, but still faster than the standard-library.
93
+
94
+ ```py
95
+ >>> import uuid_utils.compat as uuid
96
+
97
+ >>> # make a random UUID
98
+ >>> uuid.uuid4()
99
+ UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
100
+ ```
101
+
88
102
  ## Benchmarks
89
103
 
90
104
  | Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
@@ -98,11 +112,6 @@ UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
98
112
  | UUID from int | 0.024 | 0.025 | 0.024 | 0.004 (6.6x) | 0.004 (6.7x) | 0.004 (6.6x) |
99
113
  | UUID from fields | 0.028 | 0.028 | 0.028 | 0.009 (3.1x) | 0.009 (3.1x) | 0.009 (3.1x) |
100
114
 
101
- ## Limitations
102
-
103
- - The `getnode` function is not available.
104
- - The `uuid1` and `uuid6` take `node` argument as mandatory.
105
-
106
115
  ## How to develop locally
107
116
 
108
117
  ```shell
@@ -0,0 +1,10 @@
1
+ uuid_utils-0.7.0.dist-info/METADATA,sha256=XpVI7UmfHTsaPEOz1jRzrKQs_8jnpcz8o6G0mRjX3h8,4625
2
+ uuid_utils-0.7.0.dist-info/WHEEL,sha256=rJezEO0Z6B0QBj60bTuiXzpiVI01fMNi1FiYZLZjFxw,131
3
+ uuid_utils-0.7.0.dist-info/license_files/LICENSE.md,sha256=DEf1K0xIS9BMeOfJaVQu6jGv5kT1h_O4qMzOhjUsYEY,1487
4
+ uuid_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ uuid_utils/__init__.py,sha256=teEvYB7oh34wISOjZYdA011-7VdeLKfQGjR615_-lCc,622
6
+ uuid_utils/__init__.pyi,sha256=JNQmgdNecusC7zFZiZTosO9d08yGm3sOCITC6PHF2P4,6058
7
+ uuid_utils/compat/__init__.py,sha256=-pGwZJmEoRzNmqteXXtcbjzO7KO3-xekYT02GjImtmM,2071
8
+ uuid_utils/compat/__init__.pyi,sha256=msxBDRkxWjdSRFmCeP2O2J6pib2qkJoZEaoC5hcF8X8,1425
9
+ uuid_utils/_uuid_utils.cpython-311-aarch64-linux-gnu.so,sha256=9OtFDOU-StU7ts-FTy5BJFBXxRVKL8Bo5oup6zGRxCA,4323224
10
+ uuid_utils-0.7.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (0.14.17)
2
+ Generator: maturin (1.5.1)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64
@@ -1,8 +0,0 @@
1
- uuid_utils-0.5.0.dist-info/METADATA,sha256=oTJvPKqcYD0d23O_u43U20lRwhiNa-ayVb0pSTlLXyI,4332
2
- uuid_utils-0.5.0.dist-info/WHEEL,sha256=BXhO_vhZOGzuyJiMsN_GnH_bKFMJs3L1-eHaUxgfIlI,133
3
- uuid_utils-0.5.0.dist-info/license_files/LICENSE.md,sha256=DEf1K0xIS9BMeOfJaVQu6jGv5kT1h_O4qMzOhjUsYEY,1487
4
- uuid_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- uuid_utils/__init__.py,sha256=adoYcivUSWA1NMO6LVfiScSX0M8vZXL7FS1U5_RQLgI,594
6
- uuid_utils/__init__.pyi,sha256=7WNYMV1MpcpPwaVhkUBTnZlbbr-3FrX3mkHZ1_yiF2Q,6029
7
- uuid_utils/_uuid_utils.cpython-311-aarch64-linux-gnu.so,sha256=rSsnu1GVc3AG2eq-4xv_RWDfJWkLvu1hB1bFbrkEC1k,5207224
8
- uuid_utils-0.5.0.dist-info/RECORD,,