8000 Merge pull request #1011 from sigmavirus24/py-38-39-support · staticdev/github4.py@52b9d5f · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 22, 2021. It is now read-only.

Commit 52b9d5f

Browse files
authored
Merge pull request sigmavirus24#1011 from sigmavirus24/py-38-39-support
Support Python 3.8 and 3.9
2 parents f3bf7cb + 9a1d442 commit 52b9d5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+242
-217
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,28 @@ jobs:
99
strategy:
1010
matrix:
1111
python:
12-
- { VERSION: "2.7", TOXENV: "py27", ALLOW_FAILURE: false }
13-
- { VERSION: "2.7", TOXENV: "py27-flake8", ALLOW_FAILURE: false}
14-
- { VERSION: "3.5", TOXENV: "py35", ALLOW_FAILURE: false }
1512
- { VERSION: "3.6", TOXENV: "py36", ALLOW_FAILURE: false }
1613
- { VERSION: "3.7", TOXENV: "py37", ALLOW_FAILURE: false }
17-
- { VERSION: "3.8", TOXENV: "py38-flake8,readme,doclint,docs,commitlint",ALLOW_FAILURE: false }
18-
- { VERSION: "3.8", TOXENV: "docstrings", ALLOW_FAILURE: true}
19-
- { VERSION: "pypy2", TOXENV: "pypy", ALLOW_FAILURE: false }
14+
- { VERSION: "3.8", TOXENV: "py38",ALLOW_FAILURE: false }
15+
- { VERSION: "3.9", TOXENV: "py39-flake8,readme,doclint,docs,commitlint",ALLOW_FAILURE: false }
16+
- { VERSION: "3.9", TOXENV: "docstrings", ALLOW_FAILURE: true}
2017
- { VERSION: "pypy3", TOXENV: "pypy", ALLOW_FAILURE: false }
2118

2219
steps:
23-
- uses: actions/checkout@v2
20+
- name: Check out the repository
21+
uses: actions/checkout@v2.3.4
2422
- name: Setup Python
25-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v2.2.1
2624
with:
2725
python-version: ${{ matrix.PYTHON.VERSION }}
28-
- name: Install Tox and any other packages
29-
run: pip install tox
26+
- name: Upgrade pip
27+
run: |
28+
pip install --constraint=.github/workflows/constraints.txt pip
29+
pip --version
30+
- name: Install Tox
31+
run: |
32+
pip install --constraint=.github/workflows/constraints.txt tox
33+
tox --version
3034
- name: Run Tox
3135
run: tox
3236
env:

.github/workflows/constraints.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pip==20.3.3
2+
tox==3.20.1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ tests/id_rsa
2424
.pytest_cache/
2525
t.py
2626
*.pem
27+
/.python-version

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Maintainer(s)
1212

1313
- Matt Chung (@itsmemattchung)
1414

15+
- Thiago D'Ávila (@staticdev)
16+
1517
Requests
1618
````````
1719

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
github3.py is a comprehensive, actively developed and extraordinarily stable
55
wrapper around the GitHub API (v3).
66

7+
Note: This library currently works with Python 3.6+ or pypy3. For older versions, please use version 1.3.0.
8+
79
Installation
810
------------
911

@@ -36,11 +38,9 @@ this in a virtual environment. These need to be installed for the tests to run.
3638

3739
- betamax_
3840
- coverage_ by Ned Batchelder
39-
- mock_ by Michael Foord
4041

4142
.. _betamax: https://github.com/sigmavirus24/betamax
4243
.. _coverage: http://nedbatchelder.com/code/coverage/
43-
.. _mock: https://mock.readthedocs.io/en/latest/
4444

4545
Build status
4646
~~~~~~~~~~~~

appveyor.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ environment:
55
matrix:
66
# http://www.appveyor.com/docs/installed-software#python lists available
77
# versions
8-
- PYTHON: "C:\\Python27"
9-
TOXENV: py27
10-
- PYTHON: "C:\\Python27-x64"
11-
TOXENV: py27
12-
- PYTHON: "C:\\Python35"
13-
TOXENV: py35
14-
- PYTHON: "C:\\Python35-x64"
15-
TOXENV: py35
168
- PYTHON: "C:\\Python36"
179
TOXENV: py36
1810
- PYTHON: "C:\\Python36-x64"
@@ -21,6 +13,10 @@ environment:
2113
TOXENV: py37
2214
- PYTHON: "C:\\Python37-x64"
2315
TOXENV: py37
16+
- PYTHON: "C:\\Python38-x64"
17+
TOXENV: py38
18+
- PYTHON: "C:\\Python39-x64"
19+
TOXENV: py39
2420

2521
init:
2622
- "echo %PYTHON%"

dev-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.
22
#coverage==3.5.2
3-
mock==1.0.1
43
pytest>=2.3.5,<3.3.0
54
wheel==0.21.0
65
betamax>=0.5.0

docs/source/index.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,37 +122,37 @@ The tests are generally run using tox. Tox can be installed like so
122122
123123
pip install tox
124124
125-
We test against PyPy and the following versions of Python:
125+
We test against PyPy3 and the following versions of Python:
126126

