Skip to content

[ci] Replace PyGithub with GitHubClient in get_contributors.py#61711

Draft
andrew-anyscale wants to merge 1 commit intoandrew/revup/master/remove-pygithub-releasefrom
andrew/revup/master/remove-pygithub-ci
Draft

[ci] Replace PyGithub with GitHubClient in get_contributors.py#61711
andrew-anyscale wants to merge 1 commit intoandrew/revup/master/remove-pygithub-releasefrom
andrew/revup/master/remove-pygithub-ci

Conversation

@andrew-anyscale
Copy link
Contributor

Use GitHubClient.get_repo().get_pull() instead of the PyGithub
Github/repo.get_pull() calls.

Topic: remove-pygithub-ci
Relative: remove-pygithub-release
Labels: draft
Signed-off-by: andrew andrew@anyscale.com

@andrew-anyscale
Copy link
Contributor Author

andrew-anyscale commented Mar 13, 2026

Reviews in this chain:
#61708 [release] Fix requirements_py310.update to use hermetic Python 3.10
 ├#61709 [release] Add GitHubClient to replace PyGithub dependency
 │└#61710 [release] Replace PyGithub with GitHubClient in ray_release
 │ └#61711 [ci] Replace PyGithub with GitHubClient in get_contributors.py
 │  └#61712 [release] Remove PyGithub from requirements
 └#61713 [release] Restrict requirements_py310 targets to amd64 Linux

@andrew-anyscale
Copy link
Contributor Author

andrew-anyscale commented Mar 13, 2026

# head base diff date summary
0 8f7ea696 24aa485b diff Mar 12 20:07 PM 2 files changed, 5 insertions(+), 5 deletions(-)
1 beeb8827 6e6f1542 rebase Mar 12 20:13 PM 0 files changed
2 ea5c3da7 2218a9c7 rebase Mar 13 6:58 AM 0 files changed
3 12ca704e 872d93c1 rebase Mar 13 7:02 AM 0 files changed
4 586fa5cd df424e31 rebase Mar 13 8:13 AM 0 files changed
5 4a0b5940 d842bf04 rebase Mar 13 8:23 AM 0 files changed

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the PyGithub dependency with a local GitHubClient in the get_contributors.py script. The changes are correct and achieve the goal of this refactoring. I've added a couple of comments to get_contributors.py to improve readability and make the error handling more specific and robust following the client change.

g = Github(access_token)
ray_repo = g.get_repo("ray-project/ray")
# Use Github API to fetch PR authors
ray_repo = GitHubClient(access_token).get_repo("ray-project/ray")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

With the switch to GitHubClient, ray_repo.get_pull() will now raise GitHubException on API errors. The exception handling in the loop on lines 102-105 should be updated to catch this specific exception instead of the broad Exception. This will make the error handling more robust and prevent masking other potential issues.

g = Github(access_token)
ray_repo = g.get_repo("ray-project/ray")
# Use Github API to fetch PR authors
ray_repo = GitHubClient(access_token).get_repo("ray-project/ray")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and to follow common practice, it's recommended to first instantiate the GitHubClient into a variable and then use it. This makes the code easier to understand and debug.

Suggested change
ray_repo = GitHubClient(access_token).get_repo("ray-project/ray")
client = GitHubClient(access_token)
ray_repo = client.get_repo("ray-project/ray")

@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 8f7ea69 to beeb882 Compare March 13, 2026 03:13
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from 24aa485 to 6e6f154 Compare March 13, 2026 03:13
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from beeb882 to ea5c3da Compare March 13, 2026 13:58
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch 2 times, most recently from 2218a9c to 872d93c Compare March 13, 2026 14:03
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from ea5c3da to 12ca704 Compare March 13, 2026 14:03
Use GitHubClient.get_repo().get_pull() instead of the PyGithub
Github/repo.get_pull() calls.

Topic: remove-pygithub-ci
Relative: remove-pygithub-release
Labels: draft
Signed-off-by: andrew <andrew@anyscale.com>
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from 872d93c to df424e3 Compare March 13, 2026 15:13
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 12ca704 to 586fa5c Compare March 13, 2026 15:13
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from df424e3 to d842bf0 Compare March 13, 2026 15:23
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 586fa5c to 4a0b594 Compare March 13, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant