-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add stubs for pynput
package
#7177
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
Conversation
pynput | ||
pynput._info | ||
pynput._util.RESOLUTIONS | ||
pynput.keyboard | ||
pynput.keyboard._base | ||
pynput.keyboard._dummy | ||
pynput.mouse | ||
pynput.mouse._base | ||
pynput.mouse._dummy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are all of those on the stubtest allowlist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stubtest fails to import pynput
since there's no display server running (e.g. x11)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. We should probably re-introduce the flag to disable stubtest in METADATA.toml
we had for a short time. I will send a PR tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could run stubtest under xvfb, which emulates an x11 display. For example: https://github.com/Akuli/porcupine/blob/1ad0d5fa8d944ef66a0dbb7e0100da3a13aebfda/.github/workflows/check.yml#L60-L62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I missing something? stubtest does not appear to fail to import pynput in CI. In fact, if it was failing, you wouldn't see any errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hauntsaninja Here is the failing CI test in the first commit:
https://github.com/python/typeshed/runs/5163416378
error: pynput failed to import: this platform is not supported: ('failed to acquire X connection: Bad display name ""', DisplayNameError(''))
I added the allowlist in the commit after it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see how I confused myself. Sorry about that, thanks!
@rchen152 Could you have a look at the pytype failure? I don't see anything obvious wrong. |
Depends on #7351. This adds support for the |
Looking into the pytype error. |
This change seems to get rid of the pytype_test failure:
|
Co-authored-by: rchen152 <[email protected]>
Thanks! Just added the change in the last commit. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me, although I didn't compare it to the implementation. A few nits below.
Co-authored-by: Sebastian Rittau <[email protected]>
Fixes #4328