-
Notifications
You must be signed in to change notification settings - Fork 16
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
Improve PyPI READMEs for stubs packages #105
Improve PyPI READMEs for stubs packages #105
Conversation
We might want to switch to using jinja for some of the stuff going on in |
stub_uploader/metadata.py
Outdated
@property | ||
def upstream_repository(self) -> str | None: | ||
return self.data.get("upstream_repository") |
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.
Possibly we could do some validation here. Typeshed already does a bunch of validation checks for this field, though, so maybe it's not necessary.
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.
A few general notes: Generally the stub_uploader should treat everything coming from typeshed as "tainted" as a precaution against an attacker gaining access to a typeshed maintainer's GitHub account. (This is the reason why we have so few stub_uploader maintainers -> to limit the attack vector. Personally, I consider every typeshed maintainer to be a stub_uploader maintainer, just without the commit rights.) Crashing the uploader is fine, the risk is uploading potentially harmful code under a "types-" name.
That said, an isinstance
check and regexp with "safe" markdown chars can't hurt here. The regexp check should probably just print a warning and return None
.
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 added a little more validation in 796d2ea. We could add more. Should we return None
if .isascii()
returns False
? If a regex, what regex?
Open to ideas here, not sure how far we should go :)
… use the METADATA.toml version spec
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.
Nice, these are very useful additions!
upstream_repository
field in a stubs package'sMETADATA.toml
file.types-requests==2.31.0.8
aims to provide accurate annotations forrequests>=2.31.0
.