Skip to content

Commit db0c7cc

Browse files
authored
feat: add support for python 3.11 (#1555)
* feat: add support for python 3.11 * update setup.py template * update depedency proto-plus
1 parent 64d5586 commit db0c7cc

25 files changed

Lines changed: 98 additions & 33 deletions

File tree

packages/gapic-generator/.github/sync-repo-settings.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,22 @@ branchProtectionRules:
2020
- 'showcase-unit (3.8)'
2121
- 'showcase-unit (3.9)'
2222
- 'showcase-unit (3.10)'
23+
- 'showcase-unit (3.11)'
2324
- 'showcase-unit (3.7, _alternative_templates)'
2425
- 'showcase-unit (3.8, _alternative_templates)'
2526
- 'showcase-unit (3.9, _alternative_templates)'
2627
- 'showcase-unit (3.10, _alternative_templates)'
28+
- 'showcase-unit (3.11, _alternative_templates)'
2729
- 'showcase-unit (3.7, _alternative_templates_mixins)'
2830
- 'showcase-unit (3.8, _alternative_templates_mixins)'
2931
- 'showcase-unit (3.9, _alternative_templates_mixins)'
3032
- 'showcase-unit (3.10, _alternative_templates_mixins)'
33+
- 'showcase-unit (3.11, _alternative_templates_mixins)'
3134
- 'showcase-unit (3.7, _mixins)'
3235
- 'showcase-unit (3.8, _mixins)'
3336
- 'showcase-unit (3.9, _mixins)'
3437
- 'showcase-unit (3.10, _mixins)'
38+
- 'showcase-unit (3.11, _mixins)'
3539
- 'showcase-unit-add-iam-methods'
3640
- 'integration'
3741
- 'goldens-lint'
@@ -41,14 +45,17 @@ branchProtectionRules:
4145
- 'unit (3.8)'
4246
- 'unit (3.9)'
4347
- 'unit (3.10)'
48+
- 'unit (3.11)'
4449
- 'fragment (3.7)'
4550
- 'fragment (3.8)'
4651
- 'fragment (3.9)'
4752
- 'fragment (3.10)'
53+
- 'fragment (3.11)'
4854
- 'fragment (3.7, _alternative_templates)'
4955
- 'fragment (3.8, _alternative_templates)'
5056
- 'fragment (3.9, _alternative_templates)'
5157
- 'fragment (3.10, _alternative_templates)'
58+
- 'fragment (3.11, _alternative_templates)'
5259
- 'OwlBot Post Processor'
5360
requiredApprovingReviewCount: 1
5461
requiresCodeOwnerReviews: true

packages/gapic-generator/.github/workflows/tests.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Python
2727
uses: actions/setup-python@v4
2828
with:
29-
python-version: "3.8"
29+
python-version: "3.9"
3030
cache: 'pip'
3131
- name: Install nox.
3232
run: python -m pip install nox
@@ -36,10 +36,10 @@ jobs:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- uses: actions/checkout@v3
39-
- name: Set up Python "3.10"
39+
- name: Set up Python "3.11"
4040
uses: actions/setup-python@v4
4141
with:
42-
python-version: "3.10"
42+
python-version: "3.11"
4343
cache: 'pip'
4444
- name: Install nox.
4545
run: python -m pip install nox
@@ -52,10 +52,10 @@ jobs:
5252
runs-on: ubuntu-latest
5353
steps:
5454
- uses: actions/checkout@v3
55-
- name: Set up Python "3.10"
55+
- name: Set up Python "3.11"
5656
uses: actions/setup-python@v4
5757
with:
58-
python-version: "3.10"
58+
python-version: "3.11"
5959
cache: 'pip'
6060
- name: Install system dependencies.
6161
run: |
@@ -95,10 +95,10 @@ jobs:
9595
run: |
9696
sudo mkdir -p /tmp/workspace/tests/cert/
9797
sudo chown -R ${USER} /tmp/workspace/
98-
- name: Set up Python "3.10"
98+
- name: Set up Python "3.11"
9999
uses: actions/setup-python@v4
100100
with:
101-
python-version: "3.10"
101+
python-version: "3.11"
102102
cache: 'pip'
103103
- name: Copy mtls files
104104
run: cp tests/cert/mtls.* /tmp/workspace/tests/cert/
@@ -131,7 +131,7 @@ jobs:
131131
showcase-unit:
132132
strategy:
133133
matrix:
134-
python: ["3.7", "3.8", "3.9", "3.10"]
134+
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
135135
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins]
136136
runs-on: ubuntu-latest
137137
steps:
@@ -161,10 +161,10 @@ jobs:
161161
runs-on: ubuntu-latest
162162
steps:
163163
- uses: actions/checkout@v3
164-
- name: Set up Python "3.10"
164+
- name: Set up Python "3.11"
165165
uses: actions/setup-python@v4
166166
with:
167-
python-version: "3.10"
167+
python-version: "3.11"
168168
cache: 'pip'
169169
- name: Install system dependencies.
170170
run: |
@@ -189,10 +189,10 @@ jobs:
189189
variant: ['', _alternative_templates]
190190
steps:
191191
- uses: actions/checkout@v3
192-
- name: Set up Python "3.10"
192+
- name: Set up Python "3.11"
193193
uses: actions/setup-python@v4
194194
with:
195-
python-version: "3.10"
195+
python-version: "3.11"
196196
cache: 'pip'
197197
- name: Install system dependencies.
198198
run: |
@@ -214,10 +214,10 @@ jobs:
214214
runs-on: ubuntu-latest
215215
steps:
216216
- uses: actions/checkout@v3
217-
- name: Set up Python "3.10"
217+
- name: Set up Python "3.11"
218218
uses: actions/setup-python@v4
219219
with:
220-
python-version: "3.10"
220+
python-version: "3.11"
221221
cache: 'pip'
222222
- name: Install system dependencies.
223223
run: |
@@ -230,7 +230,7 @@ jobs:
230230
unit:
231231
strategy:
232232
matrix:
233-
python: ["3.7", "3.8", "3.9", "3.10"]
233+
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
234234
runs-on: ubuntu-latest
235235
steps:
236236
- uses: actions/checkout@v3
@@ -251,7 +251,7 @@ jobs:
251251
fragment:
252252
strategy:
253253
matrix:
254-
python: ["3.7", "3.8", "3.9", "3.10"]
254+
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
255255
variant: ['', _alternative_templates]
256256
runs-on: ubuntu-latest
257257
steps:
@@ -303,10 +303,10 @@ jobs:
303303
runs-on: ubuntu-latest
304304
steps:
305305
- uses: actions/checkout@v3
306-
- name: Set up Python 3.10
306+
- name: Set up Python 3.11
307307
uses: actions/setup-python@v4
308308
with:
309-
python-version: "3.10"
309+
python-version: "3.11"
310310
cache: 'pip'
311311
- name: Install nox.
312312
run: |
@@ -322,10 +322,10 @@ jobs:
322322
runs-on: ubuntu-latest
323323
steps:
324324
- uses: actions/checkout@v3
325-
- name: Set up Python "3.10"
325+
- name: Set up Python "3.11"
326326
uses: actions/setup-python@v4
327327
with:
328-
python-version: "3.10"
328+
python-version: "3.11"
329329
cache: 'pip'
330330
- name: Install autopep8
331331
run: |

