Python standard library

See also Supported platforms and architectures, History of Python, and Python Import.

sys.stdlib_module_names

  • Python 3.13: 278 modules

    • Remove (22): _crypt, _msi, aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, lib2to3, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib

  • Python 3.12: 300 modules

    • Add (3): _sha2, _pylong, _pydatetime

    • Remove (8): _bootsubprocess, _sha256, _sha512, asynchat, asyncore, distutils, imp, smtpd

  • Python 3.11: 305 modules

    • Add (3): tomllib, _tokenize and _typing

    • Remove (1): binhex

  • Python 3.10: 303 modules

sys.stdlib_module_names was added to Python 3.10. For Python 2.6 to 3.9, the 3rd party stdlib-list module can be used.

Talks

Maintain the stdlib outside Python?

Stdlib history

Python 3.13

Python 3.13 removed 20 module:

Python 3.12

Python 3.12 removed 5 module:

PEP 594

PEP 594 – Removing dead batteries from the standard library scheduled the removal of many stdlib modules in Python 3.12 and 3.13.

Python 3.11

Python 3.11 added 1 module:

Python 3.11 added 1 sub-module to existing packages:

  • wsgiref.types

Python 3.11 removed 1 module:

Note: asyncore, asynchat, smtplib were removed in Python 3.11, but then the SC asked to add them back

Python 3.10

Python 3.10 removed 3 modules:

Python 3.9

Python 3.9 added 2 modules:

  • graphlib

  • zoneinfo

Python 3.9 removed 2 modules:

  • dummy_threading: deprecated in Python 3.7; Python 3.7 requires threads to build: bpo-31370.

  • _dummy_thread: same.

Python 3.8

Python 3.8 added 1 sub-module to existing packages:

  • importlib.metadata

Python 3.8 removed 1 module:

Python 3.7

Python 3.7 added 2 modules:

Python 3.7 added 1 sub-module to existing packages:

Python 3.7 removed 2 modules:

  • fpectl: issue #73323, it was never enabled by default, never worked correctly on x86-64, and it changed the Python ABI in ways that caused unexpected breakage of C extensions.

  • macurl2path: issue #72512

Python 3.6

Python 3.6 added 1 module:

Python 3.6 removed 6 modules:

issue #72214: These removed modules were undocumented. They had been available in the platform specific Lib/plat-*/ directories, but were chronically out of date, inconsistently available across platforms, and unmaintained.

Python 3.5

Python 3.5 added 2 modules:

Python 3.4

Python 3.4 added 7 modules:

Python 3.3

Python 3.3 added 4 modules:

Python 3.3 added 1 sub-module to existing packages:

  • unittest.mock

Python 3.2

Python 3.2 added 2 modules:

Python 3.1

Python 3.1 added 1 module:

  • importlib

Python 3.1 added 1 sub-module to existing packages:

  • tkinter.ttk

Python 3.0

Python 3.0 removed 74 stdlib modules, related to PEP 3108.

Moreover, many Python 2.7 modules have been renamed by PEP 3108.

Removed Mac modules (24):

  • aepack

  • aetools

  • aetypes

  • buildtools

  • Carbon

  • cfmfile

  • ColorPicker

  • EasyDialogs

  • findertools

  • fm

  • FrameWork

  • gensuitemodule

  • ic

  • icopen

  • mac

  • macerrors

  • MacOS

  • macosa

  • macostools

  • macresource

  • MiniAEFrame

  • Nav

  • PixMapWrapper

  • videoreader

Removed IRIX modules (7):

  • al

  • DEVICE

  • flp

  • gl: Functions from the Silicon Graphics Graphics Library.

  • imgfile: Support for SGI imglib files

  • jpeg: Read and write JPEG files

  • sgi: random SGI-specific things

Removed modules, replaced by the email package (5):

  • mimetools

  • MimeWriter

  • mimify

  • multifile

  • rfc822

Other removed modules (38):

  • audiodev: Classes for manipulating audio devices (currently only for Sun and SGI)

  • Bastion: Providing restricted access to objects

  • bsddb

  • Canvas (tk)

  • cd: CD Audio Library

  • commands: Utility functions for running external commands

  • compiler: analyze Python source code and generating Python bytecode

  • dircache: read directory listing with cache

  • dl: dl.open()

  • exceptions: Standard exception classes

  • FixTk: Delay import _tkinter until we have set TCL_LIBRARY, imported by Tkinter`

  • fl: interface to Mark Overmars’ FORMS Library

  • fpformat: General floating point formatting functions

  • future_builtins: Python 3 builtins

  • ihooks: Import hook support

  • imageop: Manipulate raw image data, replaced with PIL/Pillow

  • imputil: Import utilities

  • linuxaudiodev: Linux audio device (/dev/dsp) for python, replaced by ossaudiodev.

  • markupbase: Renamed to _markupbase, used by html.parser

  • md5: Replaced by hashlib

  • mhlib: Manipulate MH mailboxes from Python

  • mutex: Lock and queue for mutual exclusion

  • new: Interface to the creation of runtime implementation objects

  • os2emxpath: Common operations on OS/2 pathnames

  • popen2: Subprocesses with accessible I/O streams

  • posixfile: File-like objects with locking support

  • rexec: Restricted execution framework

  • sets: Unordered collections of unique elements, replaced by set() built-in type

  • sgmllib: Simple SGML parser

  • sha: Replaced by hashlib

  • sre: Replaced by re

  • statvfs: Replaced by os.statvfs()

  • stringold: Collection of string operations

  • strop: Common string manipulations, optimized for speed (C extension)

  • sunaudiodev (SunOS): Access to Sun audio hardware

  • toaiff: Convert “arbitrary” sound files to AIFF (Apple and SGI’s audio format)

  • user: Hook to allow user-specified customization code to run

  • xmllib: Parser for XML, using the derived class as static DTD.