A feature-rich command-line audio/video downloader
Remove Python 3.6 support
pukkandan6929b41a216e
diff --git a/.github/workflows/core.yml b/.github/workflows/core.ymlindex 66e8ced530..a60e002d9e 100644--- a/.github/workflows/core.yml+++ b/.github/workflows/core.yml@@ -10,7 +10,7 @@ jobs:matrix:os: [ubuntu-latest]# CPython 3.9 is in quick-test- python-version: ['3.6', '3.7', '3.10', 3.11-dev, pypy-3.6, pypy-3.7, pypy-3.8]+ python-version: ['3.7', '3.10', 3.11-dev, pypy-3.7, pypy-3.8]run-tests-ext: [sh]include:# atleast one of each CPython/PyPy tests must be in windowsdiff --git a/.github/workflows/download.yml b/.github/workflows/download.ymlindex 7fdc5595a4..e8eb1fd12e 100644--- a/.github/workflows/download.yml+++ b/.github/workflows/download.yml@@ -25,7 +25,7 @@ jobs:fail-fast: truematrix:os: [ubuntu-latest]- python-version: ['3.6', '3.7', '3.10', 3.11-dev, pypy-3.6, pypy-3.7, pypy-3.8]+ python-version: ['3.7', '3.10', 3.11-dev, pypy-3.7, pypy-3.8]run-tests-ext: [sh]include:# atleast one of each CPython/PyPy tests must be in windowsdiff --git a/setup.py b/setup.pyindex ef9d3e91b8..dab09c268c 100644--- a/setup.py+++ b/setup.py@@ -136,7 +136,7 @@ setup(url='https://github.com/yt-dlp/yt-dlp',packages=packages(),install_requires=REQUIREMENTS,- python_requires='>=3.6',+ python_requires='>=3.7',project_urls={'Documentation': 'https://github.com/yt-dlp/yt-dlp#readme','Source': 'https://github.com/yt-dlp/yt-dlp',@@ -148,7 +148,6 @@ setup('Development Status :: 5 - Production/Stable','Environment :: Console','Programming Language :: Python',- 'Programming Language :: Python :: 3.6','Programming Language :: Python :: 3.7','Programming Language :: Python :: 3.8','Programming Language :: Python :: 3.9',diff --git a/test/test_compat.py b/test/test_compat.pyindex c6a8f4ecbb..e3d775bc18 100644--- a/test/test_compat.py+++ b/test/test_compat.py@@ -28,7 +28,8 @@ class TestCompat(unittest.TestCase):with self.assertWarns(DeprecationWarning):compat.WINDOWS_VT_MODE- compat.asyncio.events # Must not raise error+ # TODO: Test submodule+ # compat.asyncio.events # Must not raise errordef test_compat_expanduser(self):old_home = os.environ.get('HOME')diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex 31fbbdb546..70897d492b 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -584,7 +584,8 @@ class YoutubeDL:for type_, stream in self._out_files.items_ if type_ != 'console'})- MIN_SUPPORTED, MIN_RECOMMENDED = (3, 6), (3, 7)+ # The code is left like this to be reused for future deprecations+ MIN_SUPPORTED, MIN_RECOMMENDED = (3, 7), (3, 7)current_version = sys.version_info[:2]if current_version < MIN_RECOMMENDED:msg = ('Support for Python version %d.%d has been deprecated. 'diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.pyindex 7caf41c607..5b9b3541cd 100644--- a/yt_dlp/__init__.py+++ b/yt_dlp/__init__.py@@ -1,4 +1,4 @@-f'You are using an unsupported version of Python. Only Python versions 3.6 and above are supported by yt-dlp' # noqa: F541+f'You are using an unsupported version of Python. Only Python versions 3.7 and above are supported by yt-dlp' # noqa: F541__license__ = 'Public Domain'diff --git a/yt_dlp/compat/__init__.py b/yt_dlp/compat/__init__.pyindex df1d4e671a..6d85a6a1fb 100644--- a/yt_dlp/compat/__init__.py+++ b/yt_dlp/compat/__init__.py@@ -3,13 +3,12 @@ import sysimport warningsimport xml.etree.ElementTree as etree-from . import refrom ._deprecated import * # noqa: F401, F403from .compat_utils import passthrough_module# XXX: Implement this the same way as other DeprecationWarnings without circular importpassthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(- DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=2))+ DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=3))# HTMLParseError has been deprecated in Python 3.3 and removed in@@ -33,6 +32,7 @@ compat_os_name = os._name if os.name == 'java' else os.nameif compat_os_name == 'nt':def compat_shlex_quote(s):+ import rereturn s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')else:from shlex import quote as compat_shlex_quote # noqa: F401diff --git a/yt_dlp/compat/_legacy.py b/yt_dlp/compat/_legacy.pyindex e75f79bbf7..09259c9889 100644--- a/yt_dlp/compat/_legacy.py+++ b/yt_dlp/compat/_legacy.py@@ -22,10 +22,14 @@ import urllib.requestimport xml.etree.ElementTree as etreefrom subprocess import DEVNULL-from .compat_utils import passthrough_module # isort: split-from .asyncio import run as compat_asyncio_run # noqa: F401-from .re import Pattern as compat_Pattern # noqa: F401-from .re import match as compat_Match # noqa: F401+# isort: split+import asyncio # noqa: F401+import re # noqa: F401+from asyncio import run as compat_asyncio_run # noqa: F401+from re import Pattern as compat_Pattern # noqa: F401+from re import match as compat_Match # noqa: F401++from .compat_utils import passthrough_modulefrom ..dependencies import Cryptodome_AES as compat_pycrypto_AES # noqa: F401from ..dependencies import brotli as compat_brotli # noqa: F401from ..dependencies import websockets as compat_websockets # noqa: F401diff --git a/yt_dlp/compat/asyncio.py b/yt_dlp/compat/asyncio.pydeleted file mode 100644index c61e5c8fde..0000000000--- a/yt_dlp/compat/asyncio.py+++ /dev/null@@ -1,23 +0,0 @@-# flake8: noqa: F405-from asyncio import * # noqa: F403--from .compat_utils import passthrough_module--passthrough_module(__name__, 'asyncio')-del passthrough_module--try:- run # >= 3.7-except NameError:- def run(coro):- try:- loop = get_event_loop()- except RuntimeError:- loop = new_event_loop()- set_event_loop(loop)- loop.run_until_complete(coro)--try:- all_tasks # >= 3.7-except NameError:- all_tasks = Task.all_tasksdiff --git a/yt_dlp/compat/re.py b/yt_dlp/compat/re.pydeleted file mode 100644index e1d3a2645a..0000000000--- a/yt_dlp/compat/re.py+++ /dev/null@@ -1,18 +0,0 @@-# flake8: noqa: F405-from re import * # F403--from .compat_utils import passthrough_module--passthrough_module(__name__, 're')-del passthrough_module--try:- Pattern # >= 3.7-except NameError:- Pattern = type(compile(''))---try:- Match # >= 3.7-except NameError:- Match = type(compile('').match(''))diff --git a/yt_dlp/downloader/websocket.py b/yt_dlp/downloader/websocket.pyindex 727a15828e..6837ff1da1 100644--- a/yt_dlp/downloader/websocket.py+++ b/yt_dlp/downloader/websocket.py@@ -1,3 +1,4 @@+import asyncioimport contextlibimport osimport signal@@ -5,7 +6,6 @@ import threadingfrom .common import FileDownloaderfrom .external import FFmpegFD-from ..compat import asynciofrom ..dependencies import websocketsdiff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.pyindex f0eddcf26e..1c751870c2 100644--- a/yt_dlp/extractor/common.py+++ b/yt_dlp/extractor/common.py@@ -11,13 +11,14 @@ import mathimport netrcimport osimport random+import reimport sysimport timeimport urllib.parseimport urllib.requestimport xml.etree.ElementTree-from ..compat import functools, re # isort: split+from ..compat import functools # isort: splitfrom ..compat import compat_etree_fromstring, compat_expanduser, compat_os_namefrom ..downloader import FileDownloaderfrom ..downloader.f4m import get_base_url, remove_encrypted_mediadiff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex 7648b6fcee..f0e9ee8c42 100644--- a/yt_dlp/utils.py+++ b/yt_dlp/utils.py@@ -1,3 +1,4 @@+import asyncioimport atexitimport base64import binascii@@ -46,7 +47,7 @@ import urllib.requestimport xml.etree.ElementTreeimport zlib-from .compat import asyncio, functools # isort: split+from .compat import functools # isort: splitfrom .compat import (compat_etree_fromstring,compat_expanduser,diff --git a/yt_dlp/webvtt.py b/yt_dlp/webvtt.pyindex b8974f8831..cc2353436a 100644--- a/yt_dlp/webvtt.py+++ b/yt_dlp/webvtt.py@@ -9,8 +9,8 @@ in RFC 8216 §3.5 <https://tools.ietf.org/html/rfc8216#section-3.5>."""import io+import re-from .compat import refrom .utils import int_or_none, timetuple_from_msec