127-
- 2.7
127+
- 3.6
128128

129-
- 3.4
129+
- 3.7
130130

131-
- 3.5
131+
- 3.8
132132

133-
- 3.6
133+
- 3.9
134134

135135
If you simply run ``tox`` it will run tests against all of these versions of
136136
python and run ``flake8`` against the codebase as well. If you want to run
137137
against one specific version, you can do
138138

139139
.. code-block:: console
140140
141-
tox -e py36
141+
tox -e py39
142142
143143
And if you want to run tests against a specific file, you can do
144144

145145
.. code-block:: console
146146
147-
tox -e py36 -- tests/unit/test_github.py
147+
tox -e py39 -- tests/unit/test_github.py
148148
149149
To run the tests, ``tox`` uses ``py.test`` so you can pass any options or
150150
parameters to ``py.test`` after specifying ``--``. For example, you can get
151151
more verbose output by doing
152152

153153
.. code-block:: console
154154
155-
tox -e py36 -- -vv
155+
tox -e py39 -- -vv
156156
157157
.. toctree::
158158

docs/source/release-notes/2.0.0.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
1.4.0: 2020-12-29
2+
-----------------
3+
4+
Features Added
5+
``````````````
6+
7+
- Add support to Python 3.8 and 3.9.
8+
- Remove support to Python versions that reached end-of-life (2, 3.4 and 3.5).
9+
- Update CI/CD to thoroughly test all supported version.
10+
- Remove compatibility imports for Python 2.
11+
- Remove dev-dependency for mock.

docs/source/release-notes/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
All of the release notes that have been recorded for github3.py are organized
66
here with the newest releases first.
77

8+
2.x Release Series
9+
==================
10+
11+
.. toctree::
12+
2.0.0
13+
814
1.x Release Series
915
==================
1016

example-notebooks/two_factor_authentication.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
"cell_type": "markdown",
4242
"metadata": {},
4343
"source": [
44-
"This handler will work on Python 2 and Python 3. (In Python 2, to prompt the user, you want to use `raw_input` but that was replaced in Python 3 with `input`.)\n",
45-
"\n",
4644
"This will ask the user to type in their token and then return it to github3.py. If you're developing a GUI, you will want to write a different handler, but that is out of the scope of this example.\n",
4745
"\n",
4846
"To use the handler above you can pass it to the `github3.login` function."

setup.py

Lines changed: 35 additions & 38 deletions
54
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,28 @@
1919
]
2020

2121
SNI_requirements = [
22-
'pyOpenSSL',
23-
'ndg-httpsclient',
24-
'pyasn1',
22+
"pyOpenSSL",
23+
"ndg-httpsclient",
24+
"pyasn1",
2525
]
2626

27-
kwargs['tests_require'] = ['betamax>=0.8.0', 'pytest>2.3.5',
28-
'betamax-matchers>=0.1.0']
29-
if sys.version_info < (3, 0):
30-
kwargs['tests_require'].append('unittest2 ==0.5.1')
31-
if sys.version_info < (3, 3):
32-
kwargs['tests_require'].append('mock')
27+
kwargs["tests_require"] = ["betamax>=0.8.0", "pytest>2.3.5", "betamax-matchers>=0.1.0"]
3328

3429
if sys.argv[-1] in ("submit", "publish"):
3530
os.system("python setup.py bdist_wheel sdist upload")
3631
sys.exit()
3732

38-
requires.extend([
39-
"requests >= 2.18",
40-
"uritemplate >= 3.0.0",
41-
"python-dateutil >= 2.6.0",
42-
"jwcrypto >= 0.5.0",
43-
])
33+
requires.extend(
34+
[
35+
"requests >= 2.18",
36+
"uritemplate >= 3.0.0",
37+
"python-dateutil >= 2.6.0",
38+
"jwcrypto >= 0.5.0",
39+
]
40+
)
4441

45-
__version__ = ''
46-
with open('src/github3/__about__.py', 'r') as fd:
42+
__version__ = ""
43+
with open("src/github3/__about__.py", "r") as fd:
4744
reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
4845
for line in fd:
4946
m = reg.match(line)
@@ -52,7 +49,7 @@
5249
break
5350

51
if not __version__:
55-
raise RuntimeError('Cannot find version information')
52+
raise RuntimeError("Cannot find version information")
5653

5754

5855
class PyTest(setuptools.command.test.test): # noqa: D101
@@ -64,43 +61,43 @@ def finalize_options(self): # noqa: D102
6461
def run_tests(self): # noqa: D102
6562
# import here, cause outside the eggs aren't loaded
6663
import pytest
67-
warnings.warn("pyton setup.py test support is deprecated.",
68-
DeprecationWarning)
64+
65+
warnings.warn("pyton setup.py test support is deprecated.", DeprecationWarning)
6966
errno = pytest.main(self.test_args)
7067
sys.exit(errno)
7168

7269

