1- :mod: `!uuid ` --- UUID objects according to :rfc: `4122 `
1+ :mod: `!uuid ` --- UUID objects according to :rfc: `9562 `
22======================================================
33
44.. module :: uuid
5- :synopsis: UUID objects (universally unique identifiers) according to RFC 4122
5+ :synopsis: UUID objects (universally unique identifiers) according to RFC 9562
66..
moduleauthor ::
Ka-Ping Yee <[email protected] > 77..
sectionauthor ::
George Yoshida <[email protected] > 88
1212
1313This module provides immutable :class: `UUID ` objects (the :class: `UUID ` class)
1414and the functions :func: `uuid1 `, :func: `uuid3 `, :func: `uuid4 `, :func: `uuid5 ` for
15- generating version 1, 3, 4, and 5 UUIDs as specified in :rfc: `4122 `.
15+ generating version 1, 3, 4, 5, and 8 UUIDs as specified in :rfc: `9562 ` (which
16+ supersedes :rfc: `4122 `).
1617
1718If all you want is a unique ID, you should probably call :func: `uuid1 ` or
1819:func: `uuid4 `. Note that :func: `uuid1 ` may compromise privacy since it creates
@@ -65,7 +66,7 @@ which relays any information about the UUID's safety, using this enumeration:
6566
6667 Exactly one of *hex *, *bytes *, *bytes_le *, *fields *, or *int * must be given.
6768 The *version * argument is optional; if given, the resulting UUID will have its
68- variant and version number set according to :rfc: `4122 `, overriding bits in the
69+ variant and version number set according to :rfc: `9562 `, overriding bits in the
6970 given *hex *, *bytes *, *bytes_le *, *fields *, or *int *.
7071
7172 Comparison of UUID objects are made by way of comparing their
@@ -137,7 +138,7 @@ which relays any information about the UUID's safety, using this enumeration:
137138
138139.. attribute :: UUID.urn
139140
140- The UUID as a URN as specified in :rfc: `4122 `.
141+ The UUID as a URN as specified in :rfc: `9562 `.
141142
142143
143144.. attribute :: UUID.variant
@@ -149,9 +150,13 @@ which relays any information about the UUID's safety, using this enumeration:
149150
150151.. attribute :: UUID.version
151152
152- The UUID version number (1 through 5 , meaningful only when the variant is
153+ The UUID version number (1 through 8 , meaningful only when the variant is
153154 :const: `RFC_4122 `).
154155
156+ .. versionchanged :: next
157+ Added UUID version 8.
158+
159+
155160.. attribute :: UUID.is_safe
156161
157162 An enumeration of :class: `SafeUUID ` which indicates whether the platform
@@ -216,6 +221,23 @@ The :mod:`uuid` module defines the following functions:
216221
217222.. index :: single: uuid5
218223
224+
225+ .. function :: uuid8(a=None, b=None, c=None)
226+
227+ Generate a pseudo-random UUID according to
228+ :rfc: `RFC 9562, §5.8 <9562#section-5.8 >`.
229+
230+ When specified, the parameters *a *, *b * and *c * are expected to be
231+ positive integers of 48, 12 and 62 bits respectively. If they exceed
232+ their expected bit count, only their least significant bits are kept;
233+ non-specified arguments are substituted for a pseudo-random integer of
234+ appropriate size.
235+
236+ .. versionadded :: next
237+
238+ .. index :: single: uuid8
239+
240+
219241The :mod: `uuid ` module defines the following namespace identifiers for use with
220242:func: `uuid3 ` or :func: `uuid5 `.
221243
@@ -252,7 +274,9 @@ of the :attr:`~UUID.variant` attribute:
252274
253275.. data :: RFC_4122
254276
255- Specifies the UUID layout given in :rfc: `4122 `.
277+ Specifies the UUID layout given in :rfc: `4122 `. This constant is kept
278+ for backward compatibility even though :rfc: `4122 ` has been superseded
279+ by :rfc: `9562 `.
256280
257281
258282.. data :: RESERVED_MICROSOFT
@@ -267,7 +291,7 @@ of the :attr:`~UUID.variant` attribute:
267291
268292.. seealso ::
269293
270- :rfc: `4122 ` - A Universally Unique IDentifier (UUID) URN Namespace
294+ :rfc: `9562 ` - A Universally Unique IDentifier (UUID) URN Namespace
271295 This specification defines a Uniform Resource Name namespace for UUIDs, the
272296 internal format of UUIDs, and methods of generating UUIDs.
273297
@@ -283,7 +307,7 @@ The :mod:`uuid` module can be executed as a script from the command line.
283307
284308.. code-block :: sh
285309
286- python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]
310+ python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid8 }] [-n NAMESPACE] [-N NAME]
287311
288312 The following options are accepted:
289313
0 commit comments