packages/gapic-generator/gapic/ads-templates/noxfile.py.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ALL_PYTHON = [
1212
"3.8",
1313
"3.9",
1414
"3.10",
15+
"3.11",
1516
]
1617

1718
@nox.session(python=ALL_PYTHON)

packages/gapic-generator/gapic/ads-templates/setup.py.j2

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ setuptools.setup(
1919
install_requires=(
2020
{# TODO(dovs): remove when 1.x deprecation is complete #}
2121
{% if 'rest' in opts.transport %}
22-
'google-api-core[grpc] >= 2.10.0, < 3.0.0dev',
22+
"google-api-core[grpc] >= 2.10.0, < 3.0.0dev",
2323
{% else %}
24-
'google-api-core[grpc] >= 1.28.0, < 3.0.0dev',
24+
"google-api-core[grpc] >= 1.28.0, < 3.0.0dev",
2525
{% endif %}
26-
'googleapis-common-protos >= 1.53.0',
27-
'grpcio >= 1.10.0',
28-
'proto-plus >= 1.19.4',
26+
"googleapis-common-protos >= 1.53.0",
27+
"grpcio >= 1.10.0",
28+
"proto-plus >= 1.19.4, <2.0.0dev",
29+
"proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'",
2930
{% if api.requires_package(('google', 'iam', 'v1')) %}
3031
'grpc-google-iam-v1',
3132
{% endif %}
@@ -45,6 +46,7 @@ setuptools.setup(
4546
'Programming Language :: Python :: 3.8',
4647
'Programming Language :: Python :: 3.9',
4748
'Programming Language :: Python :: 3.10',
49+
'Programming Language :: Python :: 3.11',
4850
'Topic :: Internet',
4951
'Topic :: Software Development :: Libraries :: Python Modules',
5052
],

packages/gapic-generator/gapic/templates/noxfile.py.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ALL_PYTHON = [
1616
"3.8",
1717
"3.9",
1818
"3.10",
19+
"3.11",
1920
]
2021

2122
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
@@ -25,7 +26,7 @@ PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], e
2526

2627
BLACK_VERSION = "black==22.3.0"
2728
BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"]
28-
DEFAULT_PYTHON_VERSION = "3.10"
29+
DEFAULT_PYTHON_VERSION = "3.11"
2930

3031
nox.sessions = [
3132
"unit",

packages/gapic-generator/gapic/templates/setup.py.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ else:
2929
dependencies = [
3030
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
3131
"proto-plus >= 1.22.0, <2.0.0dev",
32+
"proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'",
3233
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
3334
{# TODO: Remove after https://github.com/googleapis/gapic-generator-python/pull/1240 is merged. #}
3435
{% if api.requires_package(('google', 'iam', 'v1')) or opts.add_iam_methods or api.has_iam_mixin %}
@@ -75,6 +76,7 @@ setuptools.setup(
7576
"Programming Language :: Python :: 3.8",
7677
"Programming Language :: Python :: 3.9",
7778
"Programming Language :: Python :: 3.10",
79+
"Programming Language :: Python :: 3.11",
7880
"Operating System :: OS Independent",
7981
"Topic :: Internet",
8082
],
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# -*- coding: utf-8 -*-
2+
{% block constraints %}
3+
{% include "testing/_default_constraints.j2" %}
4+
{% endblock %}

packages/gapic-generator/noxfile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"3.8",
3939
"3.9",
4040
"3.10",
41+
"3.11",
4142
)
4243

4344
NEWEST_PYTHON = ALL_PYTHON[-1]
@@ -411,7 +412,7 @@ def snippetgen(session):
411412
session.run("py.test", "-vv", "tests/snippetgen")
412413

413414

414-
@nox.session(python="3.8")
415+
@nox.session(python="3.9")
415416
def docs(session):
416417
"""Build the docs."""
417418

packages/gapic-generator/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pypandoc==1.10
88
PyYAML==6.0
99
setuptools==65.6.3
1010
grpc-google-iam-v1==0.12.4
11-
proto-plus==1.22.1
11+
proto-plus==1.22.2
1212
pytest-asyncio==0.20.3
1313
libcst==0.4.9
1414
inflection==0.5.1

packages/gapic-generator/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"Programming Language :: Python :: 3.8",
7070
"Programming Language :: Python :: 3.9",
7171
"Programming Language :: Python :: 3.10",
72+
"Programming Language :: Python :: 3.11",
7273
"Operating System :: OS Independent",
7374
"Topic :: Software Development :: Code Generators",
7475
"Topic :: Software Development :: Libraries :: Python Modules",

0 commit comments

Comments
 (0)