-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Run stubtest under different OS environments #8660
Comments
We already do this in CI for our stdlib stubs, and it works pretty well. For most of our third-party stubs, it might be a bit overkill; but on the other hand, it probably wouldn't slow down CI that much to have three stubtest runs instead of one on a PR relating to third-party stubs. I'm curious for @hauntsaninja's thoughts :) |
I would honestly limit this to just select stubs that need it. We ran into CI limits in the past and we don't need to waste them on what is inconsequential for most stubs. |
It's an unrelated change, but we could consider doing something similar to python/mypy#13249. That would reduce our risk of running into CI limits. |
I don't think this is worth it for third party stubs. In practice, the only OS dependent things I remember in third party stubs are implementation details that we usually would avoid adding types for. If the concern is fiddliness with the allowlists or local dev, consider using the empty regex trick, where if you do |
@hauntsaninja The concern is more that for libraries with OS-specific support and modules, stubtest is pretty much useless in detecting missing or invalid types (because we have to exclude everything that doesn't work with the current CI configuration). This is especially prevalent with I/O (mouse, keyboard, displays*, ...) where the API changes wildly between OSes (so I'd say, it is wrong to assume that the only difference is implementation details). I can fully understand concerns about CI limits however, especially when this scenario doesn't apply for most stubs. My current project just happens to use a handful of libraries that fall in this niche. *of course displays would still be an issue, as the CI runs headless, but I think that's a different possible improvement/enhancement, if that's even feasable. |
Perhaps we could run OS-specific stubtest only for specific packages where we know there are differences. |
I just stumbled upon a new issue relating to this when working on pywin32 stubs: pytype is a ton of stubtest:
Sounds reasonable to me. You could maybe even specify which OSes to run stubtests on. If unspecified then default to linux-only (the current behavior). |
No idea what's causing the pytype errors :/ it'll be easier to take a look at those if you file the PR, then we can play around with it :) For stubtest, for now you may need to just put
Yeah. It might be complicated, though. Currently in our CI:
We'd need to change that if we want to resolve this. One way to to do that might be to:
|
@AlexWaygood I didn't feel confident posting the PR yet, I still had some work and improvements to do first (although I could post as WIP, but I'm really close to ready for review now). Here's the CI runs from my fork :
I wouldn't waste your time investigating this until I make a proper PR and see if there's an actual issue left with pytype. And
I don't doubt ^^" This doesn't feel like a low-hanging fruit. |
There several thoughts from my side. If we allow to run stub packages on different OSes, we would need:
I think we can start incrementally by adding I will send a prototype PR for this today :) |
Btw, I can ask GitHub to give us more minutes if it is an issue. |
This is an issue I'm having while adding D3DShot #8652,
PyAutoGUI #8654and pywin32 stubs. Some modules are highly dependent on the OS, and as such, I have to add them to thestubtest_allowlist
, even though I can run it just fine locally.For this reason, and to help with stub completeness (#8481), I suggest that stubtest should
by default be run under Windows, Linux and Darwin (just like mypy and pyright already are)be configurable to run under Windows and/or Linux and/or Darwin.This also means we should be able to specify the OS in stubtest_allowlist. Whether it's by having a specific file (
stubtest_allowlist.linux.txt
), prefixing the line (linux:pyautogui._pyautogui_osx
) or any other proposals.The text was updated successfully, but these errors were encountered: