Note
The merging of profile/cProfile as of Python 3.3 did notoccur, and thus is considered abandoned (although it would beacceptable to do in the future).
Just like the language itself, Python’s standard library (stdlib) hasgrown over the years to be very rich. But over time some moduleshave lost their need to be included with Python. There has also beenan introduction of a naming convention for modules since Python’sinception that not all modules follow.
Python 3.0 presents a chance to remove modules that do not havelong term usefulness. This chance also allows for the renaming ofmodules so that they follow thePython style guide. ThisPEP lists modules that should not be included in Python 3.0 or whichneed to be renamed.
Guido pronounced that “silly old stuff” is to be deleted from thestdlib for Py3K[7]. This is open-ended on purpose.Each module to be removed needs to have a justification as to why itshould no longer be distributed with Python. This can range from themodule being deprecated in Python 2.x to being for a platform that isno longer widely used.
This section of the PEP lists the various modules to be removed. Eachsubsection represents a different reason for modules to beremoved. Each module must have a specific justification on top ofbeing listed in a specific subsection so as to make sure only modulesthat truly deserve to be removed are in fact removed.
When a reason mentions how long it has been since a module has been“uniquely edited”, it is in reference to how long it has been since acheckin was done specifically for the module and not for a change thatapplied universally across the entire stdlib. If an edit time is notdenoted as “unique” then it is the last time the file was edited,period.
PEP 4 lists all modules that have been deprecated in the stdlib.The specified motivations mirror those listed inPEP 4. All modules listedin the PEP at the time of the first alpha release of Python 3.0 willbe removed.
The entire contents of lib-old will also be removed. These moduleshave already been removed from being imported but are kept in thedistribution for Python for users that rely upon the code.
hashlib module.email package.email package.email package.email package.fcntl.lockf().email package.hashlib package.time.clock() gives better time resolution.Python supports many platforms, some of which are not widely used ormaintained.And on some of these platforms there are modules that have limited useto people on those platforms. Because of their limited usefulness itwould be better to no longer burden the Python development team withtheir maintenance.
The modules mentioned below are documented. All undocumented modulesfor the specified platforms will also be removed.
The IRIX operating system is no longer produced[13].Removing all modules from the plat-irix[56] directory has been deemedreasonable because of this fact.
.rgb files).The Mac-specific modules are not well-maintained (e.g., the bgentool used to auto-generate many of the modules has never beenupdated to support UCS-4). It is also not Python’s place to maintainsuch a large amount of OS-specific modules. Thus all modules underLib/plat-mac andMac are to be removed.
A stub module for proxy access will be provided for use by urllib.
Some platform-independent modules are rarely used. There are a number ofpossible explanations for this, including, ease of reimplementation, verysmall audience or lack of adherence to more modern standards.
sunau module provides similar abilities.sox library to be installed on the system.type built-in to get most types easily.Becoming obsolete signifies that either another module in the stdlibor a widely distributed third-party library provides a better solutionfor what the module is meant for.
Tkinter.Canvas class.mailboxinstead.re instead.os.stat()]os.stat() now returns a tuple with attributes.os.statvfs now returns a tuple with attributes.Over the years, certain modules have become a heavy burden uponpython-dev to maintain. In situations like this, it is better for themodule to be given to the community to maintain to free python-dev tofocus more on language support and other modules in the standardlibrary that do not take up an undue amount of time and effort.
Many modules existed inthe stdlib beforePEP 8 came into existence. This hasled to some naming inconsistencies and namespace bloat that should beaddressed.
PEP 8 specifies that modules “should have short, all-lowercase names”where “underscores can be used … if it improves readability”.The use of underscores is discouraged in package names.The following modules violatePEP 8 and are not somehow being renamedby being moved to a package.
| Current Name | Replacement Name |
|---|---|
| _winreg | winreg |
| ConfigParser | configparser |
| copy_reg | copyreg |
| Queue | queue |
| SocketServer | socketserver |
Several interfaces have both a Python and C implementation. While itis great to have a C implementation for speed with a Pythonimplementation as fallback, there is no need to expose the twoimplementations independently in the stdlib. For Python 3.0 allinterfaces with two implementations will be merged into a singlepublic interface.
The C module is to be given a leading underscore to delineate the factthat it is not the reference implementation (the Python implementationis). This means that any semantic difference between the C and Pythonversions must be dealt with before Python 3.0 or else the Cimplementation will be removed until it can be fixed.
One interface that is not listed below is xml.etree.ElementTree. Thisis an externally maintained module and thus is not under the directcontrol of the Python development team for renaming. SeeOpenIssues for a discussion on this.
There are several modules in the stdlib that have no defined publicinterface. These modules exist as support code for other modules thatare exposed. Because they are not meant to be used directly theyshould be renamed to reflect this fact.
| Current Name | Replacement Name |
|---|---|
| markupbase | _markupbase |
A few modules have names that were poorly chosen in hindsight. Theyshould be renamed so as to prevent their bad name from perpetuatingbeyond the 2.x series.
| Current Name | Replacement Name |
|---|---|
| repr | reprlib |
| test.test_support | test.support |
As the stdlib has grown, several areas within it have expanded toinclude multiple modules (e.g., support for database files). Itthus makes sense to group related modules into packages.
| Current Name | Replacement Name |
|---|---|
| anydbm | dbm.__init__[1] |
| dbhash | dbm.bsd |
| dbm | dbm.ndbm |
| dumbdm | dbm.dumb |
| gdbm | dbm.gnu |
| whichdb | dbm.__init__[1] |
dbm.__init__ can combineanybdbm andwhichdb sincethe public API for both modules has no name conflict and thetwo modules have closely related usage.| Current Name | Replacement Name |
|---|---|
| HTMLParser | html.parser |
| htmlentitydefs | html.entities |
| Current Name | Replacement Name |
|---|---|
| httplib | http.client |
| BaseHTTPServer | http.server[2] |
| CGIHTTPServer | http.server[2] |
| SimpleHTTPServer | http.server[2] |
| Cookie | http.cookies |
| cookielib | http.cookiejar |
http.server module can combine the specified modulessafely as they have no naming conflicts.| Current Name | Replacement Name |
|---|---|
| Dialog | tkinter.dialog |
| FileDialog | tkinter.filedialog[4] |
| FixTk | tkinter._fix |
| ScrolledText | tkinter.scrolledtext |
| SimpleDialog | tkinter.simpledialog[5] |
| Tix | tkinter.tix |
| Tkconstants | tkinter.constants |
| Tkdnd | tkinter.dnd |
| Tkinter | tkinter.__init__ |
| tkColorChooser | tkinter.colorchooser |
| tkCommonDialog | tkinter.commondialog |
| tkFileDialog | tkinter.filedialog[4] |
| tkFont | tkinter.font |
| tkMessageBox | tkinter.messagebox |
| tkSimpleDialog | tkinter.simpledialog[5] |
| turtle | tkinter.turtle |
tkinter.filedialog can safely combineFileDialog andtkFileDialog as there are no naming conflicts.tkinter.simpledialog can safely combineSimpleDialogandtkSimpleDialog have no naming conflicts.Originally this new package was to be namedurl, but because ofthe common use of the name as a variable, it has been deemed betterto keep the nameurllib and instead shift existing modules aroundinto a new package.
| Current Name | Replacement Name |
|---|---|
| urllib2 | urllib.request, urllib.error |
| urlparse | urllib.parse |
| urllib | urllib.parse, urllib.request, urllib.error[6] |
| robotparser | urllib.robotparser |
urllib will be addedtourllib.parse.urllib.URLOpener andurllib.FancyUrlOpener will be added tourllib.requestas long as the documentation for both modules is updated.| Current Name | Replacement Name |
|---|---|
| xmlrpclib | xmlrpc.client |
| DocXMLRPCServer | xmlrpc.server[3] |
| SimpleXMLRPCServer | xmlrpc.server[3] |
xmlrpc.server have nonaming conflicts and thus can safely be merged.Issues related to this PEP:
For module removals, it is easiest to remove the module first inPython 3.0 to see where dependencies exist. This makes findingcode that (possibly) requires the suppression of theDeprecationWarning easier.
Modules/Setup.dist andsetup.py if needed.-uall); watch out fortests that are skipped because an import failed for the removedmodule.Misc/NEWS entry).warnings import andneeded):fromwarningsimportwarnpy3kwarnpy3k("the XXX module has been removed in Python 3.0",stacklevel=2)delwarnpy3k
or the following if it is an extension module:
if(PyErr_WarnPy3k("the XXX module has been removed in ""Python 3.0",2)<0)return;
(the Python-Dev TextMate bundle, available fromMisc/TextMate,contains a command that will generate all of this for you).
:deprecated: option with themodule directivealong with thedeprecated directive, stating the deprecationis occurring in 2.6, but is for the module’s removal in 3.0.:.. deprecated:: 2.6 The :mod:`XXX` module has been removed in Python 3.0.
For modules simply listed in a file (e.g.,undoc.rst), use thewarning directive.
test_py3kwarn.test.test_support.import_module(name,deprecated=True).Misc/NEWS entry (blockthis checkin inpy3k!).Support in the 2to3 refactoring tool for renames will be used to helppeople transition to new module names[9]. Import statements will be rewritten so that only the importstatement and none of the rest of the code needs to be touched. Thiswill be accomplished by using theas keyword in import statementsto bind in the module namespace to the old name while importing basedon the new name (when the keyword is not already used, otherwise thereassigned name should be left alone and only the module that isimported needs to be changed). Thefix_imports fixer is anexample of how to approach this.
svnmove to rename the module.fix_imports fixer for the easiest solution).regrtest.py-uall to verify the rename worked.Misc/NEWS... note:: The :mod:`OLDNAME` module has been renamed to :mod:`NEWNAME` in Python 3.0.
xml.etree.ElementTree not only does not meetPEP 8 naming standardsbut it also has an exposed C implementation. It is anexternally maintained package, thoughPEP 360. A request will bemade for the maintainer to change the name so that it matchesPEP 8and hides the C implementation.
It has been suggested that the entire stdlib be placed within its ownpackage. This PEP will not address this issue as it has its owndesign issues (naming, does it deserve special consideration in importsemantics, etc.). Everything within this PEP can easily be handled ifa new top-level package is introduced.
During the writing of this PEP it was noticed that certain themesappeared in the stdlib. In the past people have suggested introducingnew packages to help collect modules that share a similar theme (e.g.,audio). An Open Issue was created to suggest some new packages tointroduce.
In the end, though, not enough support could be pulled together towarrant moving forward with the idea. Instead name simplification hasbeen chosen as the guiding force for PEPs to create.
This document has been placed in the public domain.
Source:https://github.com/python/peps/blob/main/peps/pep-3108.rst
Last modified:2025-01-30 01:20:11 GMT