Skip to content

Commit 7072430

Browse files
emmatypingwarsawAA-Turnergpshead
authored
PEP 784: Mark as Accepted (#4387)
* PEP 784: Remove deprecation and removal timeline As requested by the Steering Council * Add suggestion from Barry Co-authored-by: Barry Warsaw <[email protected]> * Mark PEP 784 accepted * Add a second underline for resolution link * Use shorter form of discuss URL Co-authored-by: Adam Turner <[email protected]> * Add no sooner than verbiage * Mention the compression sub-modules should be canonical * Include statement on documentation Co-authored-by: "Gregory P. Smith" <[email protected]> * Update _compression rename to reflect review --------- Co-authored-by: Barry Warsaw <[email protected]> Co-authored-by: Adam Turner <[email protected]> Co-authored-by: "Gregory P. Smith" <[email protected]>
1 parent 06c4421 commit 7072430

File tree

1 file changed

+17
-31
lines changed

1 file changed

+17
-31
lines changed

peps/pep-0784.rst

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ Title: Adding Zstandard to the standard library
33
Author: Emma Harper Smith <[email protected]>
44
Sponsor: Gregory P. Smith <[email protected]>
55
Discussions-To: https://discuss.python.org/t/87377
6-
Status: Draft
6+
Status: Accepted
77
Type: Standards Track
88
Created: 06-Apr-2025
99
Python-Version: 3.14
1010
Post-History:
1111
`07-Apr-2025 <https://discuss.python.org/t/87377>`__,
12+
Resolution: `25-Apr-2025 <https://discuss.python.org/t/87377/138>`__
1213

1314

1415
Abstract
@@ -115,9 +116,8 @@ Both the ``zstd`` and ``zstandard`` import names are claimed by projects on
115116
PyPI. To avoid breaking users of one of the existing bindings, this PEP
116117
proposes introducing a new namespace for compression libraries,
117118
``compression``. This name is already reserved on PyPI for use in the
118-
standard library. The new Zstandard module will be ``compression.zstd``.
119-
Other compression modules will be re-exported to the ``compression`` namespace
120-
and their current import names will be deprecated.
119+
standard library. The new Zstandard module will be named ``compression.zstd``.
120+
Other compression modules will be re-exported in the new ``compression`` package.
121121

122122
Providing a common namespace for compression modules has several advantages.
123123
First, it reduces user confusion about where to find compression modules.
@@ -220,38 +220,25 @@ Other compression modules
220220
New import names ``compression.lzma``, ``compression.bz2``,
221221
``compression.gzip`` and ``compression.zlib`` will be introduced in Python 3.14
222222
re-exporting the contents of the existing ``lzma``, ``bz2``, ``gzip`` and
223-
``zlib`` modules respectively.
223+
``zlib`` modules respectively. The ``compression`` sub-modules will become
224+
the canonical import names going forward. The use of the new compression names
225+
will be promoted over the original top level module names in the Python
226+
documentation when the minimum supported Python version requirements make
227+
that feasible.
224228

225229
The ``_compression`` module, given that it is marked private, will be
226-
immediately renamed to ``compression._common.streams``. The new name was
230+
immediately renamed to ``compression._common._streams``. The new name was
227231
selected due to the current contents of the module being I/O related helpers
228232
for stream APIs (e.g. ``LZMAFile``) in standard library compression modules.
229233

230-
Compression module migration timeline
231-
-------------------------------------
232-
233-
Existing modules will emit a ``DeprecationWarning`` in the Python
234-
release following the last Python without the ``compression`` module leaving
235-
support. For example, if the ``compression`` namespace is introduced in 3.14,
236-
then the ``DeprecationWarnings`` would be emitted in 3.19, the next release
237-
after 3.13 reaches end of life. These warnings would begin five years after the
238-
introduction of ``compression`` namespace. In accordance with :pep:`387`, in
239-
Python 3.24, five years after the ``DeprecationWarnings`` are added and ten
240-
years after the new ``compression`` namespace is introduced, the existing
241-
modules will be removed and code must use the ``compression`` sub-modules. The
242-
documentation for these modules will be updated to discuss the planned
243-
deprecation and removal timelines.
244-
245234

246235
Backwards Compatibility
247236
=======================
248237

249-
The main compatibility concern is usage of existing standard library
250-
compression APIs with the existing import names. These names will be
251-
deprecated in 3.19 and will be removed in 3.24. Given the long coexistence of
252-
the modules and a 5 year deprecation period, most users will likely migrate to
253-
the new import names well before then. Additionally, a libCST codemod can be
254-
provided to automatically rewrite imports, easing the migration.
238+
This PEP introduces no backwards incompatible changes. There are currently no
239+
plans to deprecate or remove the existing compression modules. Any deprecation
240+
or removal of the existing modules is left to a future decision but will occur
241+
no sooner than 5 years from the acceptance of this PEP.
255242

256243

257244
Security Implications
@@ -273,8 +260,8 @@ How to Teach This
273260
=================
274261

275262
Documentation for the new module is in the reference implementation branch. The
276-
documentation for other modules will be updated to discuss the deprecation of
277-
their existing import names, and how to migrate.
263+
documentation for existing modules will be updated to reference the new names
264+
as well.
278265

279266

280267
Reference Implementation
@@ -284,8 +271,7 @@ The `reference implementation <https://github.com/emmatyping/cpython/tree/zstd>`
284271
contains the ``_zstd`` C code, the ``compression.zstd`` code, modifications to
285272
``tarfile``, ``shutil``, and ``zipfile``, and tests for each new API and
286273
integration added. It also contains the re-exports of other compression
287-
modules. Deprecations for the existing import names will be added once a
288-
decision is reached regarding the open issues.
274+
modules.
289275

290276

291277
Rejected Ideas

0 commit comments

Comments
 (0)