Python 3.13 Removed Modules Under PEP 594
Python 3.13 permanently removed 19 legacy standard library modules as the final implementation phase of PEP 594, titled "Removing dead batteries from the standard library." First marked as deprecated in Python 3.11, these modules were eliminated to trim unmaintained code, reduce security vulnerabilities, and eliminate obsolete protocols and historical platform dependencies. Below is the complete breakdown of every module permanently removed in Python 3.13 alongside recommended modern replacements.
Audio and Multimedia Modules
aifc: Handled reading and writing of AIFF and AIFC audio formats.- Replacement: Use third-party libraries such as
soundfileorscipy.io.wavfile.
- Replacement: Use third-party libraries such as
audioop: Provided low-level operations on raw sound data chunks.- Replacement: For projects unable to refactor immediate
audio transformations, use the community-maintained drop-in package
audioop-ltson PyPI, or migrate to libraries likenumpyorpydub.
- Replacement: For projects unable to refactor immediate
audio transformations, use the community-maintained drop-in package
chunk: Provided an interface for reading IFF-chunked data.- Replacement: Custom file parsers or specialized media libraries.
imghdr: Determined the file format of image byte streams.- Replacement: Use
filetype,puremagic, or thePillowlibrary.
- Replacement: Use
ossaudiodev: Linux and FreeBSD Open Sound System (OSS) audio interface.- Replacement: Use modern audio drivers via libraries like
sounddeviceorpygame.
- Replacement: Use modern audio drivers via libraries like
sndhdr: Determined the file format of various sound files.- Replacement: Use
filetypeorpuremagic.
- Replacement: Use
sunau: Read and wrote Sun AU and NeXT audio files.- Replacement: Modern audio packages such as
soundfile.
- Replacement: Modern audio packages such as
Web, Mail, and Network Protocols
cgi: Provided Common Gateway Interface helpers for HTTP servers.- Replacement: Modern web frameworks (FastAPI, Flask, Django)
or standalone parsers such as
multipartandurllib.parse.
- Replacement: Modern web frameworks (FastAPI, Flask, Django)
or standalone parsers such as
cgitb: Traceback manager for CGI scripts.- Replacement: Standard logging, modern framework error handlers, or third-party error trackers like Sentry.
mailcap: Handled Unix mailcap files used to configure helper applications for MIME types.- Replacement: Use the
mimetypesstandard library module or system-level configuration handling.
- Replacement: Use the
nntplib: Usenet news transfer protocol (NNTP) client.- Replacement: Specialized third-party packages from PyPI if NNTP support is still required.
telnetlib: Telnet protocol client.- Replacement: Third-party modules such as
telnetlib3ornetmiko.
- Replacement: Third-party modules such as
Data Formatting and Encodings
uu: Provided uuencode and uudecode functionality for binary-to-text translation.- Replacement: The standard
base64module or custom wrappers.
- Replacement: The standard
xdrlib: Implemented Sun's External Data Representation (XDR) standard.- Replacement: Structured binary protocols like Protocol
Buffers, MessagePack, or custom
structimplementations.
- Replacement: Structured binary protocols like Protocol
Buffers, MessagePack, or custom
System, Shell, and Platform Specifics
crypt: Handled password hashing on Unix systems via the systemcrypt(3)function.- Replacement: The standard
hashlibmodule for modern hashing, or dedicated third-party libraries likebcrypt,argon2-cffi, orpasslib.
- Replacement: The standard
msilib: Supported the creation of Windows Installer (.msi) packages.- Replacement: External tools such as WiX Toolset or packaging tools like PyInstaller and Inno Setup.
nis: Interface to Sun's Network Information Service (Yellow Pages).- Replacement: System-level directory services or LDAP
libraries like
ldap3.
- Replacement: System-level directory services or LDAP
libraries like
pipes: Constructed Unix shell execution pipelines.- Replacement: The standard
subprocessmodule.
- Replacement: The standard
spwd: Direct interface to Unix shadow password database (/etc/shadow).- Replacement: Modern system authentication modules like PAM
via
python-pam.
- Replacement: Modern system authentication modules like PAM
via