3 ms·
Python's situation is pathetic. Some Python folks wanted to get rid of the builtin module `distutils`. Got deprecated, and now it's finally removed in Python 3.
by stabbles 3y ago
Python's situation is pathetic. Some Python folks wanted to get rid of the builtin module `distutils`. Got deprecated, and now it's finally removed in Python 3.12. That's a breaking change in a minor release, probably because they're too afraid to do a Python 4 release after the 2->3 debacle. Then they publish a migration guide only as part of the 3.12 release, which is too little too late, cause the majority of the projects hasn't moved away from `distutils` yet. There's a lot of unclarity like "you can just install setuptools, it replaces distutils" (setuptools has a startup script that hacks the search paths so you can still run `import distutils` and get their vendored copy of it). Except nobody knows whether to add a conditional dependency on setuptools then. Why on earth do you have to depend on another package to get a vendored copy of distutils? And a fraction of the projects doesn't care and makes it a user problem: just install setuptools yourself as a system / user site-package, then everything works. (Except it doesn't when setuptools is in PYTHONPATH cause the startup script doesn't run, which happens on nix and other prefix-based package managers). At the end of the day, every Python package has their own ugly solution.
All that could have been prevented by the Python folks who insisted on deprecating a builtin module. They could have jumped in and help migrate the popular Python packages away from distutils long ago, to set an example. But nope, they really like to keep things messy.
- guappa 3y agoYou think that's the only module they dropped? They took away cgi… which I was of course using. And crypt. They don't care about breaking things. People would not migrate to python4 so they just break everything in python3 :D
- eesmith 3y agoThe cgi module is still in 3.12. It will be removed in 3.13, which is planned for release on 2024-10-01, so not yet dropped. FWIW, the Python developers have wanted to drop the cgi module for over 20 years. It has no maintainer. Depending on your needs, you might consider: 1) versioning and maintaining your own copy of cgi.py; 2) use something like https://pypi.org/project/legacy-cgi/ https://pypi.org/project/legacy-cgi/ (I have not vetted it) which is a forked copy of cgi and cgitb; or 3) use the CGI capabilities of wsgiref (I used it for one CGI project to allow a future transition away from CGI). As for "crypt" - wow! I haven't seen anyone use that since the 1990s! Again, the code is short, and easy to vendor, except for the _crypt extension module. For that, you might be able to use ctypes, like this: >>> from ctypes.util import find_library >>> find_library("c") '/usr/lib/libc.dylib' >>> from ctypes import cdll >>> libc = cdll.LoadLibrary(find_library("c")) >>> import ctypes >>> libc.crypt.argtypes = [ctypes.c_char_p, ctypes.c_char_p] >>> libc.crypt.restype = ctypes.c_char_p >>> libc.crypt(b"toomanysecrets", b"az") b'azi4LBG1VJohQ' Here is what Python's own _crypt does: >>> import _crypt >>> _crypt.crypt("toomanysecrets", "az") 'azi4LBG1VJohQ'
- fulafel 3y agoWhat does it mean to say "it has no maintainer" about code in the Python standard library? In most other projects the standard library is jointly maintained by the core team. In version history the cgi module seemed to receive small fixes couple of times a year from different people.
- eesmith 3y ago"Has no maintainer" means there is no one who has said they have the expertise to be able to render final judgment on a bug report or other issue. "If no active maintainer is listed for a given module, then questionable changes should be discussed on the Core Development Discourse category, while any other issues can and should be decided by any committer." - https://devguide.python.org/core-developers/experts/index.html https://devguide.python.org/core-developers/experts/index.ht... In practice, what that means is if there is a bug report, like https://github.com/python/cpython/issues/71964 https://github.com/python/cpython/issues/71964 from 2016, then the fix may languish for years as no one in the core team is able to resolve it. You can see several people reported the bug, along with a comment from 2022 that "The cgi module is now deprecated following the acceptance of PEP 594" so will not be fixed. The fixes I saw likely fall into the un-questionable changes that can be decided by any committer.
- guappa 3y ago> FWIW, the Python developers have wanted to drop the cgi module for over 20 years. It has no maintainer. It works. Does it need a maintainer? The point isn't how to replace them. The point is that I have stuff that works and has been working for several years and will stop working.
- eesmith 3y agoThen Python is not the language for you, and never has been. The Python core developers have had a practice of removing standard library packages for over 30 years, including packages that - like cgi.py - worked. For example, modules removed with Python 2.0 included cmp, cmpcache, dircmp, dump, find, grep, packmail, poly, stdwin, util, whatsound, and zmod. Python 2.4 removed mpz, rotor, and xreadlines - no more Enigma machine emulation for you, and I had to change my code because I used xreadlines. Python 3.0 removed even more modules: cl, md5, sha, rfc822, and more. Plus it did some library reorganization. Ever use the "parser" module? I did. It was removed in 3.10 because of the switch to the PEG parser. PEP 594 re-affirms the reasoning behind the long-given practice removing old packages. There are language communities with a stronger commitment to not breaking old code. COBOL is fantastically backwards compatible, for an obvious example. I urge you to consider the options I gave. The functionality you want can be done using the standard library without that much effort.