Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pywin32: Complete modules using stubgen & stubtest #8866

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Oct 7, 2022

This is the followup to #8825. It does 3 main things:

  1. Use stubgen and stubtest to complete modules, and add missing modules.
  2. Add more items to the allowlist (scripts, tests, demos, gui apps, private utils, deprecated and obsolete, etc. As well as items that fail due to import issues specific to stubtest)
  3. Add all of the "shortcuts" (aliases? Not sure how to call them) to modules that can be called as root modules.* As well as win32com to win32extcom. These are how those modules are actually used and documented (ie: import win32con and import win32com rather than import win32.lib.win32con and import win32comext.). Though both are valid imports.

Some modules could not be fully generated with stubgen because of python/mypy#13822 . Some couldn't because win32ui needs to be imported first.
We can't run stubtest on the CI anyway because of #8660, but if we could, the same mypy issue would result in an error (I had to comment out the imports and delete the modules while testing locally)

* Is there a cleaner way to do this in stubs environment than adding a bunch of top-level modules? Which will result in a ton of *-stubs package when installed from PyPI?

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't reviewed in depth (cos 13,500 lines), but skimmed through -- nothing stands out as obviously incorrect. If there are any issues with specific parts, they can be fixed in followup PRs.

Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

Diff from mypy_primer, showing the effect of this PR on open source code:

apprise (https://github.com/caronc/apprise)
- apprise/plugins/NotifyWindows.py:42: error: Cannot find implementation or library stub for module named "win32api"
- apprise/plugins/NotifyWindows.py:43: error: Cannot find implementation or library stub for module named "win32con"
- apprise/plugins/NotifyWindows.py:44: error: Cannot find implementation or library stub for module named "win32gui"

comtypes (https://github.com/enthought/comtypes)
- comtypes/test/test_win32com_interop.py:14: error: Cannot find implementation or library stub for module named "win32com.client"
- comtypes/test/test_win32com_interop.py:14: error: Cannot find implementation or library stub for module named "win32com"
- comtypes/test/test_dispinterface.py:47: error: Cannot find implementation or library stub for module named "win32com.client.dynamic"
- comtypes/test/test_comserver.py:100: error: Cannot find implementation or library stub for module named "win32com.client"

@AlexWaygood AlexWaygood merged commit 99cb36a into python:master Oct 7, 2022
@Avasam Avasam deleted the pywin32-with-stubgen branch October 7, 2022 17:58
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.

2 participants