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

Update dependency PyGithub to v2 #859

Merged
merged 3 commits into from
Oct 9, 2023
Merged

Update dependency PyGithub to v2 #859

merged 3 commits into from
Oct 9, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Sep 29, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
PyGithub 1.59.1 -> 2.1.1 age adoption passing confidence

Release Notes

pygithub/pygithub (PyGithub)

v2.1.1

Compare Source

Bug Fixes

Maintenance

v2.1.0.post0

Compare Source

Important

Request throttling

This release introduces a default throttling mechanism to mitigate secondary rate limit errors and comply with Github's best practices:
https://docs.github.com/en/rest/guides/best-practices-for-integrators?apiVersion=2022-11-28#dealing-with-secondary-rate-limits

The default throttling of 1 second between writes and 0.25 second between any requests can be configured
for github.Github and github.GithubIntegration:

g = github.Github(seconds_between_requests=0.25, seconds_between_writes=1)

Set these parameters to None to disable throttling and restore earlier behavior.

Request retry

This release introduces a default retry mechanism to retry retry-able 403 responses (primary and secondary rate limit errors only) and any 5xx response.

Class github.GithubRetry implements this behavior, and can be configured via the retry argument of github.Github and github.GithubIntegration.
Retry behavior is configured similar to urllib3.Retry: https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html

g = github.Github(retry=github.GithubRetry())

Set this parameter to None to disable retry mechanism and restore earlier behaviour.

Breaking Changes

Timestamps

Any timestamps returned by this library are datetime with timezone information, usually UTC.
Before this release, timestamps used to be naive datetime instances without timezone.
Comparing (other than ==) these timestamps with naive datetime instances used to work but will now break.
Add a timezone information to your datetime instances before comparison:

if g.get_repo("PyGithub/PyGithub").created_at < datetime(2012, 2, 26, tzinfo=timezone.utc):
  ...
Netrc authentication

A Netrc file (e.g. ~/.netrc) does not override PyGithub authentication, anymore.
If you require authentication through Netrc, then this is a breaking change.
Use a github.Auth.Netrc instance to use Netrc credentials:

>>> auth = Auth.Netrc()
>>> g = Github(auth=auth)
>>> g.get_user().login
'login'
Repository.create_pull

Merged overloaded create_pull methods

def create_pull(self, issue, base, head)
def create_pull(self, title, body, base, head, maintainer_can_modify=NotSet, draft=False)

into

def create_pull(self, base, head, *, title=NotSet, body=NotSet, maintainer_can_modify=NotSet, draft=NotSet, issue=NotSet)

Please update your usage of Repository.create_pull accordingly.

New features

Improvements

Bug Fixes

  • Fix Branch.bypass_pull_request_allowances failing with "nil is not an object" (#​2535) (c5542a6)
  • Fix required_conversation_resolution assertion (#​2715) (54f2226)
  • Fix assertion creating pull request review comment (#​2641) (2fa568b)
  • Safely coerce responseHeaders to int (#​2697) (adbfce9)
  • Fix assertion for subject_type in creating pull request review comment (#​2642) (4933459)
  • Use timezone-aware reset datetime in GithubRetry.py (#​2610) (950a694)
  • Fix Branch.bypass_pull_request_allowances failing with "nil is not an object" (#​2535) (c5542a6)

Maintenance


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot requested a review from a team as a code owner September 29, 2023 18:40
@renovate renovate bot added the dependency Pull requests that update a dependency file label Sep 29, 2023
@renovate renovate bot force-pushed the renovate/pygithub-2.x branch 4 times, most recently from 205a613 to ceafbb9 Compare October 6, 2023 06:39
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate bot force-pushed the renovate/pygithub-2.x branch from ceafbb9 to d0f843c Compare October 9, 2023 03:57
simu added 2 commits October 9, 2023 10:10
The `create_pull()` method got changed to take the PR title and body as
keyword arguments.

This commit updates the dependency syncer implementation to use the new
method format and adjusts the expected POST body to match the PyGithub
v2 POST request contents.
PyGithub has deprecated passing the token directly as a positional
argument when initializing the client.

This commit updates all occurrences to use the new
`Github(auth=github.Auth.Token(...))` format.
Copy link
Member

@simu simu left a comment

Choose a reason for hiding this comment

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

I've verified that the updated version can create PRs with a manual run resulting in simu/component-tc1#26

@simu simu merged commit a94a4a7 into master Oct 9, 2023
@simu simu deleted the renovate/pygithub-2.x branch October 9, 2023 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant