-
-
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
Allow non-types dependencies #5768
Allow non-types dependencies #5768
Comments
Remove the check in check_consistency that ensures that only other type packages from typeshed are being depended on. Instead, add an explanation to CONTRIBUTING that spells out the requirements. This adds a higher, but reasonable burden on maintainers to check the dependencies manually. Part of python#5768
Remove the check in check_consistency that ensures that only other type packages from typeshed are being depended on. Instead, add an explanation to CONTRIBUTING that spells out the requirements. This adds a higher, but reasonable burden on maintainers to check the dependencies manually. Part of #5768
Copying relevant discussion from #5618 for context:
|
I'm running into this issue for tensorflow stubs. Most tensorflow type annotations depend on a couple basic numpy types. So at moment my options look like don't include numpy types and have most annotations be too strict or have Any almost everywhere. What's needed to work on this task? I can see one issue is pyright check produces errors from dependency not being installed. Is the prerequisite being able to run checks for only changed stubs as mentioned here, #5952 |
If I understand correctly, the next steps are:
A potential problem is if packages If we have a package Is this all there's to it, or am I missing something? I haven't followed this discussion in detail before, because it seemed to be complicated and also spread up across many places. |
We need changes to mypy_test and the others, see e.g. #5952 (comment) We need some changes in stub_uploader as well, which has validation around this. And I think it's a good opportunity to do #8312 I have the stub_uploader patch locally, but haven't PR-ed it because of some conflicts with typeshed-internal/stub_uploader#57 which I was hoping would get merged |
I'm mostly confused about "changes to mypy_test and the others" part.
|
Our CI wouldn't catch changes needed for stub_uploader. But yes, everything else is probably covered under "get CI green". Here's code that checks if a package contains a py.typed: Line 141 in cc7d256
But we probably don't need it; we should get errors in type checking tests if something doesn't have py.typed. People have previously suggested using an allowlist of packages (I believe for security reasons), which would also take care of that. |
I personally don't see how duplicating the dependencies into a separate allowlist in the same repository improves security. |
It'd be in stub_uploader. I don't have opinions on it, but mentioned it as a thing that has been previously discussed, since e.g. an allowlist would make validation like checking for py.typed not very important. |
As I mentioned on the PR typeshed-internal/stub_uploader#59 this introduces a security hole. Having an allowlist in |
Could you expand on what the security risk is, exactly? Like @Akuli, I'm not sure I've ever seen it fully explained (probably because I'm somewhat new as a maintainer :-) I agree with the consensus on this issue that this is a feature we really need at this point. The situation with |
Arbitrary code can be executed during a Python package installation, so if someone adds a malicious package as a dependency, it can cause really big damage, as many of |
That's surely a security risk for any open-source package depending on another open-source package -- is the security hole here that users might not be expecting the installation of a stubs package to install, e.g., |
The risk is that someone my add e.g. |
@AlexWaygood I'd love to see this completed. Is there anything I could help with to free up some of your (and others') time? |
I'd love to see it completed as well, but just haven't had the time to work on it lately, with all the other typeshed-related things going on :( If you fancy taking a look at getting |
Okay, so in terms of what's left to do here on typeshed's tests:
|
For visibility / tracking. There is still one issue left with pytype: #9459 (comment) There's possible workarounds (silence the error or ignore the file in pytype), but I think we're currently waiting to see if pytype can provide a non-hacky solution with an update. |
This will allow typeshed's pytype_test to declare missing modules. See python/typeshed#5768 and python/typeshed#9459 for context. PiperOrigin-RevId: 501058238
Non-types dependencies are now finally, officially, Allowed 🥳🥳. (But let's maybe wait for the stub-uploader to upload the new versions of |
Thanks @hauntsaninja for the PRs to the stub-uploader repo, thanks @Avasam for the PR fixing our pyright tests, and thanks @Avasam and @rchen152 for the PRs fixing our pytype tests! |
Okay, the new versions of |
This was previously discussed in #5618 and came up in #5765. I think the consensus is that we should allow this. This issue is mainly to track this.
The text was updated successfully, but these errors were encountered: