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

Improve PyPI READMEs for stubs packages #105

Merged

Conversation

AlexWaygood
Copy link
Contributor

  • Link directly to PEP-561
  • Link directly to the runtime package the stubs are for, if typeshed provides the upstream_repository field in a stubs package's METADATA.toml file.
  • Clearly state that types-requests==2.31.0.8 aims to provide accurate annotations for requests>=2.31.0.

@AlexWaygood
Copy link
Contributor Author

We might want to switch to using jinja for some of the stuff going on in build_wheel.py; it can make stuff like this much more readable, in my opinion.

Comment on lines 115 to 117
@property
def upstream_repository(self) -> str | None:
return self.data.get("upstream_repository")
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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 :)

Copy link
Contributor

@srittau srittau left a 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!

@srittau srittau merged commit 1feee28 into typeshed-internal:main Oct 6, 2023
3 checks passed
@AlexWaygood AlexWaygood deleted the improve-stubs-descriptions branch October 6, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants