Releases: PyGithub/PyGithub
v2.6.1
Bug Fixes
- Fix broken pickle support for
Auth
classes by @EnricoMi in #3211 - Remove schema from
Deployment
, removemessage
attribute by @EnricoMi in #3223 - Fix incorrect deprecated import by @EnricoMi in #3225
- Add
CodeSecurityConfigRepository
returned byget_repos_for_code_security_config
by @EnricoMi in #3219 - Make
GitTag.verification
returnGitCommitVerification
by @EnricoMi in #3226
Maintenance
Full Changelog: v2.6.0...v2.6.1
v2.6.0
Breaking Changes
- Rework
Views
andClones
by @EnricoMi in #3168:
View and clones traffic information returned byRepository.get_views_traffic
andRepository.get_clones_traffic
now return proper PyGithub objects, instead of adict
, with all information that used to be provided by thedict
:
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:
PropertyOrganizationCustomProperty.respository_id
renamed toOrganizationCustomProperty.repository_id
.
New Features
- Add capability for global laziness by @EnricoMi in #2746
- Add Support for GitHub Copilot Seat Management in Organizations by @pashafateev in #3082
- Get branches where commit is head by @EnricoMi in #3083
- Support downloading a Release Asset by @neel-m in #3060
- Add
Repository.merge_upstream
method by @Felixoid in #3175 - Support updating pull request draft status by @didot in #3104
- Add transfer ownership method to Repository by @tanannie22 in #3091
- Add enable and disable a Workflow by @nickrmcclorey in #3088
- Add support for managing Code Security Configrations by @billnapier in #3095
- Allow for private_key / sign function in AppAuth by @EnricoMi in #3065
Improvements
- Update RateLimit object with all the new categories GitHub added. by @billnapier in #3096
- Add support for make-latest to create_git_release and create_git_tag_and_release by @SebastienSyd in #3067
- Add branch protection support for
required_status_checks.checks
object by @treee111 in #2884 - Use id and tree_id from simple-commit to populate GitCommit.sha and GitCommit.tree by @EnricoMi in #3167
- Use message of response in GithubException by @EnricoMi in #3185
- Sync Advisory classes with API spec by @EnricoMi in #3193
- Sync Branch class with API spec by @EnricoMi in #3109
- Sync BranchProtection class with API spec by @EnricoMi in #3110
- Sync CheckRunAnnotation class with API spec by @EnricoMi in #3112
- Sync CheckRun class with API spec by @EnricoMi in #3111
- Sync CheckSuite class with API spec by @EnricoMi in #3113
- Sync Commit class with API spec by @EnricoMi in #3116
- Sync CommitComment class with API spec by @EnricoMi in #3117
- Sync CommitStatus class with API spec by @EnricoMi in #3118
- Sync ContentFile class with API spec by @EnricoMi in #3119
- Sync DependabotAlert class with API spec by @EnricoMi in #3120
- Sync Deployment class with API spec by @EnricoMi in #3121
- Sync DeploymentStatus class with API spec by @EnricoMi in #3122
- Sync Gist class with API spec by @EnricoMi in #3123
- Sync GistComment class with API spec by @EnricoMi in #3124
- Sync GitBlob class with API spec by @EnricoMi in #3125
- Sync GitCommit class with API spec by @EnricoMi in #3126
- Sync GithubApp class with API spec by @EnricoMi in #3127
- Sync GitRef class with API spec by @EnricoMi in #3128
- Sync GitReleaseAsset class with API spec by @EnricoMi in #3130
- Sync GitRelease class with API spec by @EnricoMi in #3129
- Sync GitTag class with API spec by @EnricoMi in #3131
- Sync GitTree class with API spec by @EnricoMi in #3132
- Sync Hook class with API spec by @EnricoMi in #3133
- Sync HookDelivery class with API spec by @EnricoMi in #3134
- Sync InstallationAuthorization class with API spec by @EnricoMi in #3136
- Sync Installation class with API spec by @EnricoMi in #3135
- Sync Invitation class with API spec by @EnricoMi in #3139
- Sync Issue class with API spec by @EnricoMi in #3140
- Sync IssueComment class with API spec by @EnricoMi in #3141
- Sync IssueEvent class with API spec by @EnricoMi in #3142
- Sync IssuePullRequest class with API spec by @EnricoMi in #3143
- Sync Label class with API spec by @EnricoMi in #3144
- Sync License class with API spec by @EnricoMi in #3145
- Sync Membership class with API spec by @EnricoMi in #3146
- Sync Migration class with API spec by @EnricoMi in #3147
- Sync Milestone class with API spec by @EnricoMi in #3148
- Sync NamedUser class with API spec by @EnricoMi in #3149
- Sync Organization class with API spec by @EnricoMi in #3150
- Sync OrganizationCustomProperty class with API spec by @EnricoMi in #3151
- Sync Project class with API spec by @EnricoMi in #3194
- Sync PublicKey class with API spec by @EnricoMi in #3152
- Sync PullRequest class with API spec by @EnricoMi in #3153
- Sync PullRequestComment class with API spec by @EnricoMi in #3154
- Sync RateLimit class with API spec by @EnricoMi in #3155
- Sync Repository class with API spec by @EnricoMi in #3156
- Sync RepositoryKey class with API spec by @EnricoMi in #3157
- Sync SecurityAndAnalysis class with API spec by @EnricoMi in #3158
- Sync SelfHostedActionsRunner class with API spec by @EnricoMi in #3159
- Sync SourceImport class with API spec by @EnricoMi in #3160
- Sync Tag class with API spec by @EnricoMi in #3161
- Sync Team class with API spec by @EnricoMi in #3162
- Sync Topic class with API spec by @EnricoMi in #3163
- Sync UserKey class with API spec by @EnricoMi in #3164
- Sync Workflow class with API spec by @EnricoMi in #3165
- Sync WorkflowRun class with API spec by @EnricoMi in #3166
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 ofPullRequest.create_review_comment
fromint
tostr
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
- Make
conclusion
nullable inWorkflowJob.py
by @Apakottur in #3171 - Rename
Github.get_organization
argumentlogin
toorg
by @blyedev in #3187 - Make
NotSet
anAttribute[Any]
by @EnricoMi in #3057
Maintenance
- Sort attributes and properties in GitHub classes by @EnricoMi in #3105
- Preparations for maintaining Github classes by code by @EnricoMi in #3106
- Annotate Github classes with API schemas by @EnricoMi in #3107
- Make Pickle test use recorded data by @EnricoMi in #3137
- Add tests for file and stream downloads by @EnricoMi in #3182
- Use
responses
instead ofhttpretty
in tests by @majamassarini in https://gith...
v2.5.0
Breaking Changes
- Parameters of method
github.Requester.Requester.graphql_named_mutation
have been renamed:- Parameter
variables
renamed tomutation_input
- Parameter
output
renamed tooutput_schema
- Default value of parameter
output
has been removed
- Parameter
New features
- Rework GraphQL mutations @EnricoMi (#3046)
- Make pagination work with GraphQL response data @EnricoMi (#3047)
- Add
RepositoryDiscussion
powered by GraphQL API @EnricoMi (#3048) - Add
Repository.get_discussion()
to get a single Discussion @tiangolo (#3072)
Improvements
- Adds List organization memberships for the authenticated user @eduramirezh (#3040)
- Add
actor
property to WorkflowRun @gbhand (#2764) - Make requester a public attribute @minrk (#3056)
Bug Fixes
- Fix requesting urls containing parameters with parameters dict @EnricoMi (#2929)
- PullRequest.delete_branch: fix the remaining pull requests check @fetsko (#3063)
Maintenance
- Remove stale bot @EnricoMi (510c140)
- Upgrade Github actions @EnricoMi (#3075)
- Add top issues dashboard action @EnricoMi (#3049)
- Make tests pass some more years @bmwiedemann (#3045)
- Run top issues workflow only in PyGithub repo @EnricoMi (0d395d4)
- Replace pre-commit action in order to pin pre-commit @minrk (#3059)
v2.4.0
New features
Improvements
- Add
has_discussions
toAuthenticatedUser
andRepository
classes @cwlls (#3020) - Update more
SecurityAndAnalysis
attributes @squatched (#3025) - Implement support for re-running only failed workflow jobs. @chrisgavin (#2983)
- Add possibility to mark a thread/notification as done @m42e (#2985)
- Add "pull_request_review_id" to PullRequestComment object @stroebs (#3000)
- Add minimize and unminimize functions for IssueComment class @arash77 (#3005)
- Support Organization/Repository custom properties @jackylamhk (#2968)
- Add
dict
type toadd_attribute
script @jackylamhk (#2977) - Allow for deleting and restoring branch associated with PR @austinsasko (#1784)
- Add "archived_at" to Organization object. @billnapier (#2974)
- Adds Security & Analysis To Repository @squatched (#2960)
- Add added_by and last_used attributes to RepositoryKey @ramiro (#2952)
- Add
make_latest
toGitRelease.update_release
@treee111 (#2888) - Make Commit.files return PaginatedList @iarspider (#2939)
Bug Fixes
Maintenance
v2.3.0
New features
- Support oauth for enterprise @EnricoMi (#2780)
- Support creation of Dependabot Organization and Repository Secrets @thomascrowley (#2874)
Improvements
- Create release with optional
name
andmessage
whengenerate_release_notes
is true @heitorpolidoro (#2868) - Add missing attributes to
WorkflowJob
@xvega (#2921) - Add
created
andcheck_suite_id
filter for Repository Workflow runs @treee111 (#2891) - Assert requester argument type in Auth @EnricoMi (#2912)
Bug Fixes
- Revert having allowed values for
add_to_collaborators
@jodelasur (#2905)
Maintenance
- Fix imports in authentication docs @wurstbrot (#2923)
- CI: add docformatter to precommit @Borda (#2614)
- Add
.swp
fils to.gitignore
@boomanaiden154 (#2903) - Fix instructions building docs in
CONTRIBUTING.md
@wakamex (#2900) - Explicitly name the modules built in
pyproject.toml
@treee111 (#2894)
v2.2.0
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
- Add parent_team_id, maintainers and notification_setting for creating and updating teams. by @Cheshirez in #2863
- Add support for issue reactions summary by @smuzaffar in #2866
- Support for DependabotAlert APIs by @coopernetes in #2879
- Derive GraphQL URL from base_url by @EnricoMi in #2880
- Make
Repository.compare().commits
return paginated list by @EnricoMi in #2882 - Add missing branch protection fields by @treee111 in #2873
- Add
include_all_branches
tocreate_repo_from_template
ofAuthenticatedUser
andOrganization
by @janssonoskar in #2871 - Add and update organisation dependabot secrets by @mohy01 in #2316
- Add missing params to
Organization.create_repo
by @tekumara in #2700 - Update allowed values for
Repository
collaborator permissions by @flying-sheep in #1996 - Support editing PullRequestReview by @ColasGael in #2851
- Update attributes after calling
PullRequestReview.dismiss
by @ColasGael in #2854 - Add
request_cve
onRepositoryAdvisories
by @JLLeitschuh in #2855 - Filter collaborators of a repository by permissions by @notmicaelfilipe in #2792
- Set pull request to auto merge via GraphQL API by @heitorpolidoro in #2816
- Support Environment Variables and Secrets by @AndrewJDawes in #2848
- Update workflow.get_runs & pullrequest.add_to_assignees function signature by @sd-kialo in #2799
- Add
GithubObject.last_modified_datetime
to havelast_modified
as adatetime
by @chouetz in #2772 - Add support for global advisories and unify some shared logic with repository advisories by @crimsonknave in #2702
- Add
internal
as valid Repository visibility value by @AndrewJDawes in #2806 - Add support for issue comments reactions summary by @smuzaffar in #2813
Bug Fixes
- Add a bunch of missing urllib.parse.quote calls by @ExplodingCabbage in #1976
- Fix Variable and Secret url bugs by @AndrewJDawes in #2835
Maintenance
- Update the class name for NetrcAuth in the examples by @vinnybod in #2860
- Move build to PEP517 by @trim21 in #2800
- Use new type assert functions in
Repository
by @trim21 in #2798 - PyTest: Move config to pyproject.toml by @Borda in #2859
- codespell: ignore-words-list by @Borda in #2858
- Improve fix-headers.py script by @EnricoMi in #2728
- Remove dependency on python-dateutil by @lazka in #2804
- CI: update precommit & apply by @Borda in #2600
- Docs: Fix parameter order according to Version 2.1.0 by @nad182 in #2786
- Add missing GitHub classes to docs by @EnricoMi in #2783
- CI: Fix mypy error by ignoring override by @EnricoMi in #2779
Full Changelog: v2.1.1...v2.2.0
v2.1.1
v2.1.0.post0
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.NetrcAuth
instance to use Netrc credentials:
>>> auth = Auth.NetrcAuth()
>>> 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
- Throttle requests to mitigate RateLimitExceededExceptions (#2145) (9915580)
- Retry retryable 403 (rate limit) (#2387) (0bb72ca)
- Close connections after use (#2724) (73236e2)
Improvements
- Make datetime objects timezone-aware (#2565) (0177f7c)
- Make
Branch.edit_*
functions return objects (#2748) (8dee53a) - Add
license
attribute toRepository
(#2721) (26d353e) - Add missing attributes to
Repository
(#2742) (65cfeb1) - Add
is_alphanumeric
attribute toAutolink
andRepository.create_autolink
(#2630) (b6a28a2) - Suppress
requests
fallback to netrc, providegithub.Auth.Netrc
(#2739) (ac36f6a) - Pass Requester arguments to
AppInstallationAuth.__integration
(#2695) (8bf542a) - Adding feature for enterprise consumed license (#2626) (a7bfdf2)
- Search Workflows by Name (#2711) (eadc241)
- Add
Secret
andVariable
classes (#2623) (bcca758) - Add Autolink API link (#2632) (aedfa0b)
- Add
required_linear_history
attribute toBranchProtection
(#2643) (7a80fad) - Add retry issue to
GithubException
, don't log it (#2611) (de80ff4) - Add
message
property toGithubException
(#2591) (f087cad) - Add support for repo and org level actions variables (#2580) (91b3f40)
- Add missing arguments to
Workflow.get_runs()
(#2346) (766df99) - Add
github.Rate.used
field (#2531) (c4c2e52)
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
toint
(#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
- Epic mass-merge
.pyi
type stubs back to.py
sources (#2636) - Move to main default branch (#2566) (e66c163)
- Force Unix EOL (#2573) (094538e)
- Close replay test data file silently when test is failing already (#2747) (6d871d5)
- CI: Make CI support merge queue (#2644) (a91debf)
- CI: Run CI on release branches (#2708) (9a88b6b)
- CI: remove conflict label workflow (#2669) (95d8b83)
- Fix pip install command in README.md (#2731) (2cc1ba2)
- Update
add_attribute.py
to latest conding style (#2631) (e735972) - CI: Improve ruff DX (#2667) (48d2009)
- CI: Increase wait and retries of labels action (#2670) (ff0f31c)
- Replace
flake8
withruff
(#2617) (42c3b47) - CI: update labels action name and version (#2654) (c5c83eb)
- CI: label PRs that have conflicts (#2622) (1d637e4)
- Unify requirements files location & source in setup.py (#2598) (2edc0f8)
- Enable mypy
disallow_untyped_defs
(#2609) (294c0cc) - Enable mypy
check_untyped_defs
(#2607) (8816889) - Set line length to 120 characters (#2599) (13e178a)
- CI: Build and check package before release (#2593) (3c880e7)
- Use
typing_extensions
forTypedDict
(#2592) (5fcb0c7) - CI: Update action actions/setup-python (#2382) (2e5cd31)
- Add more methods and attributes to Repository.pyi (#2581) (72840de)
- CI: Make pytest color logs (#2597) (7324110)
- precommit: move
flake8
as last (#2595) (11bb6bd) - Test on Windows and macOS, don't fail fast (#2590) (5c60089)
- Remove symlinks from test data (#2588) (8d3b905)