Skip to content

Latest commit

 

History

History
584 lines (464 loc) · 12 KB

pep-9999.rst

File metadata and controls

584 lines (464 loc) · 12 KB

PEP: 9999 Title: Removing dead batteries from the standard library Author: Christian Heimes <[email protected]> Status: Active Type: Process Content-Type: text/x-rst Created: 04-Feb-2018 Post-History:

Abstract

This PEP provides a list of standard library modules that will be removed from the standard library eventually.

Rationale

Back in the early days of Python, the interpreter came with a large set of useful modules. This was often refrained to as "batteries included" philosophy and was one of the corner stones to Python's success story. Users didn't have to figure out how to download and install separate packages in order to write a simple web server or parse email.

Times have changed. The introduction of the cheese shop (PyPI), setuptools, and later pip, it became simple and straight forward to download and install packages. Nowadays Python has a rich and vibrant ecosystem of third party packages. It's pretty much standard to either install packages from PyPI or use one of the many Python or Linux distributions.

On the other hand, Python's standard library is piling up cruft, unnecessary duplication of functionality, and dispensable features.

Deprecated modules

Data encoding modules

binhex

The binhex module encodes and decodes Apple Macintosh binhex4 data.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

uu

The uu module provides uuencode format, an old binary encoding format for email from 1980. The uu format has been replaced by MIME. The uu codec is provided by the binascii module.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

xdrlib

The xdrlib module supports the Sun External Data Representation Standard. XDR is an old binary serialization format from 1987. These days it's rarely used outside specialized domains like NFS.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

Multimedia modules

aifc

The aifc module provides support for reading and writing AIFF and AIFF-C files. The Audio Interchange File Format is an old audio format from 1988 based on Amiga IFF. It was most commonly used on the Apple Macintosh. These days only few specialized application use AIFF.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

audioop

The audioop module contains helper functions to manipulate raw audio data and adaptive differential pulse-code modulated audio data.

Module type
C extension
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

colorsys

The colorsys module defines color conversion functions between RGB, YIQ, HLS, and HSV coordinate systems.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

chunk

The chunk module provides support for reading and writing Electronic Arts' Interchange File Format. IFF is an old audio file format originally introduced for Commodore and Amiga. The format is no longer relevant.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

imghdr

The imghdr module is a simple tool to guess the image file format from the first 32 bytes of a file or buffer. It supports only a limited amount of formats and neither returns resolution nor color depth.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

ossaudiodev

The ossaudiodev module provides support for Open Sound System, an interface to sound playback and capture devices. OSS was initially free software, but later support for newer sound devices and improvements were proprietary. Linux community abandoned OSS in favor of ALSA [1]. Some operation systems like OpenBSD and NetBSD provide an incomplete [2] emulation of OSS.

Module type
C extension
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

sndhdr

The sndhdr module is similar to the imghdr module but for audio formats. It guesses file format, channels, frame rate, and sample widths from the first 512 bytes of a file or buffer. THe module only supports AU, AIFF, HCOM, VOC, WAV, and other ancient formats.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

sunau

The sunau module provides support for Sun AU sound format. It's yet another old, obsolete file format.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

wave

The wave module provides support for the WAV sound format.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

Networking modules

asynchat

The asynchat module is build on top of asyncore and has been deprecated since Python 3.6.

Module type
pure Python
Deprecated in
3.6
Removed in
n/a
Substitute
asyncio

asyncore

The asyncore module was the first module for asynchronous socket service clients and servers. It has been replaced by asyncio and is deprecated since Python 3.6.

Module type
pure Python
Deprecated in
3.6
Removed in
n/a
Substitute
asyncio

cgi

The cgi module is a support module for Common Gateway Interface (CGI) scripts. CGI is deemed as inefficient because every incoming request is handled in a new process. PEP 206 considers the module as designed poorly and are now near-impossible to fix.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

cgitb

