Skip to content

Commit 6d17195

Browse files
authored
feat: add 3.9 support and drop 3.5 (googleapis#167)
- Drop 3.5 which is now EOL. https://www.python.org/downloads/release/python-3510/ - Add 3.9 tests and make them required. (Skipping 3.9 C++ tests as wheels are not yet published) - Add a constraints file and use it to test lower bounds in the setup.py in one unit test session (3.6)
1 parent 5c14cba commit 6d17195

10 files changed

Lines changed: 68 additions & 31 deletions

.circleci/config.yml

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ workflows:
1616
ignore: /.*/
1717
tags:
1818
only: /^v\d+\.\d+\.\d+.*/
19-
- unit-3.5:
20-
filters:
21-
tags:
22-
only: /.*/
23-
- unit-cpp-3.5:
24-
filters:
25-
tags:
26-
only: /.*/
2719
- unit-3.6:
2820
filters:
2921
tags:
@@ -48,30 +40,38 @@ workflows:
4840
filters:
4941
tags:
5042
only: /.*/
43+
- unit-3.9:
44+
filters:
45+
tags:
46+
only: /.*/
47+
# - unit-cpp-3.9:
48+
# filters:
49+
# tags:
50+
# only: /.*/
5151
- docs:
5252
filters:
5353
tags:
5454
only: /.*/
5555
- publish:
5656
requires:
57-
- unit-3.5
58-
- unit-cpp-3.5
5957
- unit-3.6
6058
- unit-cpp-3.6
6159
- unit-3.7
6260
- unit-cpp-3.7
6361
- unit-3.8
6462
- unit-cpp-3.8
63+
- unit-3.9
64+
# - unit-cpp-3.9
6565
- docs
6666
filters:
6767
branches:
6868
ignore: /.*/
6969
tags:
7070
only: /^\d+\.\d+\.\d+((a|b|rc)\d+)?$/
7171
jobs:
72-
unit-3.5:
72+
unit-3.6:
7373
docker:
74-
- image: python:3.5
74+
- image: python:3.6
7575
steps:
7676
- checkout
7777
- run:
@@ -81,14 +81,14 @@ jobs:
8181
pip install codecov
8282
- run:
8383
name: Run unit tests.
84-
command: nox -s unit-3.5
84+
command: nox -s unit-3.6
8585
- run:
8686
name: Submit coverage data to codecov.
8787
command: codecov
8888
when: always
89-
unit-3.6:
89+
unit-3.7:
9090
docker:
91-
- image: python:3.6
91+
- image: python:3.7
9292
steps:
9393
- checkout
9494
- run:
@@ -98,14 +98,14 @@ jobs:
9898
pip install codecov
9999
- run:
100100
name: Run unit tests.
101-
command: nox -s unit-3.6
101+
command: nox -s unit-3.7
102102
- run:
103103
name: Submit coverage data to codecov.
104104
command: codecov
105105
when: always
106-
unit-3.7:
106+
unit-3.8:
107107
docker:
108-
- image: python:3.7
108+
- image: python:3.8
109109
steps:
110110
- checkout
111111
- run:
@@ -115,14 +115,14 @@ jobs:
115115
pip install codecov
116116
- run:
117117
name: Run unit tests.
118-
command: nox -s unit-3.7
118+
command: nox -s unit-3.8
119119
- run:
120120
name: Submit coverage data to codecov.
121121
command: codecov
122122
when: always
123-
unit-3.8:
123+
unit-3.9:
124124
docker:
125-
- image: python:3.8
125+
- image: python:3.9
126126
steps:
127127
- checkout
128128
- run:
@@ -132,14 +132,14 @@ jobs:
132132
pip install codecov
133133
- run:
134134
name: Run unit tests.
135-
command: nox -s unit-3.8
135+
command: nox -s unit-3.9
136136
- run:
137137
name: Submit coverage data to codecov.
138138
command: codecov
139139
when: always
140-
unit-cpp-3.5:
140+
unit-3.10:
141141
docker:
142-
- image: python:3.5
142+
- image: python:3.10-rc
143143
steps:
144144
- checkout
145145
- run:
@@ -149,7 +149,7 @@ jobs:
149149
pip install codecov
150150
- run:
151151
name: Run unit tests.
152-
command: nox -s unitcpp-3.5
152+
command: nox -s unit-3.10
153153
- run:
154154
name: Submit coverage data to codecov.
155155
command: codecov
@@ -205,6 +205,23 @@ jobs:
205205
name: Submit coverage data to codecov.
206206
command: codecov
207207
when: always
208+
# unit-cpp-3.9:
209+
# docker:
210+
# - image: python:3.9
211+
# steps:
212+
# - checkout
213+
# - run:
214+
# name: Install nox and codecov.
215+
# command: |
216+
# pip install nox
217+
# pip install codecov
218+
# - run:
219+
# name: Run unit tests.
220+
# command: nox -s unitcpp-3.9
221+
# - run:
222+
# name: Submit coverage data to codecov.
223+
# command: codecov
224+
# when: always
208225
docs:
209226
docker:
210227
- image: python:3.6

.github/sync-repo-settings.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ branchProtectionRules:
77
requiredStatusCheckContexts:
88
- 'ci/circleci: docs'
99
- 'ci/circleci: style-check'
10-
- 'ci/circleci: unit-3.5'
1110
- 'ci/circleci: unit-3.6'
1211
- 'ci/circleci: unit-3.7'
1312
- 'ci/circleci: unit-3.8'
14-
- 'ci/circleci: unit-cpp-3.5'
13+
- 'ci/circleci: unit-3.9'
1514
- 'ci/circleci: unit-cpp-3.6'
1615
- 'ci/circleci: unit-cpp-3.7'
1716
- 'ci/circleci: unit-cpp-3.8'

noxfile.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,25 @@
1414

1515
from __future__ import absolute_import
1616
import os
17+
import pathlib
1718

1819
import nox
1920

2021

21-
@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
22+
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
23+
24+
25+
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
2226
def unit(session, proto="python"):
2327
"""Run the unit test suite."""
2428

29+
constraints_path = str(
30+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
31+
)
32+
2533
session.env["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = proto
2634
session.install("coverage", "pytest", "pytest-cov", "pytz")
27-
session.install("-e", ".[testing]")
35+
session.install("-e", ".[testing]", "-c", constraints_path)
2836

2937
session.run(
3038
"py.test",
@@ -43,7 +51,10 @@ def unit(session, proto="python"):
4351
)
4452

4553

46-
@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
54+
# Check if protobuf has released wheels for new python versions
55+
# https://pypi.org/project/protobuf/#files
56+
# This list will generally be shorter than 'unit'
57+
@nox.session(python=["3.6", "3.7", "3.8"])
4758
def unitcpp(session):
4859
return unit(session, proto="cpp")
4960

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,18 @@
3838
include_package_data=True,
3939
install_requires=("protobuf >= 3.12.0",),
4040
extras_require={"testing": ["google-api-core[grpc] >= 1.22.2",],},
41+
python_requires=">=3.6",
4142
classifiers=[
4243
"Development Status :: 5 - Production/Stable",
4344
"Environment :: Console",
4445
"Intended Audience :: Developers",
4546
"License :: OSI Approved :: Apache Software License",
4647
"Operating System :: POSIX",
4748
"Programming Language :: Python :: 3",
48-
"Programming Language :: Python :: 3.5",
4949
"Programming Language :: Python :: 3.6",
5050
"Programming Language :: Python :: 3.7",
5151
"Programming Language :: Python :: 3.8",
52+
"Programming Language :: Python :: 3.9",
5253
"Topic :: Software Development :: Code Generators",
5354
"Topic :: Software Development :: Libraries :: Python Modules",
5455
],

testing/constraints-3.10.txt

Whitespace-only changes.

testing/constraints-3.11.txt

Whitespace-only changes.

testing/constraints-3.6.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This constraints file is used to check that lower bounds
2+
# are correct in setup.py
3+
# List *all* library dependencies and extras in this file.
4+
# Pin the version to the lower bound.
5+
#
6+
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
7+
# Then this file should have foo==1.14.0
8+
protobuf==3.12.0
9+
google-api-core==1.22.2

testing/constraints-3.7.txt

Whitespace-only changes.

testing/constraints-3.8.txt

Whitespace-only changes.

testing/constraints-3.9.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)