Learn which Python standard library modules are headed for the boneyard in Python 3.13, and how to replace them. Credit: Sinisha Karich/Shutterstock Python’s been around in one form or another for over 30 years. Over that time, it has accumulated a wide and powerful set of modules in its standard library. These modules help developers get started with many common tasks. Fans of Python call this the “batteries included” part of the language. But over the years, some of those batteries have died—meaning they’ve gone out of maintenance, or been used for technologies that are now obsolete. Some of these “dead batteries” were deprecated in Python 3.12, and will be removed entirely in Python 3.13. PEP 594 describes these deprecations in detail, but it can be hard to know at a glance which ones matter most. So, here’s a rundown—in roughly descending order of importance—of the standard library modules being removed in Python 3.13, including what each one does and what new module (if any) has replaced it. Deprecated Python modules you may still be using Here are the most important deprecated standard library modules. These are the ones you are most likely still using in existing applications. cgi, cgitb The CGI standard for web applications has long been obsolete, but support for it has lingered in Python for two reasons: the many web application frameworks that still support CGI, and the components within cgi and cgitb that are still used elsewhere. Here are the cgi features or components that you may be using, even if you don’t realize it, and what you can do to replace them, as per PEP 594: cgi.parse: Replace with urllib.parse.parse_qs cgi.parse_header: Replace with email.message.EmailMessage cgi.parse_multipart: Replace with email.message.EmailMessage Additionally, if you’re using POST and PUT requests on potentially large payloads, you might need to replace cgi.FieldStorage with a third-party module like multipart. For smaller payloads, the attachment-parsing elements in email.message may suffice. For GET and HEAD requests, you can use urllib.parse.parse_qsl. smtpd, telnetlib, nntplib These modules are for working with mail, news, and network connection protocols. In all cases, they’re now superseded by other modules: smtpd, for work with the SMTP mail protocol, can be replaced with aiosmtpd, which has the additional advantage of being async friendly. nntp, for working with the USENET news protocol, can be replaced with pynntp. telnetlib, for working with the Telnet connectivity protocol, can be replaced with telnetlib3, which has the advantages of being a higher-level client and compatible with asyncio. msilib msilib is available only on Microsoft Windows and is for creating Microsoft Installer (MSI) packages. distutils, which is also now deprecated, used this module to create MSI installers. Python’s core developers have cited the burden of maintaining msilib (with relatively few real-world users) as a big reason for removing it. pipes pipes repackages some of the functionality of os.popen to redirect input from one command into another command’s output. subprocess in the standard library is the way to handle such things now. More deprecated Python modules These modules are far less likely to be in use in any programs you’re writing or maintaining, but it’s worth knowing they have been deprecated. asynchat/asyncore: For async network operations. Replaced by asyncio since Python 3.6. imghdr/sndhdr: Used to make educated guesses about the contents of image or sound files based on their headers. Superseded by third-party libraries like Pillow (for images) or python-magic (for all kinds of files). uu: For encoding and decoding data using the uuencode protocol; obsolete since the creation of the MIME format. If you still need the uu codec for whatever reason, the binascii module in the stdlib supports it. mailcap: Used for reading mail capacity files, as a way to work with email attachments. Programs rarely need to do this by themselves anymore. crypt: For working with Unix-style libcrypt functions, which have long been considered obsolete and insecure. nis: For working with the obsolete Network Information Service protocol, replaced by LDAP and other such protocols. spwd: For access to the Unix shadow password database. This is considered a security hazard and its use is no longer encouraged. xdrlib: For working with the Sun External Data Representation Standard, a binary serialization format that is no longer used. chunk: For reading and writing the Interchange File Format, used on older personal computers like the Commodore and Amiga. sunau: For working with the obsolete Sun AU audio format. ossaudiodev: Support for the little-used Open Sound System audio interface standard. Related content feature What is Rust? Safe, fast, and easy software development Unlike most programming languages, Rust doesn't make you choose between speed, safety, and ease of use. Find out how Rust delivers better code with fewer compromises, and a few downsides to consider before learning Rust. By Serdar Yegulalp Nov 20, 2024 11 mins Rust Programming Languages Software Development how-to Kotlin for Java developers: Classes and coroutines Kotlin was designed to bring more flexibility and flow to programming in the JVM. Here's an in-depth look at how Kotlin makes working with classes and objects easier and introduces coroutines to modernize concurrency. By Matthew Tyson Nov 20, 2024 9 mins Java Kotlin Programming Languages analysis Azure AI Foundry tools for changes in AI applications Microsoft’s launch of Azure AI Foundry at Ignite 2024 signals a welcome shift from chatbots to agents and to using AI for business process automation. By Simon Bisson Nov 20, 2024 7 mins Microsoft Azure Generative AI Development Tools news Microsoft unveils imaging APIs for Windows Copilot Runtime Generative AI-backed APIs will allow developers to build image super resolution, image segmentation, object erase, and OCR capabilities into Windows applications. By Paul Krill Nov 19, 2024 2 mins Generative AI APIs Development Libraries and Frameworks Resources Videos