-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Add PBS Python provider #19462
Add PBS Python provider #19462
Conversation
Marked as draft, since #19379 adds the PyGithub requirement to the repo, and I'm too lazy to also add it here 😄 Otherwise everything is ready for showtime. |
Also note there's significant overlap between this and the Pyenv implementation. After this PR I plan on shifting some of the duplicated code to the generic code to allow the various implementations to just define whats necessary. |
pass | ||
|
||
|
||
def _choose_python( |
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 think the pyenv backend has a bug where it doesn't respect patch version constraints. This code likely could be shared.
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.
PR with fix for the pyenv backend #21139
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!
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.
Putting this here might make include-listing for #19458 more fiddly. Thoughts on putting this in (some subdirectory of) pants_release
?
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 really like the locality, but also I sympathize with the visibility pain.
We do something similar for terraform here so standardizing (and maybe wiring up to update-lockfiles
?) would be a good idea.
def _github(): | ||
token = os.environ.get("GH_TOKEN") | ||
if not token: | ||
token = subprocess.run( | ||
["gh", "auth", "token"], check=True, text=True, capture_output=True | ||
).stdout.strip() | ||
|
||
return github.Github(auth=github.Auth.Token(token)) |
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.
Pending #19379 merging and moving this script to pants_release
(or something), this could be shared with the existing code there.
In addition, based on #19379 (comment), if we keep the reimplementation here, the subprocess.run
can happen unconditionally and simplify the code: gh auth token
handles GH_TOKEN
itself.
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'll update now that the other PR is merged.
src/python/pants/backend/python/providers/pbs/scripts/generate_urls.py
Outdated
Show resolved
Hide resolved
src/python/pants/backend/python/providers/pbs/scripts/generate_urls.py
Outdated
Show resolved
Hide resolved
src/python/pants/backend/python/providers/pbs/versions_info.json
Outdated
Show resolved
Hide resolved
For the specific case of in-repo plugins it would be really spiffy if this provider could be enabled conditionally. (per target? per python version?) That would make the "hermetic python" stories a big easier to explain since it would not have a "except if you have plugins" asterisk. I know that's also scope-creepy and need not block merging. |
fixes pantsbuild#20175 fix inspired by pantsbuild#19462
Add Python Build Standalone (aka PBS) as another "Python Provider". Additionally, a script is provided that scrapes the GitHub API for release information. Original work (most of it!) in #19462 by @thejcannon --------- Co-authored-by: Joshua <joshdcannon@gmail.com>
I am gong to close this in favor of #21422 Thank you for doing almost all of the work! |
This change adds Python Build Standalone (aka PBS) as another "Python Provider". Additionally, a script is provided that scrapes the GitHub API for release information.