Make comtypes generated files IDE-friendly#18564
Merged
Merged
Conversation
Contributor
|
This PR lacks an entry in the changelog. |
seanbudd
approved these changes
Jul 29, 2025
Member
|
Thanks @gexgd0419 |
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.
Link to issue number:
Fixes #17608
Summary of the issue:
Since newer versions of
comtypeschanged the generatedcomtypes.genmodule code, the functionmakeIDEFriendlyincomInterfaces_sconscriptno longer patches the generated files.Some background: NVDA uses its own custom folder,
comInterfaces, for the modules generated bycomtypes, which would by default be put undercomtypes.gen. Although special care is taken to make surecomtypes.gen.SomeLibrarycan still reference the module incomInterfaces, IDEs such as VS Code is not smart enough to figure that out, and continue to find those modules incomtypes.gen, where those modules don't exist because they have been moved tocomInterfaces.makeIDEFriendlywas created to address this issue by replacing the following lines in the generated code:with something like this:
but it stops working now, because comtypes now generates the following code:
Description of user facing changes:
None
Description of developer facing changes:
IDEs such as VS Code will be able to locate COM module imports again.
Description of development approach:
Change
makeIDEFriendly, so now it replaces the following:with the following:
Testing strategy:
Regenerated the COM modules using
./scons source.Known issues with pull request:
The fix might break again with a future comtypes version.
Code Review Checklist:
@coderabbitai summary