[yt-dlp] Expose options type by ryux1 · Pull Request #16354 · python/typeshed · GitHub
Skip to content

[yt-dlp] Expose options type - #16354

Open
ryux1 wants to merge 2 commits into
python:mainfrom
ryux1:ryux1/yt-dlp-public-options
Open

[yt-dlp] Expose options type#16354
ryux1 wants to merge 2 commits into
python:mainfrom
ryux1:ryux1/yt-dlp-public-options

Conversation

@ryux1

@ryux1 ryux1 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Closes #16331.

Expose the existing yt-dlp options TypedDict as the type-checking-only YoutubeDLOptions so callers can annotate a stored options dictionary before passing it to YoutubeDL. This preserves contextual typing for option values without widening the constructor to arbitrary mappings or changing runtime exports.

A regression test covers the reported stored-dictionary pattern and verifies that invalid option value types are still rejected.

Validated with:

  • pre-commit run --files ...
  • python tests/check_typeshed_structure.py
  • python tests/mypy_test.py stubs/yt-dlp (Python 3.10–3.15)
  • python tests/pyright_test.py stubs/yt-dlp
  • python tests/regr_test.py yt-dlp
  • python tests/stubtest_third_party.py yt-dlp

@github-actions

This comment has been minimized.

@donbarbos

donbarbos commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

@ryux1

ryux1 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

The distinction I’m addressing is public typing API rather than runtime importability. _Params can technically be imported, but its leading underscore marks it private, so recommending it in user annotations couples callers to an implementation name and can trigger private-usage diagnostics under stricter checker configurations.

The linked issue’s stored-dictionary pattern needs an explicit TypedDict annotation to retain per-key contextual types; YoutubeDLOptions provides a supported name for that annotation while preserving strict option-value checking. The added test exercises exactly that pattern.

If Typeshed’s policy is to leave this type private despite #16331, I’m happy to close this, but the rename is the intended behavioral change: making the existing option schema a public type-checking API.

Comment thread stubs/yt-dlp/@tests/test_cases/check_options.py Outdated
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

yt-dlp: incorrect visibility on parameters

3 participants