- When you download a release asset, instead of returning
TrueorFalse, it will return the name of the file in which it saved the asset. - The
downloadmethod ongithub3.pulls.PullFileinstances has been removed. - The
contentsmethod ongithub3.pulls.PullFileinstances now return instances ofgithub3.repos.contents.Contents. - Replace
Repository#comments_on_commitwithRepoCommit#comments.
- You can now download a file in a pull request to a file on disk.
- You can retrieve the contents of the file in a pull request as bytes.
- Add
idattribute togithub3.repos.milestone.Milestone. - Add support for sort, direction, and since parameters to the
commentsmethod ongithub3.issues.Issue. - Add branch argument to update and delete methods on
github3.repos.contents.Contents. - Add
permissionsattribute togithub3.repos.repo.Repositoryobject to retrieve the permissions for a specific repository. - Allow a deployment to be retrieved by its id.
- Add the
deletemethod to thegithub3.repos.release.Assetclass.
- Pull request files can now be downloaded even when the repository is private.
- Fix exception when merging a pull request with an empty commit message.
- Add missing Issue events.
- Coerce review comment positions to integers.
1.0.0 is a huge release. It includes a great deal of changes to github3.py.
It is suggested you read the following release notes very carefully.
Organization#add_memberhas been changed. The second parameter has been changed toteam_idand now expects an integer.Organization#add_repositoryhas been changed. The second parameter has been changed toteam_idand now expects an integer.- All methods and functions starting with
iter_have been renamed.
| Old name | New name |
|---|---|
github3.iter_all_repos |
github3.all_repositories |
github3.iter_all_users |
github3.all_users |
github3.iter_events |
github3.all_events |
github3.iter_followers |
github3.followers_of |
github3.iter_following |
github3.followed_by |
github3.iter_repo_issues |
github3.issues_on |
github3.iter_orgs |
github3.organizations_with |
github3.iter_user_repos |
github3.repositories_by |
github3.iter_starred |
github3.starred_by |
github3.iter_subscriptions |
github3.subscriptions_for |
Deployment#iter_statuses |
Deployment#statuses |
Gist#iter_comments |
Gist#comments |
Gist#iter_commits |
Gist#commits |
Gist#iter_files |
Gist#files |
Gist#iter_forks |
Gist#forks |
GitHub#iter_all_repos |
GitHub#all_repositories |
GitHub#iter_all_users |
GitHub#all_users |
GitHub#iter_authorizations |
GitHub#authorizations |
GitHub#iter_emails |
GitHub#emails |
GitHub#iter_events |
GitHub#events |
GitHub#iter_followers |
GitHub#{followers,followers_of} |
GitHub#iter_following |
GitHub#{following,followed_by} |
GitHub#iter_gists |
GitHub#{gists,gists_by,public_gists} |
GitHub#iter_notifications |
GitHub#notifications |
GitHub#iter_org_issues |
GitHub#organization_issues |
GitHub#iter_issues |
GitHub#issues |
GitHub#iter_user_issues |
GitHub#user_issues |
GitHub#iter_repo_issues |
GitHub#issues_on |
GitHub#iter_keys |
GitHub#keys |
GitHub#iter_orgs |
GitHub#{organizations,organizations_with} |
GitHub#iter_repos |
GitHub#reposistories |
GitHub#iter_user_repos |
GitHub#repositories_by |
GitHub#iter_user_teams |
GitHub#user_teams |
Issue#iter_comments |
Issue#comments |
Issue#iter_events |
Issue#events |
Issue#iter_labels |
Issue#labels |
Milestone#iter_labels |
Milestone#labels |
Organization#iter_members |
Organization#members |
Organization#iter_public_members |
Organization#public_members |
Organization#iter_repos |
Organization#repositories |
Organization#iter_teams |
Organization#teams |
PullRequest#iter_comments |
PullRequest#review_comments |
PullRequest#iter_commits |
PullRequest#commits |
PullRequest#iter_files |
PullRequest#files |
PullRequest#iter_issue_comments |
PullRequest#issue_comments |
Team#iter_members |
Team#members |
Team#iter_repos |
Team#repositories |
Repository#iter_assignees |
Repository#assignees |
Repository#iter_branches |
Repository#branches |
Repository#iter_code_frequency |
Repository#code_frequency |
Repository#iter_collaborators |
Repository#collaborators |
Repository#iter_comments |
Repository#comments |
Repository#iter_comments_on_commit |
RepoCommit#comments |
Repository#iter_commit_activity |
Repository#commit_activity |
Repository#iter_commits |
Repository#commits |
Repository#iter_contributor_statistics |
Repository#contributor_statistics |
Repository#iter_contributors |
Repository#contributors |
Repository#iter_forks |
Repository#forks |
Repository#iter_hooks |
Repository#hooks |
Repository#iter_issues |
Repository#issues |
Repository#iter_issue_events |
Repository#issue_events |
Repository#iter_keys |
Repository#keys |
Repository#iter_labels |
Repository#labels |
Repository#iter_languages |
Repository#languages |
Repository#iter_milestones |
Repository#milestones |
Repository#iter_network_events |
Repository#network_events |
Repository#iter_notifications |
Repository#notifications |
Repository#iter_pages_builds |
Repository#pages_builds |
Repository#iter_pulls |
Repository#pull_requests |
Repository#iter_refs |
Repository#refs |
Repository#iter_releases |
Repository#releases |
Repository#iter_stargazers |
Repository#stargazers |
Repository#iter_subscribers |
Repository#subscribers |
Repository#iter_statuses |
Repository#statuses |
Repository#iter_tags |
Repository#tags |
Repository#iter_teams |
Repository#teams |
Repository#iter_teams |
Repository#teams |
User#iter_events |
User#events |
User#iter_followers |
User#followers |
User#iter_following |
User#following |
User#iter_keys |
User#keys |
User#iter_org_events |
User#organization_events |
User#iter_received_events |
User#received_events |
User#iter_orgs |
User#organizations |
User#iter_starred |
User#starred_repositories |
User#iter_subscriptions |
User#subscriptions |
github3.loginhas been simplified and split into two functions:github3.loginserves the majority use case and only provides an authenticatedGitHubobject.github3.enterprise_loginallows GitHub Enterprise users to log into their service.
GitHub#iter_followerswas split into two functions:GitHub#followers_ofwhich iterates over all of the followers of a user whose username you provideGitHub#followerswhich iterates over all of the followers of the authenticated user
GitHub#iter_followingwas split into two functions:GitHub#followed_bywhich iterates over all of the users followed by the username you provideGitHub#followingwhich iterates over all of the users followed by the authenticated user
GitHub#iter_gistswas split into three functions:GitHub#public_gistswhich iterates over all of the public gists on GitHubGitHub#gists_forwhich iterates over all the public gists of a specific userGitHub#gistswhich iterates over the authenticated users gists
GitHub#iter_orgswas split into two functions:GitHub#organizationswhich iterates over the authenticated user's organization membershipsGitHub#organizations_withwhich iterates over the given user's organization memberships
GitHub#iter_subscriptionswas split into two functions:GitHub#subscriptions_forwhich iterates over an arbitrary user's subscriptionsGitHub#subscriptionswhich iterates over the authenticated user's subscriptions
GitHub#iter_starredwas split into two functions:GitHub#starred_bywhich iterates over an arbitrary user's starsGitHub#starredwhich iterates over the authenticated user's stars
GitHub#userwas split into two functions:GitHub#userwhich retrieves an arbitrary user's informationGitHub#mewhich retrieves the authenticated user's information
GitHub#update_userhas been renamed toGitHub#update_meand only uses 1 API call now. It was renamed to reflect the addition ofGitHub#me.- The legacy watching API has been removed:
GitHub#subscribeGitHub#unsubscribeGitHub#is_subscribed
GitHub#create_repowas renamed toGitHub#create_repositoryGitHub#delete_keywas removed. To delete a key retrieve it withGitHub#keyand then callKey#delete.Repository#set_subscriptionwas split into two simpler functionsRepository#subscribesubscribes the authenticated user to the repository's notificationsRepository#ignoreignores notifications from the repository for the authenticated user
Repository#contentswas split into two simpler functionsRepository#file_contentsreturns the contents of a file objectRepository#directory_contentsreturns the contents of files in a directory.
Organization#add_repoandTeam#add_repohave been renamed toOrganization#add_repositoryandTeam#add_repositoryrespectively.Organization#create_repohas been renamed toOrganization#create_repository. It no longer acceptshas_downloads. It now acceptslicense_template.Organization#remove_repohas been renamed toOrganization#remove_repository. It now acceptsteam_idinstead ofteam.github3.ratelimit_remainingwas removedGitHubinstances can no longer be used as context managers- The pull request API has changed.
- The
linksattribute now contains the raw_linksattribute from the API. - The
merge_commit_shaattribute has been removed since it was deprecated in the GitHub API. - To present a more consistent universal API, certain attributes have been renamed.
- The
| Old name | New attribute name |
|---|---|
PullFile.additions |
additions_count |
PullFile.deletions |
deletions_count |
PullFile.changes |
changes_count |
PullRequest.additions |
additions_count |
PullRequest.comments |
comments_count |
PullRequest.commits |
commits_count |
PullRequest.deletions |
deletions_count |
PullRequest.review_comments |
review_comments_count |
The Gist API has changed.
- The
forksandfilesattributes that used to keep count of the number offorksandfileshave been removed. - The
commentsattribute which provided the number of comments on a gist, has been renamed tocomments_count. - The
is_publicmethod has been removed since it just returned theGist.publicattribute.
- The
Most instances of
loginas a parameter have been changed tousernamefor clarity and consistency. This affects the following methods:github3.authorizegithub3.repositories_bygithub3.userGitHubGitHub#authorizeGitHub#followGitHub#is_followingGitHub#is_starredGitHub#issueGitHub#followers_ofGitHub#followed_byGitHub#gists_byGitHub#issues_onGitHub#organizations_withGitHub#starred_byGitHub#subscriptions_forGitHub#userGitHubEnterpriseIssue#assignOrganization#add_memberOrganization#is_memberOrganization#is_public_memberOrganization#remove_memberRepository#add_collaboratorRepository#is_assigneeRepository#is_collaboratorRepository#remove_collaboratorTeam#add_memberTeam#is_memberUser#is_assignee_onUser#is_following
Repository.stargazersis nowRepository.stargazers_count(conforming with the attribute name returned by the API).The
IssueAPI has changed in order to provide a more consistent attribute API.Issue.commentsis nowIssue.comments_countand returns the number of comments on an issue.The
Issue.labelsattribute has also been renamed. It is now available fromIssue.original_labels. This will provide the user with the list ofLabelobjects that was returned by the API. To retrieve an updated list of labels, the user can now useIssue#labels, e.g.i = github3.issue('sigmavirus24', 'github3.py', 30) labels = list(i.labels())The
OrganizationandUserAPIs have changed to become more consistent with the rest of the library and GitHub API. The following attribute names have been changed
| Old name | New attribute name |
|---|---|
Organization.followers |
followers_count |
Organization.following |
following_count |
Organization.public_repos |
public_repos_count |
User.followers |
followers_count |
User.following |
following_count |
User.public_repos |
public_repos_count |
- The
Release.assetsattribute has been renamed toRelease.original_assets. To retrieve up-to-date assets, use theRelease#assetsmethod. - The
AuthorizationAPI has changed. Theupdatemethod has been split into three methods:add_scopes,remove_scopes,replace_scopes. This highlights the fact thatAuthorization#updateused to require more than one request. Event#is_publichas been removed. Simply check the event'spublicattribute instead.Repository#delete_fileandRepository#update_filehave been removed. Simply delete or update a file using the Contents API.Content#deletenow returns a dictionary that matches the JSON returned by the API. It contains the Contents and the Commit associated with the deletion.Content#updatenow returns a dictionary that matches the JSON returned by the API. It contains the Contents and the Commit associated with the deletion.Issue.pull_requesthas been renamed toIssue.pull_request_urls
Most objects now have a
sessionattribute. This is a subclass of aSessionobject fromrequests. This can now be used in conjunction with a third-party caching mechanism. The suggested caching library iscachecontrol.All object's
urlattribute are now available.You can now retrieve a repository by its id with
GitHub#repository_with_id.You can call the
pull_requestmethod on anIssuenow to retrieve the associated pull request:import github3 i = github3.issue('sigmavirus24', 'github3.py', 301) pr = i.pull_request()