Skip to content

Releases: PyGithub/PyGithub

v2.9.0

22 Mar 21:13
3a17ecf

Choose a tag to compare

Notable changes

Lazy PyGithub objects

The notion of lazy objects has been added to some PyGithub classes in version 2.6.0. This release now makes all CompletableGithubObjects optionally lazy (if useful). See #3403 for a complete list.

In lazy mode, getting a PyGithub object does not send a request to the GitHub API. Only accessing methods and properties sends the necessary requests to the GitHub API:

# Use lazy mode
g = Github(auth=auth, lazy=True)

# these method calls do not send requests to the GitHub API
user = g.get_user("PyGithub")    # get the user
repo = user.get_repo("PyGithub") # get the user's repo
pull = repo.get_pull(3403)       # get a known pull request
issue = pull.as_issue()          # turn the pull request into an issue

# these method and property calls send requests to Github API
issue.create_reaction("rocket")  # create a reaction
created = repo.created_at        # get property of lazy object repo

# once a lazy object has been fetched, all properties are available (no more requests)
licence = repo.license

All PyGithub classes that implement CompletableGithubObject support lazy mode (if useful). This is only useful for classes that have methods creating, changing, or getting objects.

By default, PyGithub objects are not lazy.

PyGithub objects with a paginated property

The GitHub API has the "feature" of paginated properties. Some objects returned by the API have a property that allows for pagination. Fetching subsequent pages of that property means fetching the entire object (with all other properties) and the specified page of the paginated property. Iterating over the paginated property means fetching all other properties multiple times. Fortunately, the allowed size of each page (per_page is usually 300, in contrast to the "usual" per_page maximum of 100).

Objects with paginated properties:

  • Commit.files
  • Comparison.commits
  • EnterpriseConsumedLicenses.users

This PR makes iterating those paginated properties use the configured per_page setting.

It further allows to specify an individual per_page when either retrieving such objects, or fetching paginated properties.

See Classes with paginated properties for details.

Drop Python 3.8 support due to End-of-Life

Python 3.8 reached its end-of-life September 6, 2024. Support has been removed with this release.

Deprecations

  • Method delete of Reaction is deprecated, use IssueComment.delete_reaction,
    PullRequestComment.delete_reaction, CommitComment.delete_reaction or Issue.delete_reaction instead.
  • Method Issue.assignee and parameter Issue.edit(assignee=…) are deprecated,
    use Issue.assignees and Issue.edit(assignees=…) instead.
  • Method Organization.edit_hook is deprecated, use Organization.get_hook(id).edit(…) instead.
    If you need to avoid Organization.get_hook(id) to fetch the Hook object from Github API,
    use a lazy Github instance:
Github(…, lazy=True).get_organization(…).get_hook(id).edit(…)
  • Methods Team.add_to_members and Team.remove_from_members are deprecated,
    use Team.add_membership or Team.remove_membership instead.

New Features

  • Consider per-page settings when iterating paginated properties by @EnricoMi in #3377
  • Add Secret Scanning Alerts and Improve Code Scan Alerts by @matt-davis27 in #3307

Improvements

Bug Fixes

  • Fix PaginatedList.totalCount returning 0 with GitHub deprecation notices by @odedperezcodes in #3382
  • Use default type if known type is not supported by @EnricoMi in #3365

Maintenance

New Contributors

Full Changelog: v2.8.0...v2.9.0

v2.8.1

02 Sep 17:41

Choose a tag to compare

What's Changed

Bug Fixes

  • Use default type if known type is not supported by @EnricoMi in #3365

Full Changelog: v2.8.0...v2.8.1

v2.8.0

02 Sep 09:23
18eeb26

Choose a tag to compare

What's Changed

New Features

Improvements

Bug Fixes

Maintenance

New Contributors

Full Changelog: v2.7.0...v2.8.0

v2.7.0

31 Jul 11:52
bccc5aa

Choose a tag to compare

What's Changed