7370
setuptools.setup(
7471
name="github3.py",
7572
version=__version__,
76-
description=("Python wrapper for the GitHub API"
77-
"(http://developer.github.com/v3)"),
73+
description=(
74+
"Python wrapper for the GitHub API" "(http://developer.github.com/v3)"
75+
),
7876
long_description=open("README.rst").read(),
79-
license='3-clause BSD',
77+
license="3-clause BSD",
8078
author="Ian Stapleton Cordasco",
8179
author_email="graffatcolmingov@gmail.com",
8280
url="https://github3.readthedocs.io",
8381
packages=packages,
8482
package_dir={"": "src"},
8583
install_requires=requires,
8684
classifiers=[
87-
'Development Status :: 5 - Production/Stable',
88-
'License :: OSI Approved',
89-
'License :: OSI Approved :: BSD License',
90-
'Intended Audience :: Developers',
91-
'Programming Language :: Python',
92-
'Programming Language :: Python :: 2',
93-
'Programming Language :: Python :: 2.7',
94-
'Programming Language :: Python :: 3',
95-
'Programming Language :: Python :: 3.5',
96-
'Programming Language :: Python :: 3.6',
97-
'Programming Language :: Python :: 3.7',
98-
'Programming Language :: Python :: Implementation :: CPython',
85+
"Development Status :: 5 - Production/Stable",
86+
"License :: OSI Approved",
87+
"License :: OSI Approved :: BSD License",
88+
"Intended Audience :: Developers",
89+
"Programming Language :: Python",
90+
"Programming Language :: Python :: 3",
91+
"Programming Language :: Python :: 3.6",
92+
"Programming Language :: Python :: 3.7",
93+
"Programming Language :: Python :: 3.8",
94+
"Programming Language :: Python :: 3.9",
95+
"Programming Language :: Python :: Implementation :: CPython",
9996
],
10097
extras_require={
101-
'test': kwargs['tests_require'],
102-
'sni': SNI_requirements,
98+
"test": kwargs["tests_require"],
99+
"sni": SNI_requirements,
103100
},
104-
cmdclass={'test': PyTest},
101+
cmdclass={"test": PyTest},
105102
**kwargs
106103
)

src/github3/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__author_email__ = "graffatcolmingov@gmail.com"
66
__license__ = "Modified BSD"
77
__copyright__ = "Copyright 2012-2018 Ian Stapleton Cordasco"
8-
__version__ = "1.3.0"
8+
__version__ = "2.0.0"
99
__version_info__ = tuple(
1010
int(i) for i in __version__.split(".") if i.isdigit()
1111
)

src/github3/decorators.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
from requests.models import Response
66
import os
77

8-
try: # (No coverage)
9-
# python2
10-
from StringIO import StringIO # (No coverage)
11-
except ImportError: # (No coverage)
12-
# python3
13-
from io import BytesIO as StringIO
8+
from io import BytesIO as StringIO
149

1510

1611
class RequestsStringIO(StringIO):

src/github3/github.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ def create_repository(
682682
has_wiki=True,
683683
auto_init=False,
684684
gitignore_template="",
685-
has_projects=True
685+
has_projects=True,
686686
):
687687
"""Create a repository for the authenticated user.
688688
@@ -726,7 +726,7 @@ def create_repository(
726726
"has_wiki": has_wiki,
727727
"auto_init": auto_init,
728728
"gitignore_template": gitignore_template,
729-
"has_projects": has_projects
729+
"has_projects": has_projects,
730730
}
731731
json = self._json(self._post(url, data=data), 201)
732732
return self._instance_or_null(repo.Repository, json)
@@ -1428,7 +1428,7 @@ def markdown(self, text, mode="", context="", raw=False):
14281428
:returns:
14291429
the HTML formatted markdown text
14301430
:rtype:
1431-
str (or unicode on Python 2)
1431+
str
14321432
"""
14331433
data = None
14341434
json = False
@@ -1553,7 +1553,7 @@ def octocat(self, say=None):
15531553
:returns:
15541554
ascii art of Octocat
15551555
:rtype:
1556-
str (or unicode on Python 2)
1556+
str
15571557
"""
15581558
url = self._build_url("octocat")
15591559
req = self._get(url, params={"s": say})
@@ -2827,7 +2827,7 @@ def zen(self):
28272827
:returns:
28282828
the zen of GitHub
28292829
:rtype:
2830-
str (on Python 3, unicode on Python 2)
2830+
str
28312831
"""
28322832
url = self._build_url("zen")
28332833
resp = self._get(url)

src/github3/licenses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def decode_content(self):
202202
:returns:
203203
plain-text content of this license
204204
:rtype:
205-
text (unicode on Python 2, str on Python 3)
205+
text (str on Python 3)
206206
"""
207207
if self.encoding == "base64":
208208
return base64.b64decode(self.content.encode("utf-8")).decode(

src/github3/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def _remove_none(data):
134134
return
135135
for (k, v) in list(data.items()):
136136
if v is None:
137-
del (data[k])
137+
del data[k]
138138

139139
def _instance_or_null(self, instance_class, json):
140140
if json is not None and not isinstance(json, dict):

0 commit comments

Comments
 (0)
0