mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-10 07:22:17 +01:00
[devscripts] install_deps: Align options/terms with PEP 735 (#15200)
Authored by: bashonly
This commit is contained in:
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@@ -343,14 +343,14 @@ 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 devscripts/install_deps.py --only-optional-groups --include-group build
|
python3 devscripts/install_deps.py --omit-default --include-extra build
|
||||||
python3 devscripts/install_deps.py --print --include-group pyinstaller > requirements.txt
|
python3 devscripts/install_deps.py --print --include-extra pyinstaller > requirements.txt
|
||||||
# We need to ignore wheels otherwise we break universal2 builds
|
# We need to ignore wheels otherwise we break universal2 builds
|
||||||
python3 -m pip install -U --no-binary :all: -r requirements.txt
|
python3 -m pip install -U --no-binary :all: -r requirements.txt
|
||||||
# We need to fuse our own universal2 wheels for curl_cffi
|
# We need to fuse our own universal2 wheels for curl_cffi
|
||||||
python3 -m pip install -U 'delocate==0.11.0'
|
python3 -m pip install -U 'delocate==0.11.0'
|
||||||
mkdir curl_cffi_whls curl_cffi_universal2
|
mkdir curl_cffi_whls curl_cffi_universal2
|
||||||
python3 devscripts/install_deps.py --print --only-optional-groups --include-group curl-cffi > requirements.txt
|
python3 devscripts/install_deps.py --print --omit-default --include-extra curl-cffi > requirements.txt
|
||||||
for platform in "macosx_11_0_arm64" "macosx_11_0_x86_64"; do
|
for platform in "macosx_11_0_arm64" "macosx_11_0_x86_64"; do
|
||||||
python3 -m pip download \
|
python3 -m pip download \
|
||||||
--only-binary=:all: \
|
--only-binary=:all: \
|
||||||
@@ -484,11 +484,11 @@ jobs:
|
|||||||
mkdir /pyi-wheels
|
mkdir /pyi-wheels
|
||||||
python -m pip download -d /pyi-wheels --no-deps --require-hashes "pyinstaller@${Env:PYI_URL}#sha256=${Env:PYI_HASH}"
|
python -m pip download -d /pyi-wheels --no-deps --require-hashes "pyinstaller@${Env:PYI_URL}#sha256=${Env:PYI_HASH}"
|
||||||
python -m pip install --force-reinstall -U "/pyi-wheels/${Env:PYI_WHEEL}"
|
python -m pip install --force-reinstall -U "/pyi-wheels/${Env:PYI_WHEEL}"
|
||||||
python devscripts/install_deps.py --only-optional-groups --include-group build
|
python devscripts/install_deps.py --omit-default --include-extra build
|
||||||
if ("${Env:ARCH}" -eq "x86") {
|
if ("${Env:ARCH}" -eq "x86") {
|
||||||
python devscripts/install_deps.py
|
python devscripts/install_deps.py
|
||||||
} else {
|
} else {
|
||||||
python devscripts/install_deps.py --include-group curl-cffi
|
python devscripts/install_deps.py --include-extra curl-cffi
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
|
|||||||
2
.github/workflows/challenge-tests.yml
vendored
2
.github/workflows/challenge-tests.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
|||||||
unzip quickjs.zip
|
unzip quickjs.zip
|
||||||
- name: Install test requirements
|
- name: Install test requirements
|
||||||
run: |
|
run: |
|
||||||
python ./devscripts/install_deps.py --print --only-optional-groups --include-group test > requirements.txt
|
python ./devscripts/install_deps.py --print --omit-default --include-extra test > requirements.txt
|
||||||
python ./devscripts/install_deps.py --print -c certifi -c requests -c urllib3 -c yt-dlp-ejs >> requirements.txt
|
python ./devscripts/install_deps.py --print -c certifi -c requests -c urllib3 -c yt-dlp-ejs >> requirements.txt
|
||||||
python -m pip install -U -r requirements.txt
|
python -m pip install -U -r requirements.txt
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|||||||
2
.github/workflows/core.yml
vendored
2
.github/workflows/core.yml
vendored
@@ -63,7 +63,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install test requirements
|
- name: Install test requirements
|
||||||
run: python ./devscripts/install_deps.py --include-group test --include-group curl-cffi
|
run: python ./devscripts/install_deps.py --include-extra test --include-extra curl-cffi
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
continue-on-error: False
|
continue-on-error: False
|
||||||
|
|||||||
4
.github/workflows/download.yml
vendored
4
.github/workflows/download.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- name: Install test requirements
|
- name: Install test requirements
|
||||||
run: python ./devscripts/install_deps.py --include-group dev
|
run: python ./devscripts/install_deps.py --include-extra dev
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: python ./devscripts/run_tests.py download
|
run: python ./devscripts/run_tests.py download
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install test requirements
|
- name: Install test requirements
|
||||||
run: python ./devscripts/install_deps.py --include-group dev
|
run: python ./devscripts/install_deps.py --include-extra dev
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: python ./devscripts/run_tests.py download
|
run: python ./devscripts/run_tests.py download
|
||||||
|
|||||||
4
.github/workflows/quick-test.yml
vendored
4
.github/workflows/quick-test.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- name: Install test requirements
|
- name: Install test requirements
|
||||||
run: python ./devscripts/install_deps.py --only-optional-groups --include-group test
|
run: python ./devscripts/install_deps.py --omit-default --include-extra test
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
run: |
|
run: |
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- name: Install dev dependencies
|
- name: Install dev dependencies
|
||||||
run: python ./devscripts/install_deps.py --only-optional-groups --include-group static-analysis
|
run: python ./devscripts/install_deps.py --omit-default --include-extra static-analysis
|
||||||
- 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
|
||||||
|
|||||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -180,7 +180,7 @@ jobs:
|
|||||||
- name: Install Requirements
|
- name: Install Requirements
|
||||||
run: |
|
run: |
|
||||||
sudo apt -y install pandoc man
|
sudo apt -y install pandoc man
|
||||||
python devscripts/install_deps.py --only-optional-groups --include-group build
|
python devscripts/install_deps.py --omit-default --include-extra build
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
env:
|
env:
|
||||||
|
|||||||
2
.github/workflows/test-workflows.yml
vendored
2
.github/workflows/test-workflows.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ACTIONLINT_TARBALL: ${{ format('actionlint_{0}_linux_amd64.tar.gz', env.ACTIONLINT_VERSION) }}
|
ACTIONLINT_TARBALL: ${{ format('actionlint_{0}_linux_amd64.tar.gz', env.ACTIONLINT_VERSION) }}
|
||||||
run: |
|
run: |
|
||||||
python -m devscripts.install_deps --only-optional-groups --include-group test
|
python -m devscripts.install_deps --omit-default --include-extra test
|
||||||
sudo apt -y install shellcheck
|
sudo apt -y install shellcheck
|
||||||
python -m pip install -U pyflakes
|
python -m pip install -U pyflakes
|
||||||
curl -LO "${ACTIONLINT_REPO}/releases/download/v${ACTIONLINT_VERSION}/${ACTIONLINT_TARBALL}"
|
curl -LO "${ACTIONLINT_REPO}/releases/download/v${ACTIONLINT_VERSION}/${ACTIONLINT_TARBALL}"
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ While it is strongly recommended to use `hatch` for yt-dlp development, if you a
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
# To only install development dependencies:
|
# To only install development dependencies:
|
||||||
$ python -m devscripts.install_deps --include-group dev
|
$ python -m devscripts.install_deps --include-extra dev
|
||||||
|
|
||||||
# Or, for an editable install plus dev dependencies:
|
# Or, for an editable install plus dev dependencies:
|
||||||
$ python -m pip install -e ".[default,dev]"
|
$ python -m pip install -e ".[default,dev]"
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ To build the standalone executable, you must have Python and `pyinstaller` (plus
|
|||||||
You can run the following commands:
|
You can run the following commands:
|
||||||
|
|
||||||
```
|
```
|
||||||
python devscripts/install_deps.py --include-group pyinstaller
|
python devscripts/install_deps.py --include-extra pyinstaller
|
||||||
python devscripts/make_lazy_extractors.py
|
python devscripts/make_lazy_extractors.py
|
||||||
python -m bundle.pyinstaller
|
python -m bundle.pyinstaller
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ function venvpy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
INCLUDES=(
|
INCLUDES=(
|
||||||
--include-group pyinstaller
|
--include-extra pyinstaller
|
||||||
--include-group secretstorage
|
--include-extra secretstorage
|
||||||
)
|
)
|
||||||
|
|
||||||
if [[ -z "${EXCLUDE_CURL_CFFI:-}" ]]; then
|
if [[ -z "${EXCLUDE_CURL_CFFI:-}" ]]; then
|
||||||
INCLUDES+=(--include-group curl-cffi)
|
INCLUDES+=(--include-extra curl-cffi)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
runpy -m venv /yt-dlp-build-venv
|
runpy -m venv /yt-dlp-build-venv
|
||||||
@@ -28,7 +28,7 @@ runpy -m venv /yt-dlp-build-venv
|
|||||||
source /yt-dlp-build-venv/bin/activate
|
source /yt-dlp-build-venv/bin/activate
|
||||||
# Inside the venv we use venvpy instead of runpy
|
# Inside the venv we use venvpy instead of runpy
|
||||||
venvpy -m ensurepip --upgrade --default-pip
|
venvpy -m ensurepip --upgrade --default-pip
|
||||||
venvpy -m devscripts.install_deps --only-optional-groups --include-group build
|
venvpy -m devscripts.install_deps --omit-default --include-extra build
|
||||||
venvpy -m devscripts.install_deps "${INCLUDES[@]}"
|
venvpy -m devscripts.install_deps "${INCLUDES[@]}"
|
||||||
venvpy -m devscripts.make_lazy_extractors
|
venvpy -m devscripts.make_lazy_extractors
|
||||||
venvpy devscripts/update-version.py -c "${CHANNEL}" -r "${ORIGIN}" "${VERSION}"
|
venvpy devscripts/update-version.py -c "${CHANNEL}" -r "${ORIGIN}" "${VERSION}"
|
||||||
|
|||||||
@@ -25,16 +25,16 @@ def parse_args():
|
|||||||
'-e', '--exclude-dependency', metavar='DEPENDENCY', action='append',
|
'-e', '--exclude-dependency', metavar='DEPENDENCY', action='append',
|
||||||
help='exclude a dependency (can be used multiple times)')
|
help='exclude a dependency (can be used multiple times)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-i', '--include-group', metavar='GROUP', action='append',
|
'-i', '--include-extra', metavar='EXTRA', action='append',
|
||||||
help='include an optional dependency group (can be used multiple times)')
|
help='include an extra/optional-dependencies list (can be used multiple times)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-c', '--cherry-pick', metavar='DEPENDENCY', action='append',
|
'-c', '--cherry-pick', metavar='DEPENDENCY', action='append',
|
||||||
help=(
|
help=(
|
||||||
'only include a specific dependency from the resulting dependency list '
|
'only include a specific dependency from the resulting dependency list '
|
||||||
'(can be used multiple times)'))
|
'(can be used multiple times)'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-o', '--only-optional-groups', action='store_true',
|
'-o', '--omit-default', action='store_true',
|
||||||
help='omit default dependencies unless the "default" group is specified with --include-group')
|
help='omit the "default" extra unless it is explicitly included (it is included by default)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--print', action='store_true',
|
'-p', '--print', action='store_true',
|
||||||
help='only print requirements to stdout')
|
help='only print requirements to stdout')
|
||||||
@@ -51,27 +51,27 @@ def uniq(arg) -> dict[str, None]:
|
|||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
project_table = parse_toml(read_file(args.input))['project']
|
project_table = parse_toml(read_file(args.input))['project']
|
||||||
recursive_pattern = re.compile(rf'{project_table["name"]}\[(?P<group_name>[\w-]+)\]')
|
recursive_pattern = re.compile(rf'{project_table["name"]}\[(?P<extra_name>[\w-]+)\]')
|
||||||
optional_groups = project_table['optional-dependencies']
|
extras = project_table['optional-dependencies']
|
||||||
|
|
||||||
excludes = uniq(args.exclude_dependency)
|
excludes = uniq(args.exclude_dependency)
|
||||||
only_includes = uniq(args.cherry_pick)
|
only_includes = uniq(args.cherry_pick)
|
||||||
include_groups = uniq(args.include_group)
|
include_extras = uniq(args.include_extra)
|
||||||
|
|
||||||
def yield_deps(group):
|
def yield_deps(extra):
|
||||||
for dep in group:
|
for dep in extra:
|
||||||
if mobj := recursive_pattern.fullmatch(dep):
|
if mobj := recursive_pattern.fullmatch(dep):
|
||||||
yield from optional_groups.get(mobj.group('group_name'), ())
|
yield from extras.get(mobj.group('extra_name'), ())
|
||||||
else:
|
else:
|
||||||
yield dep
|
yield dep
|
||||||
|
|
||||||
targets = {}
|
targets = {}
|
||||||
if not args.only_optional_groups:
|
if not args.omit_default:
|
||||||
# legacy: 'dependencies' is empty now
|
# legacy: 'dependencies' is empty now
|
||||||
targets.update(dict.fromkeys(project_table['dependencies']))
|
targets.update(dict.fromkeys(project_table['dependencies']))
|
||||||
targets.update(dict.fromkeys(yield_deps(optional_groups['default'])))
|
targets.update(dict.fromkeys(yield_deps(extras['default'])))
|
||||||
|
|
||||||
for include in filter(None, map(optional_groups.get, include_groups)):
|
for include in filter(None, map(extras.get, include_extras)):
|
||||||
targets.update(dict.fromkeys(yield_deps(include)))
|
targets.update(dict.fromkeys(yield_deps(include)))
|
||||||
|
|
||||||
def target_filter(target):
|
def target_filter(target):
|
||||||
|
|||||||
Reference in New Issue
Block a user