[Discussion] Drop support for Python 2 and jython?
See original GitHub issueAs was noticed already, the test suite experiences intermittent failures when testing under Jython, because pip
fails to install nose
. Using the -vv
option reveals this:
Could not fetch URL https://pypi.python.org/simple/nose/: 403 Client Error: [[[!!! BREAKING CHANGE !!!]]] Support for clients that do not support Server Name Indication is temporarily disabled and will be permanently deprecated soon. See https://status.python.org/incidents/hzmjhqsdjqgb and https://github.com/pypa/pypi-support/issues/978 [[[!!! END BREAKING CHANGE !!!]]] for url: https://pypi.python.org/simple/nose/ - skipping
This means this breakage is intentional, and the test suite is soon going to break completely.
Jython hasn’t had a release for more than a year, and the https://github.com/jython/jython/ repository has not had any commits for 9 months. SNI support in Jython’s TLS implementation was first requested in 2015, and apparently hasn’t been ever worked on. Let’s face it, Jython is obsolete. And so is Python 2.6, which doesn’t support SNI either, and yet this project still nominally claims to maintain compatibility with it (although it’s not actually included in the test suite, so it might have been broken already).
This might be as good an occasion as any to drop support for Python 2 completely. Doing so would enable us to take advantage of innovations brought by Python 3, like:
- more granular function signatures (I already had to put a pretty nasty hack in a pull request for the sake of Python 2 support)
pathlib
(to replace fragile pathname manipulation code)- dataclasses (as a replacement for passing fixed-key dicts around)
- type annotations (a type checker could be added to catch bugs in extractors earlier)
- native asynchronous programming (might be useful for parallel downloads)
__init_subclass__
(to simplify the giant list of imports inextractors.py
and plugin loading)html.parser
(to replace all the shoddy regex scraping)
Alternatively, the test suite failures could be worked around by manually downloading the packages. (Like upstream already did.) But that would be just delaying the inevitable. Let’s put those zombies in the grave.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:20 (14 by maintainers)
I agree with OP, there’s no point in maintaining py2 support, the language itself isn’t supported anymore. As of being more welcoming to new users, imo anyone who knows how to install python 2, can already install python 3. All tutorials online tell you to install python3. As of youtube-dl, imo this project has changed a lot from youtube-dl, i don’t see why maintain py2 support just bcoz ytdl does so.
I might have missed something so if anyone is using py2, please lemme know how you are using yt-dlp.
Just because youtube-dl devs have gone missing, you cannot expect me to start doing things the way youtube-dl has done them. Whether you want to see yt-dlp as just a fork with some nifty new features or as the “new youtube-dl” is up to you.
The fact is that we have already removed support for python 3.5 (which is past EOL btw) and support for it is not going to be added back. If anyone wants to, they are always free to fork yt-dlp and work on just the compatibility code. But I am unwilling to bear that overhead