Skip to content

fix(stubgen): add --include-vendor flag to generate stubs for vendor dirs#21692

Open
Ajithkumar003-dev wants to merge 1 commit into
python:masterfrom
Ajithkumar003-dev:fix/stubgen-include-vendor-flag
Open

fix(stubgen): add --include-vendor flag to generate stubs for vendor dirs#21692
Ajithkumar003-dev wants to merge 1 commit into
python:masterfrom
Ajithkumar003-dev:fix/stubgen-include-vendor-flag

Conversation

@Ajithkumar003-dev

Copy link
Copy Markdown

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

  • Extracted VENDOR_BLACKLIST constant with only the vendor-related entries
  • Added include_vendor: bool = False to the Options class
  • Updated remove_blacklisted_modules() to subtract VENDOR_BLACKLIST when include_vendor=True
  • Updated is_blacklisted_path() to accept an explicit blacklist argument
  • Wired include_vendor through collect_build_targets()
  • Added --include-vendor CLI flag to parse_options()

Default behaviour is unchanged -- vendor dirs are still skipped unless --include-vendor is passed.

…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
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.

Stubgen skips "vendor" directory

2 participants