From 4e6a693057cfaf1ce1f07b019ed3bfce2bf936f6 Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Wed, 15 Oct 2025 05:25:21 -0500 Subject: [PATCH] Remove Python 3.9 support (#13861) Closes #13858 Authored by: bashonly --- .github/workflows/build.yml | 12 +++-- .github/workflows/core.yml | 8 ++- .github/workflows/download.yml | 6 +-- .github/workflows/quick-test.yml | 6 +-- .github/workflows/signature-tests.yml | 2 +- CONTRIBUTING.md | 2 +- README.md | 6 +-- devscripts/make_changelog.py | 2 +- pyproject.toml | 4 +- test/helper.py | 2 +- test/test_YoutubeDL.py | 7 +-- test/test_postprocessors.py | 2 +- test/test_traversal.py | 2 +- test/test_utils.py | 2 +- yt_dlp/YoutubeDL.py | 9 ++-- yt_dlp/__init__.py | 13 ++--- yt_dlp/aes.py | 2 +- yt_dlp/compat/types.py | 13 ----- yt_dlp/compat/urllib/request.py | 12 ++--- yt_dlp/extractor/archiveorg.py | 2 +- yt_dlp/extractor/common.py | 4 +- yt_dlp/extractor/dtube.py | 3 +- yt_dlp/extractor/fujitv.py | 2 +- yt_dlp/extractor/kaltura.py | 2 +- yt_dlp/extractor/lynda.py | 3 +- yt_dlp/extractor/mojevideo.py | 2 +- yt_dlp/extractor/nhk.py | 2 +- yt_dlp/extractor/pbs.py | 4 +- yt_dlp/extractor/polskieradio.py | 2 +- yt_dlp/extractor/pr0gramm.py | 2 +- yt_dlp/extractor/tiktok.py | 2 +- yt_dlp/jsinterp.py | 2 +- yt_dlp/networking/_requests.py | 5 +- yt_dlp/networking/common.py | 2 +- yt_dlp/networking/impersonate.py | 2 +- yt_dlp/plugins.py | 15 ++---- yt_dlp/postprocessor/ffmpeg.py | 4 +- yt_dlp/update.py | 12 ++--- yt_dlp/utils/_legacy.py | 73 --------------------------- yt_dlp/utils/_utils.py | 11 ++-- yt_dlp/utils/jslib/devalue.py | 4 +- yt_dlp/webvtt.py | 2 +- 42 files changed, 84 insertions(+), 190 deletions(-) delete mode 100644 yt_dlp/compat/types.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fda92cea88..e20373ec02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -558,35 +558,39 @@ jobs: cat >> _update_spec << EOF # This file is used for regulating self-update lock 2022.08.18.36 .+ Python 3\.6 - lock 2023.11.16 (?!win_x86_exe).+ Python 3\.7 + lock 2023.11.16 zip Python 3\.7 lock 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server) lock 2024.10.22 py2exe .+ lock 2024.10.22 zip Python 3\.8 lock 2024.10.22 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2) lock 2025.08.11 darwin_legacy_exe .+ lock 2025.08.27 linux_armv7l_exe .+ + lock 2025.10.14 zip Python 3\.9 lockV2 yt-dlp/yt-dlp 2022.08.18.36 .+ Python 3\.6 - lockV2 yt-dlp/yt-dlp 2023.11.16 (?!win_x86_exe).+ Python 3\.7 + lockV2 yt-dlp/yt-dlp 2023.11.16 zip Python 3\.7 lockV2 yt-dlp/yt-dlp 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server) lockV2 yt-dlp/yt-dlp 2024.10.22 py2exe .+ lockV2 yt-dlp/yt-dlp 2024.10.22 zip Python 3\.8 lockV2 yt-dlp/yt-dlp 2024.10.22 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2) lockV2 yt-dlp/yt-dlp 2025.08.11 darwin_legacy_exe .+ lockV2 yt-dlp/yt-dlp 2025.08.27 linux_armv7l_exe .+ - lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 (?!win_x86_exe).+ Python 3\.7 + lockV2 yt-dlp/yt-dlp 2025.10.14 zip Python 3\.9 + lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 zip Python 3\.7 lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 win_x86_exe .+ Windows-(?:Vista|2008Server) lockV2 yt-dlp/yt-dlp-nightly-builds 2024.10.22.051025 py2exe .+ lockV2 yt-dlp/yt-dlp-nightly-builds 2024.10.22.051025 zip Python 3\.8 lockV2 yt-dlp/yt-dlp-nightly-builds 2024.10.22.051025 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2) lockV2 yt-dlp/yt-dlp-nightly-builds 2025.08.12.233030 darwin_legacy_exe .+ lockV2 yt-dlp/yt-dlp-nightly-builds 2025.08.30.232839 linux_armv7l_exe .+ - lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 (?!win_x86_exe).+ Python 3\.7 + lockV2 yt-dlp/yt-dlp-nightly-builds 2025.10.14.232845 zip Python 3\.9 + lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 zip Python 3\.7 lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 win_x86_exe .+ Windows-(?:Vista|2008Server) lockV2 yt-dlp/yt-dlp-master-builds 2024.10.22.045052 py2exe .+ lockV2 yt-dlp/yt-dlp-master-builds 2024.10.22.060347 zip Python 3\.8 lockV2 yt-dlp/yt-dlp-master-builds 2024.10.22.060347 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2) lockV2 yt-dlp/yt-dlp-master-builds 2025.08.12.232447 darwin_legacy_exe .+ lockV2 yt-dlp/yt-dlp-master-builds 2025.09.05.212910 linux_armv7l_exe .+ + lockV2 yt-dlp/yt-dlp-master-builds 2025.10.14.232330 zip Python 3\.9 EOF - name: Sign checksum files diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 93442529f5..d76495a25d 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -36,12 +36,10 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - # CPython 3.9 is in quick-test - python-version: ['3.10', '3.11', '3.12', '3.13', '3.14-dev', pypy-3.11] + # CPython 3.10 is in quick-test + python-version: ['3.11', '3.12', '3.13', '3.14', pypy-3.11] include: # atleast one of each CPython/PyPy tests must be in windows - - os: windows-latest - python-version: '3.9' - os: windows-latest python-version: '3.10' - os: windows-latest @@ -51,7 +49,7 @@ jobs: - os: windows-latest python-version: '3.13' - os: windows-latest - python-version: '3.14-dev' + python-version: '3.14' - os: windows-latest python-version: pypy-3.11 steps: diff --git a/.github/workflows/download.yml b/.github/workflows/download.yml index 8dbfee6f88..e5debc786d 100644 --- a/.github/workflows/download.yml +++ b/.github/workflows/download.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 with: - python-version: 3.9 + python-version: '3.10' - name: Install test requirements run: python3 ./devscripts/install_deps.py --include dev - name: Run tests @@ -28,11 +28,11 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - python-version: ['3.10', '3.11', '3.12', '3.13', '3.14-dev', pypy-3.11] + python-version: ['3.11', '3.12', '3.13', '3.14', pypy-3.11] include: # atleast one of each CPython/PyPy tests must be in windows - os: windows-latest - python-version: '3.9' + python-version: '3.10' - os: windows-latest python-version: pypy-3.11 steps: diff --git a/.github/workflows/quick-test.yml b/.github/workflows/quick-test.yml index 1c0fb4e4da..307559b96c 100644 --- a/.github/workflows/quick-test.yml +++ b/.github/workflows/quick-test.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v6 with: - python-version: '3.9' + python-version: '3.10' - name: Install test requirements run: python3 ./devscripts/install_deps.py -o --include test - name: Run tests @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v6 with: - python-version: '3.9' + python-version: '3.10' - name: Install dev dependencies run: python3 ./devscripts/install_deps.py -o --include static-analysis - name: Make lazy extractors diff --git a/.github/workflows/signature-tests.yml b/.github/workflows/signature-tests.yml index ae2221d28a..8d48dff669 100644 --- a/.github/workflows/signature-tests.yml +++ b/.github/workflows/signature-tests.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14-dev', pypy-3.11] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', pypy-3.11] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 25cdf21e20..89327581c0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -284,7 +284,7 @@ ## Adding support for a new site You can use `hatch fmt` to automatically fix problems. Rules that the linter/formatter enforces should not be disabled with `# noqa` unless a maintainer requests it. The only exception allowed is for old/printf-style string formatting in GraphQL query templates (use `# noqa: UP031`). -1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython >=3.9 and PyPy >=3.11. Backward compatibility is not required for even older versions of Python. +1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython >=3.10 and PyPy >=3.11. Backward compatibility is not required for even older versions of Python. 1. When the tests pass, [add](https://git-scm.com/docs/git-add) the new files, [commit](https://git-scm.com/docs/git-commit) them and [push](https://git-scm.com/docs/git-push) the result, like this: ```shell diff --git a/README.md b/README.md index 60c312114b..6ee8d641ee 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ # To install nightly with pip: You can suppress this warning by adding `--no-update` to your command or configuration file. ## DEPENDENCIES -Python versions 3.9+ (CPython) and 3.11+ (PyPy) are supported. Other versions and implementations may or may not work correctly. +Python versions 3.10+ (CPython) and 3.11+ (PyPy) are supported. Other versions and implementations may or may not work correctly.