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

Update stubinfo.py for recent typeshed changes #14265

Merged
merged 2 commits into from
Dec 20, 2022

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Dec 8, 2022

Removals from stubinfo.py:

Additions:

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Dec 8, 2022

pywin32 makes an insane number of modules available if you pip install pywin32:

Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import isapi
>>> import pythonwin
>>> import win32
>>> import win32com
>>> import win32comext
>>> import afxres
>>> import commctrl
>>> import win32ui
>>> import dde
>>> import mmapfile
>>> import mmsystem
>>> import ntsecuritycon
>>> import odbc
>>> import perfmon
>>> import pythoncom
>>> import pywintypes
>>> import regutil
>>> import servicemanager
>>> import sspicon
>>> import timer
>>> import win2kras
>>> import win32api
>>> import win32clipboard
>>> import win32con
>>> import win32console
>>> import win32cred
>>> import win32crypt
>>> import win32cryptcon
>>> import win32event
>>> import win32evtlog
>>> import win32evtlogutil
>>> import win32file
>>> import win32gui
>>> import win32gui_struct
>>> import win32help
>>> import win32inet
>>> import win32inetcon
>>> import win32job
>>> import win32lz
>>> import win32net
>>> import win32netcon
>>> import win32pdh
>>> import win32pdhquery
>>> import win32pipe
>>> import win32print
>>> import win32process
>>> import win32profile
>>> import win32ras
>>> import win32security
>>> import win32service
>>> import win32serviceutil
>>> import win32timezone
>>> import win32trace
>>> import win32transaction
>>> import win32ts
>>> import win32uiole
>>> import winerror
>>> import winioctlcon
>>> import winnt
>>> import winperf
>>> import winxpgui
>>> import winxptheme

Stubs for all of ^those modules are now available if you pip install types-pywin32. I haven't added them all to stubinfo.py in this PR, as it seemed like overkill, but also there's not a particularly principled reason to leave them out.

@github-actions

This comment has been minimized.

@tmke8
Copy link
Contributor

tmke8 commented Dec 8, 2022

Do the suggested type stubs have to live in the typeshed repository? If not, there would also be the pandas stubs: https://github.com/pandas-dev/pandas-stubs

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Dec 8, 2022

They don't necessarily, but because --install-types installs things automatically, there needs to be a high trust bar for stubs mentioned here.
I think pandas-stubs would meet that bar, since it's first party / under the same Github org as pandas. But up to @JukkaL, don't think we've outlined criteria before.

@github-actions
Copy link
Contributor

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

