@@ -71,6 +71,7 @@ Summary -- release highlights
71
71
* :ref: `PEP 761: Discontinuation of PGP signatures <whatsnew314-pep761 >`
72
72
* :ref: `PEP 765: Disallow return/break/continue that exit a finally block <whatsnew314-pep765 >`
73
73
* :ref: `PEP 768: Safe external debugger interface for CPython <whatsnew314-pep768 >`
74
+ * :ref: `PEP 784: Adding Zstandard to the standard library <whatsnew314-pep784 >`
74
75
* :ref: `A new type of interpreter <whatsnew314-tail-call >`
75
76
* :ref: `Syntax highlighting in PyREPL <whatsnew314-pyrepl-highlighting >`,
76
77
and color output in :ref: `unittest <whatsnew314-color-unittest >`,
@@ -232,6 +233,51 @@ See :pep:`768` for more details.
232
233
233
234
(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic in :gh: `131591 `.)
234
235
236
+ .. _whatsnew314-pep784 :
237
+
238
+ PEP 784: Adding Zstandard to the standard library
239
+ -------------------------------------------------
240
+
241
+ The new ``compression `` package contains modules :mod: `!compression.lzma `,
242
+ :mod: `!compression.bz2 `, :mod: `!compression.gzip ` and :mod: `!compression.zlib `
243
+ which re-export the :mod: `lzma `, :mod: `bz2 `, :mod: `gzip ` and :mod: `zlib `
244
+ modules respectively. The new import names under ``compression `` are the
245
+ canonical names for importing these compression modules going forward. However,
246
+ the existing modules names have not been deprecated. Any deprecation or removal
247
+ of the existing compression modules will occur no sooner than five years after
248
+ the release of 3.14.
249
+
250
+ The new :mod: `!compression.zstd ` module provides compression and decompression
251
+ APIs for the Zstandard format via bindings to `Meta's zstd library
252
+ <https://facebook.github.io/zstd/> `__. Zstandard is a widely adopted, highly
253
+ efficient, and fast compression format. In addition to the APIs introduced in
254
+ :mod: `!compression.zstd `, support for reading and writing Zstandard compressed
255
+ archives has been added to the :mod: `tarfile `, :mod: `zipfile `, and
256
+ :mod: `shutil ` modules.
257
+
258
+ Here's an example of using the new module to compress some data:
259
+
260
+ .. code-block :: python
261
+
262
+ from compression import zstd
263
+ import math
264
+
265
+ data = str (math.pi).encode() * 20
266
+
267
+ compressed = zstd.compress(data)
268
+
269
+ ratio = len (compressed) / len (data)
270
+ print (f " Achieved compression ratio of { ratio} " )
271
+
272
+ As can be seen, the API is similar to the APIs of the :mod: `!lzma ` and
273
+ :mod: `!bz2 ` modules.
274
+
275
+ (Contributed by Emma Harper Smith, Adam Turner, Gregory P. Smith, Tomas Roun,
276
+ Victor Stinner, and Rogdham in :gh: `132983 `)
277
+
278
+ .. seealso ::
279
+ :pep: `768 `.
280
+
235
281
236
282
.. _whatsnew314-remote-pdb :
237
283
907
953
(Contributed by Irit Katriel in :gh: `123958 `.)
908
954
909
955
* The ``repr() `` output for AST nodes now includes more information.
910
- (Contributed by Tomas R in :gh: `116022 `.)
956
+ (Contributed by Tomas Roun in :gh: `116022 `.)
911
957
912
958
* :func: `ast.parse `, when called with an AST as input, now always verifies
913
959
that the root node type is appropriate.
0 commit comments