Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7e6333d
Fix CI (#2330)
sfdye Oct 13, 2022
b50283a
Create repo from template (#2090)
simkimsia Oct 13, 2022
c677ced
Publish version 1.56
sfdye Oct 13, 2022
7d3c3f0
Relax stale to 180 days (#2331)
sfdye Oct 13, 2022
1e2f10d
Add support for Python 3.11, drop EOL 3.6 (#2332)
hugovk Oct 25, 2022
17b44d8
Fix typo in blame ignore revs (#2342)
sfdye Oct 25, 2022
437ff84
Add class Artifact (#2313) (#2319)
lexa Oct 25, 2022
a71cd37
Require pyjwt>=2.4.0 to avoid CVE-2022-29217 (#2333)
hugovk Oct 25, 2022
db9337a
Fix/types for repo topic team (#2341)
snim2 Oct 25, 2022
784a3ef
Add retry and pool_size to typing (#2151)
EnricoMi Oct 25, 2022
0fadd6b
Add support for repository autolink references (#2016)
theCapypara Oct 29, 2022
3a6235b
[WorkflowRun] - Add missing attributes (`run_started_at` & `run_attem…
goliaro Oct 29, 2022
6725ece
Speed up get requested reviewers and teams for pr (#2349)
tisonkun Nov 4, 2022
948edc5
Publish version 1.57
sfdye Nov 5, 2022
7902351
Add code scanning alerts (#2227)
eric-nieuwland Nov 9, 2022
6c53e54
feat: add allow_forking to Repository (#2380)
IbrahimAH Dec 15, 2022
7cf3dfc
Continue the PR #1899 (#2386)
Felixoid Jan 30, 2023
5e27c10
Support full GitHub app authentication (#1986)
dblanchette Feb 6, 2023
c7e3ae9
Add unarchiving support (#2391)
Tsuesun Feb 13, 2023
b7daaf1
Add release drafter and pubilsh on tag creation (#2428)
sfdye Feb 19, 2023
5d1d161
Bump version to 1.58.0
sfdye Feb 19, 2023
3ea91a3
Use use_scm_version to get current version from git tag (#2429)
sfdye Feb 19, 2023
1640767
Fix sphinx package name
sfdye Feb 19, 2023
6540b76
Fix package name again
sfdye Feb 19, 2023
9c96faa
Add current dir sys.path as well
sfdye Feb 19, 2023
def5223
RTD: install current project
sfdye Feb 20, 2023
bdceae2
pass requester base URL to integration (#2420)
bluek1te Feb 16, 2023
5033f5f
Merge pull request #2425 from bluek1te/master
EnricoMi Feb 23, 2023
e414c32
Move CI to Python 3.11 release and 3.12 dev (#2434)
EnricoMi Feb 23, 2023
45f3d72
Remove RLock from Requester (#2446)
EnricoMi Mar 14, 2023
554b2b2
Add crypto extras to pyjwt, which pulls in cryptogaphy package (#2443)
EnricoMi Mar 14, 2023
822fc05
Add expiration argument back to GithubIntegration.create_jwt (#2439)
EnricoMi Mar 17, 2023
b2840b9
fix(types): :label: align stubs for push restriction changes with imp…
lbillinghamwrk Mar 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@

# Add pyupgrade to pre-commit
e113e37de1ec687c68337d777f3629251b35ab28

# Run pre-commit autoupdate and run all hooks
4c24c73d34b54a061b0c800eeea64dc64c230a63
45 changes: 45 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: 'Features'
labels:
- 'feature'
- 'enhancement'
- title: 'Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: 'Maintenance'
label: 'chore'
autolabeler:
- label: 'chore'
files:
- '*.md'
branch:
- '/docs{0,1}\/.+/'
- label: 'bug'
branch:
- '/fix\/.+/'
title:
- '/fix/i'
- label: 'enhancement'
branch:
- '/feature\/.+/'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: minor
template: |
## Changes

$CHANGES
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
daysUntilStale: 180

# Number of days of inactivity before a stale Issue or Pull Request is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: test (Python ${{ matrix.python-version }})
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -24,4 +24,12 @@ jobs:
run: tox
- name: Upload coverage to Codecov
uses: codecov/[email protected]
draft:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

7 changes: 4 additions & 3 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Publish to PyPI
on:
release:
types: [created]
push:
tags:
- "*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
/doc/doctrees/
.vscode*
.venv
venv
.tox/
.mypy_cache/
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.4
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
rev: v5.10.1
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/codespell-project/codespell
rev: v1.16.0
rev: v2.2.1
hooks:
- id: codespell
exclude: tests/
args:
- --ignore-words-list="bloaded,nto,pullrequest,pullrequests,thi,tim,wan,Wan,chang,Chang"
- --quiet-level=2
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.4
rev: v3.1.0
hooks:
- id: pyupgrade
args:
- --py36-plus
- --py37-plus
2 changes: 2 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ sphinx:
python:
version: 3.8
install:
- method: pip
path: .
- requirements: requirements.txt
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ You may also want to investigate `tox` to run tests:

```
pip install tox
tox -epy36
tox -epy310
```

## Build documentation locally
Expand Down
58 changes: 58 additions & 0 deletions doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,64 @@ Change log
Stable versions
~~~~~~~~~~~~~~~

Version 1.58.0 (February 19, 2023)
-----------------------------------

**Bug Fixes & Improvements**

- Add unarchiving support @Tsuesun (#2391)
- Support full GitHub app authentication @dblanchette (#1986)
- Continue the PR #1899 @Felixoid (#2386)
- feat: add allow\_forking to Repository @IbrahimAH (#2380)
- Add code scanning alerts @eric-nieuwland (#2227)

Version 1.57 (November 05, 2022)
-----------------------------------

**Breaking Changes**

* Add support for Python 3.11, drop support for Python 3.6 (#2332) (1e2f10dc)

**Bug Fixes & Improvements**

* Speed up get requested reviewers and teams for pr (#2349) (6725eceb)
* [WorkflowRun] - Add missing attributes (`run_started_at` & `run_attempt`), remove deprecated `unicode` type (#2273) (3a6235b5)
* Add support for repository autolink references (#2016) (0fadd6be)
* Add retry and pool_size to typing (#2151) (784a3efd)
* Fix/types for repo topic team (#2341) (db9337a4)
* Add class Artifact (#2313) (#2319) (437ff845)

Version 1.56 (October 13, 2022)
-----------------------------------

**Important**

This is the last release that will support Python 3.6.

**Bug Fixes & Improvements**

* Create repo from template (#2090) (b50283a7)
* Improve signature of Repository.create_repo (#2118) (001970d4)
* Add support for 'visibility' attribute preview for Repositories (#1872) (8d1397af)
* Add Repository.rename_branch method (#2089) (6452ddfe)
* Add function to delete pending reviews on a pull request (#1897) (c8a945bb)
* Cover all code paths in search_commits (#2087) (f1faf941)
* Correctly deal when PaginatedList's data is a dict (#2084) (93b92cd2)
* Add two_factor_authentication in AuthenticatedUser. (#1972) (4f00cbf2)
* Add ProjectCard.edit() to the type stub (#2080) (d417e4c4)
* Add method to delete Workflow runs (#2078) (b1c8eec5)
* Implement organization.cancel_invitation() (#2072) (53fb4988)
* Feat: Add `html_url` property in Team Class. (#1983) (6570892a)
* Add support for Python 3.10 (#2073) (aa694f8e)
* Add github actions secrets to org (#2006) (bc5e5950)
* Correct replay for Organization.create_project() test (#2075) (fcc12368)
* Fix install command example (#2043) (99e00a28)
* Fix: #1671 Convert Python Bool to API Parameter for Authenticated User Notifications (#2001) (1da600a3)
* Do not transform requestHeaders when logging (#1965) (1265747e)
* Add type to OrderedDict (#1954) (ed7d0fe9)
* Add Commit.get_pulls() to pyi (#1958) (b4664705)
* Adding headers in GithubException is a breaking change (#1931) (d1644e33)

Version 1.55 (April 26, 2021)
-----------------------------------
**Breaking Changes**
Expand Down
4 changes: 3 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(".."))
from setup import version as setupVersion # noqa: E402, isort:skip
from importlib.metadata import version # noqa: E402, isort:skip

setupVersion = version("pygithub")

# -- General configuration -----------------------------------------------------

Expand Down
25 changes: 25 additions & 0 deletions doc/examples/Repository.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ Get list of open issues
Issue(title="Is suspended_users for github enterprise implemented in NamedUser?", number=900)
Issue(title="Adding migration api wrapper", number=899)

Get list of code scanning alerts
--------------------------------

.. code-block:: python

>>> repo = g.get_repo("PyGithub/PyGithub")
>>> codescan_alerts = repo.get_codescan_alerts()
>>> for alert in codescan_alerts:
... print(alert.number, alert.created_at, alert.dismissed_at)
... print(" ", alert.tool.name, alert.tool.version, alert.tool.guid)
... print(" ", alert.rule.name alert.rule.security_severity_level alert.rule.severity)
... print(" ", alert.rule.description)
... print(" ", alert.most_recent_instance.ref, alert.most_recent_instance.state)
... print(" ", alert.most_recent_instance.location)
... print(" ", alert.most_recent_instance.message['text'])
...
3 1984-02-29 12:34:56 None
CodeQL 2.6.1 None
py/weak-sensitive-data-hashing high warning
Use of a broken or weak cryptographic hashing algorithm on sensitive data
refs/heads/master | open
src/secrets/rats.py @ l42:c13-l42:c69
Sensitive data (password) is used in a hashing algorithm (SHA1) that is insecure⤶
for password hashing, since it is not a computationally expensive hash function.

Get all the labels of the repository
------------------------------------

Expand Down
3 changes: 0 additions & 3 deletions doc/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ This package is in the `Python Package Index
be enough. You can also clone it on `Github
<http://github.com/PyGithub/PyGithub>`__.

If you wish to use GitHub Integrations, you'll want to be sure to install the
'integrations' option: ``pip install PyGithub[integrations]``

Licensing
---------

Expand Down
2 changes: 1 addition & 1 deletion github/AccessToken.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AccessToken(github.GithubObject.NonCompletableGithubObject):
def __repr__(self):
return self.get__repr__(
{
"token": "{}...".format(self.token[:5]),
"token": f"{self.token[:5]}...",
"scope": self.scope,
"type": self.type,
}
Expand Down
41 changes: 41 additions & 0 deletions github/AppAuthentication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
############################ Copyrights and license ############################
# #
# Copyright 2023 Denis Blanchette <[email protected]> #
# #
# This file is part of PyGithub. #
# http://pygithub.readthedocs.io/ #
# #
# PyGithub is free software: you can redistribute it and/or modify it under #
# the terms of the GNU Lesser General Public License as published by the Free #
# Software Foundation, either version 3 of the License, or (at your option) #
# any later version. #
# #
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
# details. #
# #
# You should have received a copy of the GNU Lesser General Public License #
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################


class AppAuthentication:
def __init__(
self,
app_id,
private_key,
installation_id,
token_permissions=None,
):
assert isinstance(app_id, (int, str)), app_id
assert isinstance(private_key, str)
assert isinstance(installation_id, int), installation_id
assert token_permissions is None or isinstance(
token_permissions, dict
), token_permissions
self.app_id = app_id
self.private_key = private_key
self.installation_id = installation_id
self.token_permissions = token_permissions
10 changes: 10 additions & 0 deletions github/AppAuthentication.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Optional, Dict, Union

class AppAuthentication:
def __init__(
self,
app_id: Union[int, str],
private_key: str,
installation_id: int,
token_permissions: Optional[Dict[str, str]] = ...,
): ...
11 changes: 2 additions & 9 deletions github/ApplicationOAuth.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ class ApplicationOAuth(NonCompletableGithubObject):
@property
def client_secret(self) -> str: ...
def get_login_url(
self,
redirect_uri: Optional[str],
state: Optional[str],
login: Optional[str]
self, redirect_uri: Optional[str], state: Optional[str], login: Optional[str]
) -> str: ...
def get_access_token(
self,
code: str,
state: Optional[str]
) -> AccessToken: ...
def get_access_token(self, code: str, state: Optional[str]) -> AccessToken: ...
Loading