Skip to content

chore(deps): update dependency pygithub to v2

Kubitus Bot requested to merge renovate/pygithub-2.x into main

This MR 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

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 MR becomes conflicted, or you tick the rebase/retry checkbox.

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


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

This MR has been generated by Renovate Bot.

Merge request reports