Skip to content

Commit f838eee

Browse files
committed
chore: require Python ≥ 3.9
1 parent 7d20fbb commit f838eee

File tree

5 files changed

+39
-98
lines changed

5 files changed

+39
-98
lines changed

.github/workflows/tests.yaml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616
env:
1717
SHOWCASE_VERSION: 0.35.0
1818
PROTOC_VERSION: 3.20.2
19-
OLDEST_PYTHON: 3.7
19+
OLDEST_PYTHON: 3.9
2020
LATEST_STABLE_PYTHON: 3.14
2121
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450):
2222
# Switch this to Python 3.15 alpha1 pre-release
@@ -25,7 +25,7 @@ env:
2525
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450):
2626
# Add Python 3.15 alpha1 pre-release
2727
# https://peps.python.org/pep-0790/
28-
ALL_PYTHON: "['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']"
28+
ALL_PYTHON: "['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']"
2929

3030
permissions:
3131
contents: read
@@ -93,9 +93,6 @@ jobs:
9393
# Run mypy on all of the supported python versions listed in setup.py
9494
# https://github.com/python/mypy/blob/master/setup.py
9595
python: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
96-
exclude:
97-
# Remove once https://github.com/googleapis/gapic-generator-python/issues/2303 is fixed
98-
- python: '3.7'
9996
runs-on: ubuntu-latest
10097
steps:
10198
- uses: actions/checkout@v5
@@ -119,9 +116,7 @@ jobs:
119116
target: [showcase, showcase_w_rest_async]
120117
logging_scope: ["", "google"]
121118

122-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
123-
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
124-
runs-on: ubuntu-22.04
119+
runs-on: ubuntu-latest
125120
steps:
126121
- uses: actions/checkout@v5
127122
- name: Set up Python "${{ matrix.python }}"
@@ -212,9 +207,7 @@ jobs:
212207
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
213208
logging_scope: ["", "google"]
214209

215-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
216-
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
217-
runs-on: ubuntu-22.04
210+
runs-on: ubuntu-latest
218211
steps:
219212
- uses: actions/checkout@v5
220213
- name: Set up Python "${{ matrix.python }}"
@@ -318,9 +311,7 @@ jobs:
318311
strategy:
319312
matrix:
320313
python: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
321-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
322-
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
323-
runs-on: ubuntu-22.04
314+
runs-on: ubuntu-latest
324315
steps:
325316
- uses: actions/checkout@v5
326317
- name: Set up Python ${{ matrix.python }}
@@ -344,9 +335,7 @@ jobs:
344335
matrix:
345336
python: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
346337
variant: ['', _alternative_templates]
347-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
348-
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
349-
runs-on: ubuntu-22.04
338+
runs-on: ubuntu-latest
350339
steps:
351340
- uses: actions/checkout@v5
352341
- name: Set up Python ${{ matrix.python }}

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
Execute unit tests by running one of the sessions prefixed with `unit-`.
2020

21-
- Example: `nox -s unit-3.8`
21+
- Example: `nox -s unit-3.13`
2222
- See all Nox sessions with `nox -l`.
2323

2424
## Formatting

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ API Client Generator for Python
55

66
|release level| |pypi| |versions|
77

8-
A generator for protocol buffer described APIs for and in Python 3.
8+
A client library generator for APIs described through protocol buffers.
99

1010
This is a generator for API client libraries for APIs
1111
specified by `protocol buffers`_, such as those inside Google.

noxfile.py

Lines changed: 30 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
BLACK_EXCLUDES = "|".join([".*golden.*", ".*pb2.py"])
3838

3939
ALL_PYTHON = (
40-
"3.7",
41-
"3.8",
4240
"3.9",
4341
"3.10",
4442
"3.11",
@@ -170,17 +168,11 @@ def fragment(session, use_ads_templates=False):
170168
"pytest",
171169
"pytest-cov",
172170
"pytest-xdist",
173-
"asyncmock; python_version < '3.8'",
174171
"pytest-asyncio",
175172
"grpcio-tools",
176173
)
177-
session.install("-e", ".")
178-
179-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2473):
180-
# Warnings emitted from google-api-core starting in 2.28
181-
# appear to cause issues when running protoc.
182174
# The specific failure is `Plugin output is unparseable`
183-
if session.python in ("3.7", "3.8", "3.9", "3.10"):
175+
if session.python in ("3.9", "3.10"):
184176
session.install("google-api-core<2.28")
185177