The cgitb module is a helper for the cgi module for configurable tracebacks.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

Operating system interface

crypt

The crypt module implements password hashing based on crypt(3) function from libcrypt or libxcrypt on Unix-like platform. The algorithms are mostly old, of poor quality and insecure. Users are discouraged to use them.

Module type
C extension
Deprecated in
n/a
Removed in
n/a
Substitute
legacycrypt (external), passlib

macpath

The macpath module provides Mac OS 9 implementation of os.path routines. Mac OS 9 is no longer supported

Module type
pure Python
Deprecated in
3.7
Removed in
3.8
Substitute
none

nis

The nis module provides NIS/YP support. Network Information Service / Yellow Pages is an old and deprecated directory service protocol developed by Sun Microsystems. It's designed successor NIS+ from 1992 never took off. For a long time, libc's Name Service Switch, LDAP, and Kerberos/GSSAPI are considered a more powerful and more secure replacement of NIS.

Module type
C extension
Deprecated in
n/a
Removed in
n/a
Substitute
none

spwd

The spwd module provides direct access to Unix shadow password database using non-standard APIs. In general it's a bad idea to use the spwd. The spwd circumvents system security policies, it does not use the PAM stack, and is only compatible with local user accounts.

Module type
C extension
Deprecated in
n/a
Removed in
n/a
Substitute
none

Misc modules

fileinput

The fileinput module implements a helpers to iterate over a list of files from sys.argv. The module predates the optparser and argparser module. The same functionality can be implemented with the argparser module.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

formatter

The formatter module is an old text formatting module which has been deprecated since Python 3.4.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

imp

The imp module is the predecessor of the importlib module. Most functions have been deprecated since Python 3.3 and the module since Python 3.4.

Module type
C extension
Deprecated in
3.4
Removed in
n/a
Substitute
importlib

lib2to3

The lib2to3 package provides the 2to3 command to transpile Python 2 code to Python 3 code.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

msilib

The msilib package is a Windows-only package. It supports the creation of Microsoft Installers (MSI). The package also exposes additional APIs to create cabinet files (CAB). The module is used to facilitate distutils to create MSI installers with bdist_msi command. In the past it was used to create CPython's official Windows installer, too.

Microsoft is slowly moving away from MSI in favor of Windows 10 Apps (AppX) as new deployment model [3].

Module type
C extension + Python code
Deprecated in
n/a
Removed in
n/a
Substitute
n/a

pipes

The pipes module provides helpers to pipe the input of one command into the output of another command. The module is built on top of os.popen. Users are encouraged to use the subprocess module instead.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
subprocess module

Removed modules

fpectl

The fpectl module was never built by default, its usage was discouraged and considered dangerous. It also required a configure flag that caused an ABI incompatibility. The module was removed in 3.7 by Nathaniel J. Smith in bpo-29137.

Module type
C extension + CAPI
Deprecated in
3.7
Removed in
3.7
Substitute
none

Modules to keep?

getopt

The getopt module mimics C's getopt() option parser. Although users are encouraged to use argparse instead, the getopt module is still widely used.

Module type
pure Python
Deprecated in
n/a
Removed in
n/a
Substitute
argparse

optparse

The optparse module is the predecessor of the argparse module. It's still widely used.

Module type
pure Python
Deprecated in
3.2
Removed in
n/a
Substitute
argparse

Discussions

  • Elana Hashman and Nick Coghlan suggested to keep the getopt module.
  • Berker Peksag proposed to deprecate and removed msilib.

Resources

References

[1]https://en.wikipedia.org/wiki/Open_Sound_System#Free,_proprietary,_free
[2]https://man.openbsd.org/ossaudio
[3]https://blogs.msmvps.com/installsite/blog/2015/05/03/the-future-of-windows-installer-msi-in-the-light-of-windows-10-and-the-universal-windows-platform/

Copyright

This document has been placed in the public domain.