[build] Rename requirements files to clean up dependency graph (#16740)

Authored by: bashonly
This commit is contained in:
bashonly 2026-05-16 15:30:45 -05:00 committed by GitHub
parent 410e0af537
commit 32f1671a90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 33 additions and 32 deletions

View File

@ -325,7 +325,7 @@ jobs:
brew uninstall --ignore-dependencies python3 brew uninstall --ignore-dependencies python3
python3 -m venv ~/yt-dlp-build-venv python3 -m venv ~/yt-dlp-build-venv
source ~/yt-dlp-build-venv/bin/activate source ~/yt-dlp-build-venv/bin/activate
python3 -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python3 -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
rm -rf build rm -rf build
# Only directly install wheels for "macosx_10_15_universal2" and "any" platforms # Only directly install wheels for "macosx_10_15_universal2" and "any" platforms
mkdir -p build/wheels mkdir -p build/wheels
@ -335,7 +335,7 @@ jobs:
--platform=any \ --platform=any \
-d build/wheels \ -d build/wheels \
--require-hashes \ --require-hashes \
-r "bundle/requirements/requirements-macos.txt" -r "bundle/requirements/macos.txt"
python3 -m pip install --force-reinstall --no-deps -U build/wheels/*.whl python3 -m pip install --force-reinstall --no-deps -U build/wheels/*.whl
rm -rf build/wheels/* rm -rf build/wheels/*
# We need to fuse our own universal2 wheels for curl_cffi and cffi # We need to fuse our own universal2 wheels for curl_cffi and cffi
@ -347,7 +347,7 @@ jobs:
--platform "${platform}" \ --platform "${platform}" \
-d build/wheels \ -d build/wheels \
--require-hashes \ --require-hashes \
-r "bundle/requirements/requirements-macos-curl_cffi.txt" -r "bundle/requirements/macos-curl_cffi.txt"
done done
python3 -m delocate.cmd.delocate_merge build/wheels/curl_cffi-*.whl -w build/universal2 python3 -m delocate.cmd.delocate_merge build/wheels/curl_cffi-*.whl -w build/universal2
python3 -m delocate.cmd.delocate_merge build/wheels/cffi-*.whl -w build/universal2 python3 -m delocate.cmd.delocate_merge build/wheels/cffi-*.whl -w build/universal2
@ -456,12 +456,12 @@ jobs:
$PSNativeCommandUseErrorActionPreference = $true $PSNativeCommandUseErrorActionPreference = $true
python -m venv /yt-dlp-build-venv python -m venv /yt-dlp-build-venv
/yt-dlp-build-venv/Scripts/Activate.ps1 /yt-dlp-build-venv/Scripts/Activate.ps1
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-win-${Env:ARCH}-pyinstaller.txt" python -m pip install -U --require-hashes -r "bundle/requirements/win-${Env:ARCH}-pyinstaller.txt"
if (${Env:ARCH} -eq "x86") { if (${Env:ARCH} -eq "x86") {
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-default.txt" python -m pip install -U --require-hashes -r "bundle/requirements/default.txt"
} else { } else {
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-curl-cffi.txt" python -m pip install -U --require-hashes -r "bundle/requirements/curl-cffi.txt"
} }
- name: Prepare - name: Prepare

View File

@ -79,9 +79,9 @@ jobs:
- name: Install test requirements - name: Install test requirements
shell: bash shell: bash
run: | run: |
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-test.txt" python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-default.txt" python -m pip install -U --require-hashes -r "bundle/requirements/default.txt"
- name: Run tests - name: Run tests
timeout-minutes: 15 timeout-minutes: 15
shell: bash shell: bash

View File

@ -75,16 +75,16 @@ jobs:
- name: Install test requirements (cpython) - name: Install test requirements (cpython)
if: ${{ !startsWith(matrix.python-version, 'pypy') }} if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: | run: |
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-test.txt" python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-curl-cffi.txt" python -m pip install -U --require-hashes -r "bundle/requirements/curl-cffi.txt"
- name: Install test requirements (PyPy) - name: Install test requirements (PyPy)
if: ${{ startsWith(matrix.python-version, 'pypy') }} if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: | run: |
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-test.txt" python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-default.txt" python -m pip install -U --require-hashes -r "bundle/requirements/default.txt"
- name: Run tests - name: Run tests
timeout-minutes: 15 timeout-minutes: 15

View File

@ -31,8 +31,8 @@ jobs:
- name: Install test requirements - name: Install test requirements
shell: bash shell: bash
run: | run: |
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-test.txt" python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
- name: Run tests - name: Run tests
timeout-minutes: 15 timeout-minutes: 15
shell: bash shell: bash
@ -56,8 +56,8 @@ jobs:
python-version: '3.14' python-version: '3.14'
- name: Install dev dependencies - name: Install dev dependencies
run: | run: |
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-static-analysis.txt" python -m pip install -U --require-hashes -r "bundle/requirements/static-analysis.txt"
- name: Make lazy extractors - name: Make lazy extractors
run: python ./devscripts/make_lazy_extractors.py run: python ./devscripts/make_lazy_extractors.py
- name: Run ruff - name: Run ruff

View File

@ -185,8 +185,8 @@ jobs:
- name: Install Requirements - name: Install Requirements
run: | run: |
sudo apt -y install pandoc man sudo apt -y install pandoc man
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-build.txt" python -m pip install -U --require-hashes -r "bundle/requirements/build.txt"
- name: Prepare - name: Prepare
env: env:

View File

@ -36,9 +36,9 @@ jobs:
- name: Install Python dependencies - name: Install Python dependencies
run: | run: |
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pip.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pyflakes.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pyflakes.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-test.txt" python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
- name: Install requirements - name: Install requirements
env: env:

View File

@ -14,8 +14,8 @@ export PYTHONPATH
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source .venv/bin/activate source .venv/bin/activate
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-pyinstaller.txt" python -m pip install -U --require-hashes -r "bundle/requirements/pyinstaller.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/requirements-${REQUIREMENTS}.txt" python -m pip install -U --require-hashes -r "bundle/requirements/${REQUIREMENTS}.txt"
python -m devscripts.make_lazy_extractors python -m devscripts.make_lazy_extractors
python devscripts/update-version.py -c "${CHANNEL}" -r "${ORIGIN}" "${VERSION}" python devscripts/update-version.py -c "${CHANNEL}" -r "${ORIGIN}" "${VERSION}"

View File

@ -34,7 +34,7 @@ PYPROJECT_PATH = BASE_PATH / 'pyproject.toml'
MAKEFILE_PATH = BASE_PATH / 'Makefile' MAKEFILE_PATH = BASE_PATH / 'Makefile'
LOCKFILE_PATH = BASE_PATH / 'uv.lock' LOCKFILE_PATH = BASE_PATH / 'uv.lock'
REQUIREMENTS_PATH = BASE_PATH / 'bundle/requirements' REQUIREMENTS_PATH = BASE_PATH / 'bundle/requirements'
REQS_OUTPUT_TMPL = 'requirements-{}.txt' REQS_OUTPUT_TMPL = '{}.txt'
EXTRAS_TABLE = 'project.optional-dependencies' EXTRAS_TABLE = 'project.optional-dependencies'
GROUPS_TABLE = 'dependency-groups' GROUPS_TABLE = 'dependency-groups'
@ -544,11 +544,11 @@ def package_diff_dict(
return ret_dict return ret_dict
def get_lock_packages(lock: dict[str, typing.Any]) -> dict[str, str]: def get_lock_packages(lock: dict[str, typing.Any], ignore_names: list[str] | None = None) -> dict[str, str]:
return { return {
package['name']: package['version'] package['name']: package['version']
for package in lock['package'] for package in lock['package']
if package.get('version') if package.get('version') and package['name'] not in (ignore_names or [])
} }
@ -578,6 +578,7 @@ def update_requirements(
pyproject_text = PYPROJECT_PATH.read_text() pyproject_text = PYPROJECT_PATH.read_text()
pyproject_toml = parse_toml(pyproject_text) pyproject_toml = parse_toml(pyproject_text)
package_name = pyproject_toml['project']['name']
extras = get_extras(pyproject_toml) extras = get_extras(pyproject_toml)
# Remove pinned extras so they don't muck up the lockfile during generation/upgrade # Remove pinned extras so they don't muck up the lockfile during generation/upgrade
@ -603,8 +604,8 @@ def update_requirements(
run_process('uv', 'lock', upgrade_arg, env=env) run_process('uv', 'lock', upgrade_arg, env=env)
# Record diff in uv.lock packages # Record diff in uv.lock packages
old_packages = get_lock_packages(old_lock) if old_lock else {} old_packages = get_lock_packages(old_lock, [package_name]) if old_lock else {}
new_packages = get_lock_packages(parse_toml(LOCKFILE_PATH.read_text())) new_packages = get_lock_packages(parse_toml(LOCKFILE_PATH.read_text()), [package_name])
all_updates = package_diff_dict(old_packages, new_packages) all_updates = package_diff_dict(old_packages, new_packages)
# Update Windows PyInstaller requirements; need to compare before & after .txt's for reporting # Update Windows PyInstaller requirements; need to compare before & after .txt's for reporting