186178
frag_files = (
@@ -250,7 +242,7 @@ def showcase_library(
250242
# Warnings emitted from google-api-core starting in 2.28
251243
# appear to cause issues when running protoc.
252244
# The specific failure is `Plugin output is unparseable`
253-
if session.python in ("3.7", "3.8", "3.9", "3.10"):
245+
if session.python in ("3.9", "3.10"):
254246
session.install("google-api-core<2.28")
255247

256248
# Install a client library for Showcase.
@@ -357,40 +349,20 @@ def showcase_library(
357349
f"{tmp_dir}/testing/constraints-{session.python}.txt"
358350
)
359351
# Install the library with a constraints file.
360-
if session.python == "3.7":
361-
session.install("-e", tmp_dir, "-r", constraints_path)
362-
if rest_async_io_enabled:
363-
# NOTE: We re-install `google-api-core` and `google-auth` to override the respective
364-
# versions for each specified in constraints-3.7.txt. This is needed because async REST
365-
# is not supported with the minimum version of `google-api-core` and `google-auth`.
366-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2211): Remove hardcoded dependencies
367-
# from here and add a new constraints file for testing the minimum supported versions for async REST feature.
368-
session.install(
369-
"--no-cache-dir",
370-
"--force-reinstall",
371-
"google-api-core[grpc, async_rest]==2.21.0",
372-
)
373-
# session.install('--no-cache-dir', '--force-reinstall', "google-api-core==2.20.0")
374-
session.install(
375-
"--no-cache-dir",
376-
"--force-reinstall",
377-
"google-auth[aiohttp]==2.35.0",
378-
)
379-
else:
380-
session.install(
381-
"-e",
382-
tmp_dir + ("[async_rest]" if rest_async_io_enabled else ""),
383-
"-r",
384-
constraints_path,
385-
)
386-
# Exclude `google-auth==2.40.0` which contains a regression
387-
# https://github.com/googleapis/gapic-generator-python/issues/2385
388-
session.install(
389-
"--no-cache-dir",
390-
"--force-reinstall",
391-
"--upgrade",
392-
"google-auth[aiohttp]!=2.40.0",
393-
)
352+
session.install(
353+
"-e",
354+
tmp_dir + ("[async_rest]" if rest_async_io_enabled else ""),
355+
"-r",
356+
constraints_path,
357+
)
358+
# Exclude `google-auth==2.40.0` which contains a regression
359+
# https://github.com/googleapis/gapic-generator-python/issues/2385
360+
session.install(
361+
"--no-cache-dir",
362+
"--force-reinstall",
363+
"--upgrade",
364+
"google-auth[aiohttp]!=2.40.0",
365+
)
394366
else:
395367
# The ads templates do not have constraints files.
396368
# See https://github.com/googleapis/gapic-generator-python/issues/1788
@@ -497,41 +469,23 @@ def run_showcase_unit_tests(session, fail_under=100, rest_async_io_enabled=False
497469
"pytest",
498470
"pytest-cov",
499471
"pytest-xdist",
500-
"asyncmock; python_version < '3.8'",
501472
"pytest-asyncio",
502473
)
503474
# Run the tests.
504-
# NOTE: async rest is not supported against the minimum supported version of google-api-core.
505-
# Therefore, we ignore the coverage requirement in this case.
506-
if session.python == "3.7" and rest_async_io_enabled:
507-
session.run(
508-
"py.test",
509-
*(
510-
session.posargs
511-
or [
512-
"-n=auto",
513-
"--quiet",
514-
"--cov=google",
515-
"--cov-append",
516-
path.join("tests", "unit"),
517-
]
518-
),
519-
)
520-
else:
521-
session.run(
522-
"py.test",
523-
*(
524-
session.posargs
525-
or [
526-
"-n=auto",
527-
"--quiet",
528-
"--cov=google",
529-
"--cov-append",
530-
f"--cov-fail-under={str(fail_under)}",
531-
path.join("tests", "unit"),
532-
]
533-
),
534-
)
475+
session.run(
476+
"py.test",
477+
*(
478+
session.posargs
479+
or [
480+
"-n=auto",
481+
"--quiet",
482+
"--cov=google",
483+
"--cov-append",
484+
f"--cov-fail-under={str(fail_under)}",
485+
path.join("tests", "unit"),
486+
]
487+
),
488+
)
535489

536490

537491
@nox.session(python=ALL_PYTHON)

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@
7070
"License :: OSI Approved :: Apache Software License",
7171
"Programming Language :: Python",
7272
"Programming Language :: Python :: 3",
73-
"Programming Language :: Python :: 3.7",
74-
"Programming Language :: Python :: 3.8",
7573
"Programming Language :: Python :: 3.9",
7674
"Programming Language :: Python :: 3.10",
7775
"Programming Language :: Python :: 3.11",
@@ -83,7 +81,7 @@
8381
"Topic :: Software Development :: Libraries :: Python Modules",
8482
],
8583
platforms="Posix; MacOS X",
86-
python_requires=">=3.7",
84+
python_requires=">=3.9",
8785
install_requires=dependencies,
8886
include_package_data=True,
8987
zip_safe=False,

0 commit comments

Comments
 (0)