Breaking Changes

  • Method Github.get_rate_limit() now returns RateLimitOverview rather than RateLimit (#3205).

Code like

gh.get_rate_limit().core.remaining

should be replaced with

gh.get_rate_limit().resources.core.remaining
  • Method GitTag.verification now returns GitCommitVerification rather than dict[str, Any] (#3226).

Code like

tag.verification["reason"]
tag.verification.get("reason")

should be replaced with

tag.verification.reason

New Features

Improvements

Bug Fixes

  • Fix broken pickle support for Auth classes by @EnricoMi in #3211
  • Remove schema from Deployment, remove message attribute by @EnricoMi in #3223
  • Fix incorrect deprecated import by @EnricoMi in #3225
  • Add CodeSecurityConfigRepository returned by get_repos_for_code_security_config by @EnricoMi in #3219
  • Fix Branch.get_required_status_checks return type by @EnricoMi in #3235
  • Adds multi_select and true_false options to CustomProperty.value_type by @gfog-floqast in #3173
  • Fix url encoding of strings with slashes in URLs by @OscarVanL in #3263
  • Fix side-effect when removing Authorization key from headers by @alecglen in #3313
  • Make TimingData.run_duration_ms optional by @LifeLex in #3268
  • Normalize App ID to String & Enhance JWT Issuer Verification by @x612skm in #3272

Dependencies

Maintenance

New Contributors

Full Changelog: v2.6.0...v2.7.0

v2.6.1

21 Feb 13:45
da30d6e

Choose a tag to compare

Bug Fixes

  • Fix broken pickle support for Auth classes by @EnricoMi in #3211
  • Remove schema from Deployment, remove message attribute by @EnricoMi in #3223
  • Fix incorrect deprecated import by @EnricoMi in #3225
  • Add CodeSecurityConfigRepository returned by get_repos_for_code_security_config by @EnricoMi in #3219
  • Make GitTag.verification return GitCommitVerification by @EnricoMi in #3226

Maintenance

  • Mention removal of AppAuth.private_key in changelog by @EnricoMi in #3212

Full Changelog: v2.6.0...v2.6.1

v2.6.0

15 Feb 17:36
e3e07d7

Choose a tag to compare

Breaking Changes

  • Rework Views and Clones by @EnricoMi in #3168:
    View and clones traffic information returned by Repository.get_views_traffic and Repository.get_clones_traffic
    now return proper PyGithub objects, instead of a dict, with all information that used to be provided by the dict:

Code like

repo.get_views_traffic().["views"].timestamp
repo.get_clones_traffic().["clones"].timestamp

should be replaced with

repo.get_views_traffic().views.timestamp
repo.get_clones_traffic().clones.timestamp
  • Fix typos by @kianmeng in #3086:
    Property OrganizationCustomProperty.respository_id renamed to OrganizationCustomProperty.repository_id.

New Features

Improvements

Bug Fixes

  • Patch httpretty socket for latest urllib3 release by @EnricoMi in #3102
  • Fix API break when contents not found by @skinitimski in #3181
  • Change start_side argument of PullRequest.create_review_comment from int to str by @ryanpeach in #3170
  • Create Review Request - transform string params to a list by @a-sido in #3099
  • Fix Repository.get_contents redirection by @EnricoMi in #3183

Others

Maintenance

Read more

v2.5.0

06 Nov 20:49
19ddb9f

Choose a tag to compare

Breaking Changes

  • Parameters of method github.Requester.Requester.graphql_named_mutation have been renamed:
    • Parameter variables renamed to mutation_input
    • Parameter output renamed to output_schema
    • Default value of parameter output has been removed

New features

Improvements

Bug Fixes

  • Fix requesting urls containing parameters with parameters dict @EnricoMi (#2929)
  • PullRequest.delete_branch: fix the remaining pull requests check @fetsko (#3063)

Maintenance

v2.4.0

26 Aug 06:48
8508735

Choose a tag to compare

New features

Improvements

Bug Fixes

Maintenance

v2.3.0

24 Mar 14:24
7266e81

Choose a tag to compare

New features

Improvements

  • Create release with optional name and message when generate_release_notes is true @heitorpolidoro (#2868)
  • Add missing attributes to WorkflowJob @xvega (#2921)
  • Add created and check_suite_id filter for Repository Workflow runs @treee111 (#2891)
  • Assert requester argument type in Auth @EnricoMi (#2912)

Bug Fixes

Maintenance

v2.2.0

30 Jan 07:54
7e7653f

Choose a tag to compare

Breaking Changes

The github.Comparison.Comparison instance returned by Repository.compare provides a commits property that used to return a list[github.Commit.Commit], which has now been changed to PaginatedList[github.Commit.Commit]. This breaks user code that assumes a list:

commits = repo.compare("v0.6", "v0.7").commits
no_of_commits = len(commits)  # will raise a TypeError

This will raise a TypeError: object of type 'PaginatedList' has no len(), as the returned PaginatedList
does not support the len() method. Use the totalCount property instead:

commits = repo.compare("v0.6", "v0.7").commits
no_of_commits = commits.totalCount

New features

  • Add support to call GraphQL API

Improvements

Bug Fixes

Maintenance

Full Changelog: v2.1.1...v2.2.0