]> jfr.im git - yt-dlp.git/commitdiff
Remove Python 3.6 support
authorpukkandan <redacted>
Mon, 18 Jul 2022 00:20:54 +0000 (05:50 +0530)
committerpukkandan <redacted>
Mon, 18 Jul 2022 01:01:14 +0000 (06:31 +0530)
Closes #3764

14 files changed:
.github/workflows/core.yml
.github/workflows/download.yml
setup.py
test/test_compat.py
yt_dlp/YoutubeDL.py
yt_dlp/__init__.py
yt_dlp/compat/__init__.py
yt_dlp/compat/_legacy.py
yt_dlp/compat/asyncio.py [deleted file]
yt_dlp/compat/re.py [deleted file]
yt_dlp/downloader/websocket.py
yt_dlp/extractor/common.py
yt_dlp/utils.py
yt_dlp/webvtt.py

index 66e8ced53027ca8b389d8458f64d21bf4695564d..a60e002d9e1442fbe56312a6df9cbbc5a2299a72 100644 (file)
@@ -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 windows
index 7fdc5595a495c26c2e7b6fe9763e2ecf8095502a..e8eb1fd12e5b3b92ae021b7deb2b5dbfecf4b0f2 100644 (file)
@@ -25,7 +25,7 @@ jobs:
       fail-fast: true
       matrix:
         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 windows
index ef9d3e91b8c7fdf2b899767f17f734f222893e43..dab09c268c46fbb2945a460b796b45da44f750be 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -136,7 +136,7 @@ def run(self):
     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 @@ def run(self):
         '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',
index c6a8f4ecbb818953583e4047b7faaee9e6e17755..e3d775bc18e3f8a013c861240e67efdd144fb5e4 100644 (file)
@@ -28,7 +28,8 @@ def test_compat_passthrough(self):
         with self.assertWarns(DeprecationWarning):
             compat.WINDOWS_VT_MODE
 
-        compat.asyncio.events  # Must not raise error
+        # TODO: Test submodule
+        # compat.asyncio.events  # Must not raise error
 
     def test_compat_expanduser(self):
         old_home = os.environ.get('HOME')
index 31fbbdb546dc82d52905cfab7a53d9b03c7b2d1f..70897d492b3601b389243a70e27cffba9f757fb2 100644 (file)
@@ -584,7 +584,8 @@ def __init__(self, params=None, auto_init=True):
             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. '
index 7caf41c60707a97fb9b28e1378fbff732b4dbba8..5b9b3541cdbfea846723b7edbc67248974308d03 100644 (file)
@@ -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'
 
index df1d4e671a9e416e82c6577626a9df61ccb0fab9..6d85a6a1fbf59f44083f86c60403aff122dc23f0 100644 (file)
@@ -3,13 +3,12 @@
 import warnings
 import xml.etree.ElementTree as etree
 
-from . import re
 from ._deprecated import *  # noqa: F401, F403
 from .compat_utils import passthrough_module
 
 # XXX: Implement this the same way as other DeprecationWarnings without circular import
 passthrough_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 @@ def compat_etree_fromstring(text):
 
 if compat_os_name == 'nt':
     def compat_shlex_quote(s):
+        import re
         return s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')
 else:
     from shlex import quote as compat_shlex_quote  # noqa: F401
index e75f79bbf742afd3e45fc4f3127b685b8bde30ca..09259c98890a1eeeeddec9a96cbd6da65fbf696d 100644 (file)
 import xml.etree.ElementTree as etree
 from 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_module
 from ..dependencies import Cryptodome_AES as compat_pycrypto_AES  # noqa: F401
 from ..dependencies import brotli as compat_brotli  # noqa: F401
 from ..dependencies import websockets as compat_websockets  # noqa: F401
diff --git a/yt_dlp/compat/asyncio.py b/yt_dlp/compat/asyncio.py
deleted file mode 100644 (file)
index c61e5c8..0000000
+++ /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_tasks
diff --git a/yt_dlp/compat/re.py b/yt_dlp/compat/re.py
deleted file mode 100644 (file)
index e1d3a26..0000000
+++ /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(''))
index 727a15828e21df0dc39efc08ab1a8f4ae253621c..6837ff1da15ad489559f952bbfba172d2caed5ba 100644 (file)
@@ -1,3 +1,4 @@
+import asyncio
 import contextlib
 import os
 import signal
@@ -5,7 +6,6 @@
 
 from .common import FileDownloader
 from .external import FFmpegFD
-from ..compat import asyncio
 from ..dependencies import websockets
 
 
index f0eddcf26e4e7f12c319b9c7070b2801194cebb2..1c751870c2572576f00ed26e27c3dca695845ef8 100644 (file)
 import netrc
 import os
 import random
+import re
 import sys
 import time
 import urllib.parse
 import urllib.request
 import xml.etree.ElementTree
 
-from ..compat import functools, re  # isort: split
+from ..compat import functools  # isort: split
 from ..compat import compat_etree_fromstring, compat_expanduser, compat_os_name
 from ..downloader import FileDownloader
 from ..downloader.f4m import get_base_url, remove_encrypted_media
index 7648b6fceea2268daf2ccde6c257f0b872660693..f0e9ee8c4270f9a4d79d4be5e2d489509d09d5ae 100644 (file)
@@ -1,3 +1,4 @@
+import asyncio
 import atexit
 import base64
 import binascii
@@ -46,7 +47,7 @@
 import xml.etree.ElementTree
 import zlib
 
-from .compat import asyncio, functools  # isort: split
+from .compat import functools  # isort: split
 from .compat import (
     compat_etree_fromstring,
     compat_expanduser,
index b8974f883185c0bd3315bb381fa67305e644752a..cc2353436a09a0bc2859886a2e179bf6e542e3b6 100644 (file)
@@ -9,8 +9,8 @@
 """
 
 import io
+import re
 
-from .compat import re
 from .utils import int_or_none, timetuple_from_msec