apprise (https://github.com/caronc/apprise)
- setup.py:36: note: (or run "mypy --install-types" to install all missing stub packages)
- apprise/plugins/NotifyWindows.py:42: error: Cannot find implementation or library stub for module named "win32api"  [import]
- apprise/plugins/NotifyWindows.py:43: error: Cannot find implementation or library stub for module named "win32con"  [import]
- apprise/plugins/NotifyWindows.py:44: error: Cannot find implementation or library stub for module named "win32gui"  [import]
+ apprise/plugins/NotifyWindows.py:42: error: Library stubs not installed for "win32api"  [import]
+ apprise/plugins/NotifyWindows.py:42: note: Hint: "python3 -m pip install types-pywin32"
+ apprise/plugins/NotifyWindows.py:43: error: Library stubs not installed for "win32con"  [import]
+ apprise/plugins/NotifyWindows.py:44: error: Library stubs not installed for "win32gui"  [import]
- apprise/plugins/NotifyMQTT.py:50: error: Cannot find implementation or library stub for module named "paho.mqtt.client"  [import]
- apprise/plugins/NotifyMQTT.py:50: error: Cannot find implementation or library stub for module named "paho.mqtt"  [import]
+ apprise/plugins/NotifyMQTT.py:50: error: Library stubs not installed for "paho.mqtt.client"  [import]
+ apprise/plugins/NotifyMQTT.py:50: note: Hint: "python3 -m pip install types-paho-mqtt"
+ apprise/plugins/NotifyMQTT.py:50: note: (or run "mypy --install-types" to install all missing stub packages)
+ apprise/plugins/NotifyMQTT.py:50: error: Library stubs not installed for "paho.mqtt"  [import]

comtypes (https://github.com/enthought/comtypes)
- comtypes/test/test_win32com_interop.py:13: error: Cannot find implementation or library stub for module named "pythoncom"  [import]
+ comtypes/test/test_win32com_interop.py:13: error: Library stubs not installed for "pythoncom"  [import]
- comtypes/test/test_win32com_interop.py:14: error: Cannot find implementation or library stub for module named "win32com.client"  [import]
+ comtypes/test/test_win32com_interop.py:14: error: Library stubs not installed for "win32com.client"  [import]
- comtypes/test/test_win32com_interop.py:14: error: Cannot find implementation or library stub for module named "win32com"  [import]
+ comtypes/test/test_win32com_interop.py:14: error: Library stubs not installed for "win32com"  [import]
- comtypes/test/test_safearray.py:239: error: Cannot find implementation or library stub for module named "pythoncom"  [import]
+ comtypes/test/test_safearray.py:239: error: Library stubs not installed for "pythoncom"  [import]
- comtypes/test/test_dispinterface.py:21: error: Cannot find implementation or library stub for module named "win32com.client.gencache"  [import]
+ comtypes/test/test_dispinterface.py:21: error: Library stubs not installed for "win32com.client.gencache"  [import]
- comtypes/test/test_dispinterface.py:47: error: Cannot find implementation or library stub for module named "win32com.client.dynamic"  [import]
+ comtypes/test/test_dispinterface.py:47: error: Library stubs not installed for "win32com.client.dynamic"  [import]
- comtypes/test/test_comserver.py:100: error: Cannot find implementation or library stub for module named "win32com.client"  [import]
+ comtypes/test/test_comserver.py:100: error: Library stubs not installed for "win32com.client"  [import]
+ comtypes/test/test_comserver.py:100: note: Hint: "python3 -m pip install types-pywin32"
+ comtypes/test/test_comserver.py:100: note: (or run "mypy --install-types" to install all missing stub packages)

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/orion/utilities/encryption.py:7: error: Library stubs not installed for "cryptography.fernet"  [import]
+ src/prefect/orion/utilities/encryption.py:7: error: Cannot find implementation or library stub for module named "cryptography.fernet"  [import]
- src/prefect/orion/utilities/encryption.py:7: note: Hint: "python3 -m pip install types-cryptography"

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

I guess I have some vague concerns, but they all sort of boil down to "we should improve --install-types"

@hauntsaninja hauntsaninja merged commit fcd705d into python:master Dec 20, 2022
@AlexWaygood AlexWaygood deleted the stubinfo-updates branch December 20, 2022 07:56
arkivm added a commit to arkivm/keylime that referenced this pull request Sep 21, 2023
`atomicwrites` is archived and deprecated (refer
python/mypy#14265 and
python/typeshed#8925)
arkivm added a commit to arkivm/keylime that referenced this pull request Sep 21, 2023
`atomicwrites` is archived and deprecated (refer
python/mypy#14265 and
python/typeshed#8925)
arkivm added a commit to arkivm/keylime that referenced this pull request Sep 21, 2023
`types-atomicwrites` is archived and deprecated (refer
python/mypy#14265 and
python/typeshed#8925)
arkivm added a commit to arkivm/keylime that referenced this pull request Sep 22, 2023
`types-atomicwrites` is archived and deprecated (refer
python/mypy#14265 and
python/typeshed#8925)

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
maugustosilva pushed a commit to keylime/keylime that referenced this pull request Sep 26, 2023
`types-atomicwrites` is archived and deprecated (refer
python/mypy#14265 and
python/typeshed#8925)

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants