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 14 great preprocessors for developers who love to code Sometimes it seems like the rules of programming are designed to make coding a chore. Here are 14 ways preprocessors can help make software development fun again. By Peter Wayner Nov 18, 2024 10 mins Development Tools Software Development feature Designing the APIs that accidentally power businesses Well-designed APIs, even those often-neglected internal APIs, make developers more productive and businesses more agile. By Jean Yang Nov 18, 2024 6 mins APIs Software Development news Spin 3.0 supports polyglot development using Wasm components Fermyon’s open source framework for building server-side WebAssembly apps allows developers to compose apps from components created with different languages. By Paul Krill Nov 18, 2024 2 mins Microservices Serverless Computing Development Libraries and Frameworks news Go language evolving for future hardware, AI workloads The Go team is working to adapt Go to large multicore systems, the latest hardware instructions, and the needs of developers of large-scale AI systems. By Paul Krill Nov 15, 2024 3 mins Google Go Generative AI Programming Languages Resources Videos