[yt-dlp] Expose options type - #16354
Conversation
This comment has been minimized.
This comment has been minimized.
|
Thanks for contributing! |
|
The distinction I’m addressing is public typing API rather than runtime importability. The linked issue’s stored-dictionary pattern needs an explicit 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. |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Closes #16331.
Expose the existing yt-dlp options
TypedDictas the type-checking-onlyYoutubeDLOptionsso callers can annotate a stored options dictionary before passing it toYoutubeDL. 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.pypython tests/mypy_test.py stubs/yt-dlp(Python 3.10–3.15)python tests/pyright_test.py stubs/yt-dlppython tests/regr_test.py yt-dlppython tests/stubtest_third_party.py yt-dlp