Description
Describe the bug
There are a number of HTML files that were moved between the Python 2.7 and Python 3 documentation websites (because some libraries were moved, renamed and removed). The documentation for Python 2.7 contains a banner with a link to the current page with the "/2/" in the URL changed to "/3/". For the libraries that are missing from Python 3, these links open a 404 page.
To Reproduce
- Go to https://docs.python.org/2/library/stringio.html
- Click on "You should upgrade and read the Python documentation for the current stable release." at the very top.
- See a "404 Not Found" error
Expected behavior
Either (in order of preference)
- redirect to https://docs.python.org/3/library/io.html#io.StringIO
- redirect to https://docs.python.org/3/library/io.html
- redirect to https://docs.python.org (the docs homepage)
- make the text "Python documentation for the current stable release" regular text instead of a link
Additional context
These are the files that are missing between Python 2.7 and Python 3.8 along with where (I think) they should be redirected to:
Code to generate the above table (I added some alternatives in comments - for example to libraries that replace the functionality of the removed package):
redirects = {
"library/fpformat.html": None,
"library/mutex.html": None,
"library/new.html": None,
"library/statvfs.html": None,
"library/dircache.html": None,
"library/macpath.html": None,
"library/dbhash.html": None,
"library/bsddb.html": None,
# "library/someos.html": "library/index.html",
"library/someos.html": None,
# "library/popen2.html": "library/subprocess.html",
"library/popen2.html": None,
# "library/mhlib.html": "library/mailbox.html",
"library/mhlib.html": None,
# "library/mimetools.html": "library/email.html",
"library/mimetools.html": None,
# "library/mimewriter.html": "library/email.html",
"library/mimewriter.html": None,
# "library/mimify.html": "library/email.html",
"library/mimify.html": None,
# "library/multifile.html": "library/email.html",
"library/multifile.html": None,
"library/sgmllib.html": None,
"library/imageop.html": None,
# "library/hotshot.html": "library/profile.html",
"library/hotshot.html": None,
"library/future_builtins.html": None,
"library/user.html": None,
"library/fpectl.html": None,
"library/restricted.html": None,
"library/rexec.html": None,
"library/bastion.html": None,
"library/imputil.html": None,
"library/compiler.html": None,
"library/dl.html": None,
"library/posixfile.html": None,
# "library/commands.html": "library/subprocess.html",
"library/commands.html": None,
"library/mac.html": None,
"library/ic.html": None,
"library/macos.html": None,
"library/macostools.html": None,
"library/easydialogs.html": None,
"library/framework.html": None,
"library/autogil.html": None,
"library/carbon.html": None,
"library/colorpicker.html": None,
"library/macosa.html": None,
"library/gensuitemodule.html": None,
"library/aetools.html": None,
"library/aepack.html": None,
"library/aetypes.html": None,
"library/miniaeframe.html": None,
"library/sgi.html": None,
"library/al.html": None,
"library/cd.html": None,
"library/fl.html": None,
"library/fm.html": None,
"library/gl.html": None,
"library/imgfile.html": None,
"library/jpeg.html": None,
"library/sun.html": None,
"library/sunaudio.html": None,
# "c-api/int.html": "c-api/long.html",
"c-api/int.html": None,
"c-api/string.html": None,
"c-api/class.html": None,
"c-api/cobject.html": None,
"howto/doanddont.html": None,
"howto/webservers.html": None,
# "library/strings.html": None,
"library/strings.html": "library/text.html",
"library/stringio.html": "library/io.html#io.StringIO",
"library/sets.html": "library/stdtypes.html#set",
"library/userdict.html": "library/collections.html#userdict-objects",
"library/repr.html": "library/reprlib.html",
"library/copy_reg.html": "library/copyreg.html",
"library/anydbm.html": "library/dbm.html",
"library/whichdb.html": "library/dbm.html#dbm.whichdb",
"library/dumbdbm.html": "library/dbm.html#module-dbm.dumb",
"library/dbm.html": "library/dbm.html#module-dbm.ndbm",
"library/gdbm.html": "library/dbm.html#module-dbm.gnu",
"library/robotparser.html": "library/urllib.robotparser.html",
"library/md5.html": "library/hashlib.html",
"library/sha.html": "library/hashlib.html",
"library/thread.html": "library/_thread.html",
"library/dummy_thread.html": "library/_dummy_thread.html",
"library/email-examples.html": "library/email.examples.html",
"library/rfc822.html": None,
"library/htmlparser.html": "library/html.parser.html",
"library/htmllib.html": None,
"library/urllib2.html": "library/urllib.request.html",
"library/httplib.html": "library/http.client.html",
"library/urlparse.html": "library/urllib.parse.html",
"library/basehttpserver.html": "library/http.server.html",
"library/simplehttpserver.html": "library/http.server.html",
"library/cgihttpserver.html": "library/http.server.html#http.server.CGIHTTPRequestHandler",
"library/cookielib.html": "library/http.cookiejar.html",
"library/cookie.html": "library/http.cookies.html",
"library/xmlrpclib.html": "library/xmlrpc.client.html",
"library/simplexmlrpcserver.html": "library/xmlrpc.server.html",
"library/docxmlrpcserver.html": "library/xmlrpc.server.html",
"library/ttk.html": "library/tkinter.ttk.html",
"library/tix.html": "library/tkinter.tix.html",
"library/scrolledtext.html": "library/tkinter.scrolledtext.html",
"library/__builtin__.html": "library/builtins.html",
"library/_winreg.html": "library/winreg.html",
}
from tabulate import tabulate
print(
tabulate(
[
(
f"https://docs.python.org/2/{old}",
"" if new is None else f"https://docs.python.org/3/{new}",
)
for old, new in redirects.items()
],
headers=["Python 2", "Python 3"],
tablefmt="github",
)
)
See https://github.com/verhovsky/py3redirect/blob/master/special-cases.js for context.