Skip to content

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

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

[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

@andrew-anyscale andrew-anyscale commented Mar 13, 2026

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

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

@andrew-anyscale
Copy link
Contributor Author

andrew-anyscale commented Mar 13, 2026

Reviews in this chain:
#61709 [release] Add GitHubClient: core HTTP infrastructure and exception
 └#61767 [release] Add GitHubClient: pull request support
  └#61768 [release] Add GitHubClient: issue support
   └#61710 [release] Replace PyGithub with GitHubClient in ray_release
    └#61711 [ci] Replace PyGithub with GitHubClient in get_contributors.py
     └#61770 [release] Add --no-upgrade to pip-compile args
      └#61712 [release] Remove PyGithub from requirements

@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
6 b77b10aa ccbd37dc rebase Mar 16 8:43 AM 0 files changed
7 82d91f32 20df3241 diff Mar 16 9:25 AM 1 file changed, 4 insertions(+), 3 deletions(-)
8 51b10b0b ea99e33d rebase Mar 16 10:55 AM 0 files changed
9 1e1c7417 b33299e6 rebase Mar 16 11:51 AM 0 files changed
10 602e1f6b 04f5106d rebase Mar 16 12:09 PM 0 files changed
11 1772209e 04f5106d diff Mar 16 12:21 PM 2 files changed, 174 insertions(+)
12 4dfdcd3d 84176412 rebase Mar 16 12:47 PM 0 files changed
13 1775a02b 5d5cae64 rebase Mar 16 15:17 PM 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
@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
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from d842bf0 to ccbd37d Compare March 16, 2026 15:43
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 4a0b594 to b77b10a Compare March 16, 2026 15:43
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from ccbd37d to 20df324 Compare March 16, 2026 16:25
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from b77b10a to 82d91f3 Compare March 16, 2026 16:25
@andrew-anyscale andrew-anyscale marked this pull request as ready for review March 16, 2026 16:25
@andrew-anyscale andrew-anyscale requested a review from a team as a code owner March 16, 2026 16:25
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from 20df324 to ea99e33 Compare March 16, 2026 17:55
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 82d91f3 to 51b10b0 Compare March 16, 2026 17:55
Copy link
Collaborator

@aslonnie aslonnie left a comment

Choose a reason for hiding this comment

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

could you also help also add a small unit test for this get_contributors.py code? this is a small script that is used in the release process.

@aslonnie aslonnie requested a review from a team March 16, 2026 18:32
Use GitHubClient.get_repo().get_pull() instead of the PyGithub
Github/repo.get_pull() calls.

Topic: remove-pygithub-ci
Relative: remove-pygithub-release
Signed-off-by: andrew <andrew@anyscale.com>
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from ea99e33 to b33299e Compare March 16, 2026 18:51
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 51b10b0 to 1e1c741 Compare March 16, 2026 18:51
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 1e1c741 to 602e1f6 Compare March 16, 2026 19:09
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from b33299e to 04f5106 Compare March 16, 2026 19:09
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 602e1f6 to 1772209 Compare March 16, 2026 19:21
@andrew-anyscale
Copy link
Contributor Author

Added a test script!

@ray-gardener ray-gardener bot added the devprod label Mar 16, 2026
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from 04f5106 to 8417641 Compare March 16, 2026 19:47
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 1772209 to 4dfdcd3 Compare March 16, 2026 19:47
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-release branch from 8417641 to 5d5cae6 Compare March 16, 2026 22:17
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/remove-pygithub-ci branch from 4dfdcd3 to 1775a02 Compare March 16, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants