fix(stubgen): add --include-vendor flag to generate stubs for vendor dirs#21692
Open
Ajithkumar003-dev wants to merge 1 commit into
Open
fix(stubgen): add --include-vendor flag to generate stubs for vendor dirs#21692Ajithkumar003-dev wants to merge 1 commit into
Ajithkumar003-dev wants to merge 1 commit into
Conversation
…dirs stubgen silently skipped directories named vendor, vendored, _vendor, and _vendored_packages because they appeared in BLACKLIST -- a constant originally intended for the type-checker, not the stub generator. This caused stubs to be silently missing for any package whose subdirectory happened to be named 'vendor', with no warning to the user. Changes: - Extract VENDOR_BLACKLIST constant with only the vendor-related entries - Add include_vendor: bool = False field to the Options class - Update remove_blacklisted_modules() to subtract VENDOR_BLACKLIST when include_vendor=True, leaving the rest of BLACKLIST intact - Update is_blacklisted_path() to accept an explicit blacklist argument - Wire include_vendor through collect_build_targets() - Add --include-vendor CLI flag to parse_options() Default behaviour is unchanged (vendor dirs are still skipped). Pass --include-vendor to opt in. Fixes python#9599
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
Closes #9599
Problem
stubgen silently skipped any directory named vendor, vendored, _vendor, or _vendored_packages because they appeared in BLACKLIST -- a constant originally intended for the type-checker, not the stub generator. Users with code inside a folder named vendor received no stubs and no warning.
Changes
Default behaviour is unchanged -- vendor dirs are still skipped unless --include-vendor is passed.