1111--------------
1212
1313This module provides immutable :class: `UUID ` objects (the :class: `UUID ` class)
14- and the functions :func: `uuid1 `, :func: `uuid3 `, :func: `uuid4 `, :func: `uuid5 `,
15- :func: `uuid6 `, and :func: `uuid8 ` for generating version 1, 3, 4, 5, 6,
16- and 8 UUIDs as specified in :rfc: `9562 ` (which supersedes :rfc: `4122 `).
14+ and :ref: `functions <uuid-factory-functions >` for generating UUIDs corresponding
15+ to a specific UUID version as specified in :rfc: `9562 ` (which supersedes :rfc: `4122 `),
16+ for example, :func: `uuid1 ` for UUID version 1, :func: `uuid3 ` for UUID version 3, and so on.
17+ Note that UUID version 2 is deliberately omitted as it is outside the scope of the RFC.
1718
1819If all you want is a unique ID, you should probably call :func: `uuid1 ` or
1920:func: `uuid4 `. Note that :func: `uuid1 ` may compromise privacy since it creates
@@ -154,7 +155,7 @@ which relays any information about the UUID's safety, using this enumeration:
154155 :const: `RFC_4122 `).
155156
156157 .. versionchanged :: next
157- Added UUID versions 6 and 8.
158+ Added UUID versions 6, 7 and 8.
158159
159160
160161.. attribute :: UUID.is_safe
@@ -185,6 +186,8 @@ The :mod:`uuid` module defines the following functions:
185186 globally unique, while the latter are not.
186187
187188
189+ .. _uuid-factory-functions :
190+
188191.. function :: uuid1(node=None, clock_seq=None)
189192
190193 Generate a UUID from a host ID, sequence number, and the current time. If *node *
@@ -228,6 +231,18 @@ The :mod:`uuid` module defines the following functions:
228231 .. versionadded :: next
229232
230233
234+ .. function :: uuid7()
235+
236+ Generate a time-based UUID according to
237+ :rfc: `RFC 9562, §5.7 <9562#section-5.7 >`.
238+
239+ For portability across platforms lacking sub-millisecond precision, UUIDs
240+ produced by this function embed a 48-bit timestamp and use a 42-bit counter
241+ to guarantee monotonicity within a millisecond.
242+
243+ .. versionadded :: next
244+
245+
231246.. function :: uuid8(a=None, b=None, c=None)
232247
233248 Generate a pseudo-random UUID according to
@@ -330,7 +345,7 @@ The :mod:`uuid` module can be executed as a script from the command line.
330345
331346.. code-block :: sh
332347
333- python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid6,uuid8}] [-n NAMESPACE] [-N NAME]
348+ python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid6,uuid7, uuid8}] [-n NAMESPACE] [-N NAME]
334349
335350 The following options are accepted:
336351
@@ -347,7 +362,7 @@ The following options are accepted:
347362 is used.
348363
349364 .. versionchanged :: next
350- Allow generating UUID versions 6 and 8.
365+ Allow generating UUID versions 6, 7 and 8.
351366
352367.. option :: -n <namespace >
353368 --namespace <namespace>
0 commit comments