Skip to content

Commit 46b3d3a

Browse files
partheagcf-owl-bot[bot]ohmayr
authoredOct 15, 2024··
feat: add support for python 3.13 (#696)
* feat: add support for python 3.13 * Add constraints file * Avoid Python3.13 warning coroutine method 'aclose' was never awaited * remove allow-prereleases: true * exclude grpcio 1.67.0rc1 * add comment * remove empty line * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update comment Co-authored-by: ohmayr <omairnaveed@ymail.com> --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 8c53381 commit 46b3d3a

File tree

7 files changed

+17
-4
lines changed

7 files changed

+17
-4
lines changed
 

‎.github/workflows/unittest.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- "3.10"
2020
- "3.11"
2121
- "3.12"
22+
- "3.13"
2223
exclude:
2324
- option: "_wo_grpc"
2425
python: 3.7

‎CONTRIBUTING.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ In order to add a feature:
2121
documentation.
2222

2323
- The feature must work fully on the following CPython versions:
24-
3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 on both UNIX and Windows.
24+
3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows.
2525

2626
- The feature must not add unnecessary dependencies (where
2727
"unnecessary" is of course subjective, but new dependencies should
@@ -71,7 +71,7 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.
7171

7272
- To run a single unit test::
7373

74-
$ nox -s unit-3.12 -- -k <name of test>
74+
$ nox -s unit-3.13 -- -k <name of test>
7575

7676

7777
.. note::
@@ -203,13 +203,15 @@ We support:
203203
- `Python 3.10`_
204204
- `Python 3.11`_
205205
- `Python 3.12`_
206+
- `Python 3.13`_
206207

207208
.. _Python 3.7: https://docs.python.org/3.7/
208209
.. _Python 3.8: https://docs.python.org/3.8/
209210
.. _Python 3.9: https://docs.python.org/3.9/
210211
.. _Python 3.10: https://docs.python.org/3.10/
211212
.. _Python 3.11: https://docs.python.org/3.11/
212213
.. _Python 3.12: https://docs.python.org/3.12/
214+
.. _Python 3.13: https://docs.python.org/3.13/
213215

214216

215217
Supported versions can be found in our ``noxfile.py`` `config`_.

‎noxfile.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Black and flake8 clash on the syntax for ignoring flake8's F401 in this file.
2929
BLACK_EXCLUDES = ["--exclude", "^/google/api_core/operations_v1/__init__.py"]
3030

31-
PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
31+
PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
3232

3333
DEFAULT_PYTHON_VERSION = "3.10"
3434
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
@@ -95,7 +95,8 @@ def install_prerelease_dependencies(session, constraints_path):
9595
prerel_deps = [
9696
"google-auth",
9797
"googleapis-common-protos",
98-
"grpcio",
98+
# Exclude grpcio!=1.67.0rc1 which does not support python 3.13
99+
"grpcio!=1.67.0rc1",
99100
"grpcio-status",
100101
"proto-plus",
101102
"protobuf",
@@ -132,6 +133,7 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
132133

133134
install_extras = []
134135
if install_grpc:
136+
# Note: The extra is called `grpc` and not `grpcio`.
135137
install_extras.append("grpc")
136138

137139
constraints_dir = str(CURRENT_DIRECTORY / "testing")

‎setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"Programming Language :: Python :: 3.10",
9494
"Programming Language :: Python :: 3.11",
9595
"Programming Language :: Python :: 3.12",
96+
"Programming Language :: Python :: 3.13",
9697
"Operating System :: OS Independent",
9798
"Topic :: Internet",
9899
],

‎testing/constraints-3.13.txt

Whitespace-only changes.

‎tests/asyncio/retry/test_retry_streaming_async.py

+5
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ async def test___call___generator_retry(self, sleep):
139139
unpacked = [await generator.__anext__() for i in range(10)]
140140
assert unpacked == [0, 1, 2, 0, 1, 2, 0, 1, 2, 0]
141141
assert on_error.call_count == 3
142+
await generator.aclose()
142143

143144
@mock.patch("random.uniform", autospec=True, side_effect=lambda m, n: n)
144145
@mock.patch("asyncio.sleep", autospec=True)
@@ -246,6 +247,7 @@ async def _mock_send_gen():
246247
recv = await generator.asend(msg)
247248
out_messages.append(recv)
248249
assert in_messages == out_messages
250+
await generator.aclose()
249251

250252
@mock.patch("asyncio.sleep", autospec=True)
251253
@pytest.mark.asyncio
@@ -263,6 +265,7 @@ async def test___call___generator_send_retry(self, sleep):
263265
with pytest.raises(TypeError) as exc_info:
264266
await generator.asend("cannot send to fresh generator")
265267
assert exc_info.match("can't send non-None value")
268+
await generator.aclose()
266269

267270
# error thrown on 3
268271
# generator should contain 0, 1, 2 looping
@@ -271,6 +274,7 @@ async def test___call___generator_send_retry(self, sleep):
271274
unpacked = [await generator.asend(i) for i in range(10)]
272275
assert unpacked == [1, 2, 0, 1, 2, 0, 1, 2, 0, 1]
273276
assert on_error.call_count == 3
277+
await generator.aclose()
274278

275279
@mock.patch("asyncio.sleep", autospec=True)
276280
@pytest.mark.asyncio
@@ -382,6 +386,7 @@ async def wrapper():
382386
assert await retryable.asend("test") == 1
383387
assert await retryable.asend("test2") == 2
384388
assert await retryable.asend("test3") == 3
389+
await retryable.aclose()
385390

386391
@pytest.mark.parametrize("awaitable_wrapped", [True, False])
387392
@mock.patch("asyncio.sleep", autospec=True)

‎tests/asyncio/test_page_iterator_async.py

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ async def test__page_aiter_increment(self):
110110
await page_aiter.__anext__()
111111

112112
assert iterator.num_results == 1
113+
await page_aiter.aclose()
113114

114115
@pytest.mark.asyncio
115116
async def test__page_aiter_no_increment(self):
@@ -122,6 +123,7 @@ async def test__page_aiter_no_increment(self):
122123

123124
# results should still be 0 after fetching a page.
124125
assert iterator.num_results == 0
126+
await page_aiter.aclose()
125127

126128
@pytest.mark.asyncio
127129
async def test__items_aiter(self):

0 commit comments

Comments
 (0)
Please sign in to comment.