From 7d554dce8ed8a9b4c82c9bca8df248d7699a29da Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 13 Sep 2024 15:32:45 +0000 Subject: [PATCH 1/9] feat: add support for python 3.13 --- .github/workflows/unittest.yml | 2 ++ CONTRIBUTING.rst | 6 ++++-- noxfile.py | 2 +- setup.py | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 8adc535e..49d45e56 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -19,6 +19,7 @@ jobs: - "3.10" - "3.11" - "3.12" + - "3.13" exclude: - option: "_wo_grpc" python: 3.7 @@ -33,6 +34,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + allow-prereleases: true - name: Install nox run: | python -m pip install --upgrade setuptools pip wheel diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 8d1475ce..1a1f608b 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -21,7 +21,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 on both UNIX and Windows. + 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -71,7 +71,7 @@ We use `nox `__ to instrument our tests. - To run a single unit test:: - $ nox -s unit-3.12 -- -k + $ nox -s unit-3.13 -- -k .. note:: @@ -203,6 +203,7 @@ We support: - `Python 3.10`_ - `Python 3.11`_ - `Python 3.12`_ +- `Python 3.13`_ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ @@ -210,6 +211,7 @@ We support: .. _Python 3.10: https://docs.python.org/3.10/ .. _Python 3.11: https://docs.python.org/3.11/ .. _Python 3.12: https://docs.python.org/3.12/ +.. _Python 3.13: https://docs.python.org/3.13/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/noxfile.py b/noxfile.py index a15795ea..55fb1e79 100644 --- a/noxfile.py +++ b/noxfile.py @@ -28,7 +28,7 @@ # Black and flake8 clash on the syntax for ignoring flake8's F401 in this file. BLACK_EXCLUDES = ["--exclude", "^/google/api_core/operations_v1/__init__.py"] -PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] +PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] DEFAULT_PYTHON_VERSION = "3.10" CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() diff --git a/setup.py b/setup.py index a9e01f49..2b31bb62 100644 --- a/setup.py +++ b/setup.py @@ -90,6 +90,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", "Topic :: Internet", ], From 7ce4b608c649638cb1fa2bef09cf84c8f7de9fae Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 13 Sep 2024 15:38:44 +0000 Subject: [PATCH 2/9] Add constraints file --- testing/constraints-3.13.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 testing/constraints-3.13.txt diff --git a/testing/constraints-3.13.txt b/testing/constraints-3.13.txt new file mode 100644 index 00000000..e69de29b From 6648ce55052a3d07d66cb23529647b0ae95a5031 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 13 Sep 2024 16:09:17 +0000 Subject: [PATCH 3/9] Avoid Python3.13 warning coroutine method 'aclose' was never awaited --- tests/asyncio/retry/test_retry_streaming_async.py | 5 +++++ tests/asyncio/test_page_iterator_async.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tests/asyncio/retry/test_retry_streaming_async.py b/tests/asyncio/retry/test_retry_streaming_async.py index 28ae6ff1..214d085f 100644 --- a/tests/asyncio/retry/test_retry_streaming_async.py +++ b/tests/asyncio/retry/test_retry_streaming_async.py @@ -134,6 +134,7 @@ async def test___call___generator_retry(self, sleep): unpacked = [await generator.__anext__() for i in range(10)] assert unpacked == [0, 1, 2, 0, 1, 2, 0, 1, 2, 0] assert on_error.call_count == 3 + await generator.aclose() @mock.patch("random.uniform", autospec=True, side_effect=lambda m, n: n) @mock.patch("asyncio.sleep", autospec=True) @@ -241,6 +242,7 @@ async def _mock_send_gen(): recv = await generator.asend(msg) out_messages.append(recv) assert in_messages == out_messages + await generator.aclose() @mock.patch("asyncio.sleep", autospec=True) @pytest.mark.asyncio @@ -258,6 +260,7 @@ async def test___call___generator_send_retry(self, sleep): with pytest.raises(TypeError) as exc_info: await generator.asend("cannot send to fresh generator") assert exc_info.match("can't send non-None value") + await generator.aclose() # error thrown on 3 # generator should contain 0, 1, 2 looping @@ -266,6 +269,7 @@ async def test___call___generator_send_retry(self, sleep): unpacked = [await generator.asend(i) for i in range(10)] assert unpacked == [1, 2, 0, 1, 2, 0, 1, 2, 0, 1] assert on_error.call_count == 3 + await generator.aclose() @mock.patch("asyncio.sleep", autospec=True) @pytest.mark.asyncio @@ -377,6 +381,7 @@ async def wrapper(): assert await retryable.asend("test") == 1 assert await retryable.asend("test2") == 2 assert await retryable.asend("test3") == 3 + await retryable.aclose() @pytest.mark.parametrize("awaitable_wrapped", [True, False]) @mock.patch("asyncio.sleep", autospec=True) diff --git a/tests/asyncio/test_page_iterator_async.py b/tests/asyncio/test_page_iterator_async.py index 75f9e1cf..4653b768 100644 --- a/tests/asyncio/test_page_iterator_async.py +++ b/tests/asyncio/test_page_iterator_async.py @@ -106,6 +106,7 @@ async def test__page_aiter_increment(self): await page_aiter.__anext__() assert iterator.num_results == 1 + await page_aiter.aclose() @pytest.mark.asyncio async def test__page_aiter_no_increment(self): @@ -118,6 +119,7 @@ async def test__page_aiter_no_increment(self): # results should still be 0 after fetching a page. assert iterator.num_results == 0 + await page_aiter.aclose() @pytest.mark.asyncio async def test__items_aiter(self): From cb279c9aeaaa3856f885975d8efc1299bb9b3c24 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 9 Oct 2024 17:11:48 +0000 Subject: [PATCH 4/9] remove allow-prereleases: true --- .github/workflows/unittest.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 91613f7c..a82859e1 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -34,7 +34,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - allow-prereleases: true - name: Install nox run: | python -m pip install --upgrade setuptools pip wheel From a110d70ac638f2ba27047df87eb940785e69093c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 9 Oct 2024 17:59:18 +0000 Subject: [PATCH 5/9] exclude grpcio 1.67.0rc1 --- noxfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 81463d4a..839bb2b5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -95,7 +95,8 @@ def install_prerelease_dependencies(session, constraints_path): prerel_deps = [ "google-auth", "googleapis-common-protos", - "grpcio", + # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 + "grpcio!=1.67.0rc1", "grpcio-status", "proto-plus", "protobuf", @@ -132,7 +133,7 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal install_extras = [] if install_grpc: - install_extras.append("grpc") + install_extras.append("grpcio") constraints_dir = str(CURRENT_DIRECTORY / "testing") if install_async_rest: From 7ba0cba35009bbe55caec66b365627c7f78df407 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 9 Oct 2024 18:04:58 +0000 Subject: [PATCH 6/9] add comment --- noxfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 839bb2b5..33e2a925 100644 --- a/noxfile.py +++ b/noxfile.py @@ -96,6 +96,7 @@ def install_prerelease_dependencies(session, constraints_path): "google-auth", "googleapis-common-protos", # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 + "grpcio!=1.67.0rc1", "grpcio-status", "proto-plus", @@ -133,7 +134,8 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal install_extras = [] if install_grpc: - install_extras.append("grpcio") + # Note: The extra is called `grpc` and not `grpcio` + install_extras.append("grpc") constraints_dir = str(CURRENT_DIRECTORY / "testing") if install_async_rest: From 020379ebbe4eeba5a62083b47b75940a8505ed21 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 9 Oct 2024 18:05:46 +0000 Subject: [PATCH 7/9] remove empty line --- noxfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 33e2a925..bec19d9b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -96,7 +96,6 @@ def install_prerelease_dependencies(session, constraints_path): "google-auth", "googleapis-common-protos", # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 - "grpcio!=1.67.0rc1", "grpcio-status", "proto-plus", From 32abb99944d78a62f0d1f5c993cddfca8537091c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 9 Oct 2024 18:06:53 +0000 Subject: [PATCH 8/9] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- noxfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 33e2a925..bec19d9b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -96,7 +96,6 @@ def install_prerelease_dependencies(session, constraints_path): "google-auth", "googleapis-common-protos", # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 - "grpcio!=1.67.0rc1", "grpcio-status", "proto-plus", From 5fb2a14b237e6ed8fbb5551efc025432397d65a3 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 15 Oct 2024 12:44:47 -0400 Subject: [PATCH 9/9] Update comment Co-authored-by: ohmayr --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index bec19d9b..ada6f330 100644 --- a/noxfile.py +++ b/noxfile.py @@ -133,7 +133,7 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal install_extras = [] if install_grpc: - # Note: The extra is called `grpc` and not `grpcio` + # Note: The extra is called `grpc` and not `grpcio`. install_extras.append("grpc") constraints_dir = str(CURRENT_DIRECTORY / "testing")