diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 734b654559cc..977202e4790f 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.7', '3.8', '3.9', '3.10', "3.11", "3.12"] + python: ['3.7', '3.8', '3.9', '3.10', "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 @@ -50,7 +50,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.12'] + python: ['3.13'] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/ci/run_single_test.sh b/ci/run_single_test.sh index f83c38c6d216..791c5ba3832d 100755 --- a/ci/run_single_test.sh +++ b/ci/run_single_test.sh @@ -16,7 +16,7 @@ # This script requires the following environment variables to be set: # `TEST_TYPE` should be one of ["lint", "lint_setup_py", "docs", "docfx", "prerelease"] -# `PY_VERSION` should be one of ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] +# `PY_VERSION` should be one of ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] # This script is called by the `ci/run_conditional_tests.sh` script. # A specific `nox` session will be run, depending on the value of @@ -69,7 +69,7 @@ case ${TEST_TYPE} in rm -rf docs/_build ;; prerelease) - nox -s prerelease_deps-3.12 + nox -s prerelease_deps-3.13 retval=$? ;; unit) @@ -98,6 +98,10 @@ case ${TEST_TYPE} in nox -s unit-3.12 retval=$? ;; + "3.13") + nox -s unit-3.13 + retval=$? + ;; *) ;; esac diff --git a/packages/google-shopping-css/.flake8 b/packages/google-shopping-css/.flake8 index 87f6e408c47d..32986c79287a 100644 --- a/packages/google-shopping-css/.flake8 +++ b/packages/google-shopping-css/.flake8 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2023 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/packages/google-shopping-css/CONTRIBUTING.rst b/packages/google-shopping-css/CONTRIBUTING.rst index e6e9d1877868..70413aad6426 100644 --- a/packages/google-shopping-css/CONTRIBUTING.rst +++ b/packages/google-shopping-css/CONTRIBUTING.rst @@ -22,7 +22,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 @@ -72,7 +72,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:: @@ -143,12 +143,12 @@ Running System Tests $ nox -s system # Run a single system test - $ nox -s system-3.12 -- -k + $ nox -s system-3.13 -- -k .. note:: - System tests are only configured to run under Python 3.8, 3.9, 3.10, 3.11 and 3.12. + System tests are only configured to run under Python 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13. For expediency, we do not run them in older versions of Python 3. This alone will not run the tests. You'll need to change some local @@ -227,6 +227,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/ @@ -234,6 +235,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/packages/google-shopping-css/MANIFEST.in b/packages/google-shopping-css/MANIFEST.in index e0a66705318e..d6814cd60037 100644 --- a/packages/google-shopping-css/MANIFEST.in +++ b/packages/google-shopping-css/MANIFEST.in @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2023 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/packages/google-shopping-css/docs/conf.py b/packages/google-shopping-css/docs/conf.py index 77f5f4ed2b4f..33b31cb2f8e9 100644 --- a/packages/google-shopping-css/docs/conf.py +++ b/packages/google-shopping-css/docs/conf.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2023 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/packages/google-shopping-css/google/shopping/css/__init__.py b/packages/google-shopping-css/google/shopping/css/__init__.py index 2ac4a36f5f73..395a7ec472a9 100644 --- a/packages/google-shopping-css/google/shopping/css/__init__.py +++ b/packages/google-shopping-css/google/shopping/css/__init__.py @@ -61,9 +61,12 @@ Attributes, Certification, CssProductStatus, + HeadlineOfferInstallment, + HeadlineOfferSubscriptionCost, ProductDetail, ProductDimension, ProductWeight, + SubscriptionPeriod, ) from google.shopping.css_v1.types.css_product_inputs import ( CssProductInput, @@ -100,9 +103,12 @@ "Attributes", "Certification", "CssProductStatus", + "HeadlineOfferInstallment", + "HeadlineOfferSubscriptionCost", "ProductDetail", "ProductDimension", "ProductWeight", + "SubscriptionPeriod", "CssProductInput", "DeleteCssProductInputRequest", "InsertCssProductInputRequest", diff --git a/packages/google-shopping-css/google/shopping/css_v1/__init__.py b/packages/google-shopping-css/google/shopping/css_v1/__init__.py index 89e8119af60b..5f2d32904630 100644 --- a/packages/google-shopping-css/google/shopping/css_v1/__init__.py +++ b/packages/google-shopping-css/google/shopping/css_v1/__init__.py @@ -50,9 +50,12 @@ Attributes, Certification, CssProductStatus, + HeadlineOfferInstallment, + HeadlineOfferSubscriptionCost, ProductDetail, ProductDimension, ProductWeight, + SubscriptionPeriod, ) from .types.css_product_inputs import ( CssProductInput, @@ -87,6 +90,8 @@ "DeleteCssProductInputRequest", "GetAccountRequest", "GetCssProductRequest", + "HeadlineOfferInstallment", + "HeadlineOfferSubscriptionCost", "InsertCssProductInputRequest", "ListAccountLabelsRequest", "ListAccountLabelsResponse", @@ -97,6 +102,7 @@ "ProductDetail", "ProductDimension", "ProductWeight", + "SubscriptionPeriod", "UpdateAccountLabelRequest", "UpdateAccountLabelsRequest", ) diff --git a/packages/google-shopping-css/google/shopping/css_v1/services/account_labels_service/transports/rest.py b/packages/google-shopping-css/google/shopping/css_v1/services/account_labels_service/transports/rest.py index e3e5f46eb7b1..5d8eb88e7636 100644 --- a/packages/google-shopping-css/google/shopping/css_v1/services/account_labels_service/transports/rest.py +++ b/packages/google-shopping-css/google/shopping/css_v1/services/account_labels_service/transports/rest.py @@ -42,7 +42,7 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, grpc_version=None, - rest_version=requests_version, + rest_version=f"requests@{requests_version}", ) diff --git a/packages/google-shopping-css/google/shopping/css_v1/services/accounts_service/transports/rest.py b/packages/google-shopping-css/google/shopping/css_v1/services/accounts_service/transports/rest.py index 47fe6d1876d5..de86742084d7 100644 --- a/packages/google-shopping-css/google/shopping/css_v1/services/accounts_service/transports/rest.py +++ b/packages/google-shopping-css/google/shopping/css_v1/services/accounts_service/transports/rest.py @@ -41,7 +41,7 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, grpc_version=None, - rest_version=requests_version, + rest_version=f"requests@{requests_version}", ) diff --git a/packages/google-shopping-css/google/shopping/css_v1/services/css_product_inputs_service/transports/rest.py b/packages/google-shopping-css/google/shopping/css_v1/services/css_product_inputs_service/transports/rest.py index fb538000acde..4c153a42493b 100644 --- a/packages/google-shopping-css/google/shopping/css_v1/services/css_product_inputs_service/transports/rest.py +++ b/packages/google-shopping-css/google/shopping/css_v1/services/css_product_inputs_service/transports/rest.py @@ -42,7 +42,7 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, grpc_version=None, - rest_version=requests_version, + rest_version=f"requests@{requests_version}", ) diff --git a/packages/google-shopping-css/google/shopping/css_v1/services/css_products_service/transports/rest.py b/packages/google-shopping-css/google/shopping/css_v1/services/css_products_service/transports/rest.py index bb4e55782c03..02319ec999ae 100644 --- a/packages/google-shopping-css/google/shopping/css_v1/services/css_products_service/transports/rest.py +++ b/packages/google-shopping-css/google/shopping/css_v1/services/css_products_service/transports/rest.py @@ -41,7 +41,7 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, grpc_version=None, - rest_version=requests_version, + rest_version=f"requests@{requests_version}", ) diff --git a/packages/google-shopping-css/google/shopping/css_v1/types/__init__.py b/packages/google-shopping-css/google/shopping/css_v1/types/__init__.py index a820994761f7..7d7471dcbd32 100644 --- a/packages/google-shopping-css/google/shopping/css_v1/types/__init__.py +++ b/packages/google-shopping-css/google/shopping/css_v1/types/__init__.py @@ -32,9 +32,12 @@ Attributes, Certification, CssProductStatus, + HeadlineOfferInstallment, + HeadlineOfferSubscriptionCost, ProductDetail, ProductDimension, ProductWeight, + SubscriptionPeriod, ) from .css_product_inputs import ( CssProductInput, @@ -63,9 +66,12 @@ "Attributes", "Certification", "CssProductStatus", + "HeadlineOfferInstallment", + "HeadlineOfferSubscriptionCost", "ProductDetail", "ProductDimension", "ProductWeight", + "SubscriptionPeriod", "CssProductInput", "DeleteCssProductInputRequest", "InsertCssProductInputRequest", diff --git a/packages/google-shopping-css/google/shopping/css_v1/types/css_product_common.py b/packages/google-shopping-css/google/shopping/css_v1/types/css_product_common.py index ca3f7734688f..76969b4478db 100644 --- a/packages/google-shopping-css/google/shopping/css_v1/types/css_product_common.py +++ b/packages/google-shopping-css/google/shopping/css_v1/types/css_product_common.py @@ -24,16 +24,38 @@ __protobuf__ = proto.module( package="google.shopping.css.v1", manifest={ + "SubscriptionPeriod", "Attributes", "Certification", "ProductDetail", "ProductDimension", "ProductWeight", "CssProductStatus", + "HeadlineOfferSubscriptionCost", + "HeadlineOfferInstallment", }, ) +class SubscriptionPeriod(proto.Enum): + r"""The subscription period of the product. + + Values: + SUBSCRIPTION_PERIOD_UNSPECIFIED (0): + Indicates that the subscription period is + unspecified. + MONTH (1): + Indicates that the subscription period is + month. + YEAR (2): + Indicates that the subscription period is + year. + """ + SUBSCRIPTION_PERIOD_UNSPECIFIED = 0 + MONTH = 1 + YEAR = 2 + + class Attributes(proto.Message): r"""Attributes for CSS Product. @@ -255,6 +277,13 @@ class Attributes(proto.Message): in a Shopping campaign. This field is a member of `oneof`_ ``_custom_label_4``. + headline_offer_installment (google.shopping.css_v1.types.HeadlineOfferInstallment): + Number and amount of installments to pay for + an item. + headline_offer_subscription_cost (google.shopping.css_v1.types.HeadlineOfferSubscriptionCost): + Number of periods (months or years) and + amount of payment per period for an item with an + associated subscription contract. """ cpp_link: str = proto.Field( @@ -491,6 +520,16 @@ class Attributes(proto.Message): number=50, optional=True, ) + headline_offer_installment: "HeadlineOfferInstallment" = proto.Field( + proto.MESSAGE, + number=51, + message="HeadlineOfferInstallment", + ) + headline_offer_subscription_cost: "HeadlineOfferSubscriptionCost" = proto.Field( + proto.MESSAGE, + number=52, + message="HeadlineOfferSubscriptionCost", + ) class Certification(proto.Message): @@ -758,4 +797,67 @@ class ItemLevelIssue(proto.Message): ) +class HeadlineOfferSubscriptionCost(proto.Message): + r"""The SubscriptionCost of the product. + + Attributes: + period (google.shopping.css_v1.types.SubscriptionPeriod): + The type of subscription period. Supported values are: + + - "``month``" + - "``year``". + period_length (int): + The number of subscription periods the buyer + has to pay. + amount (google.shopping.type.types.Price): + The amount the buyer has to pay per + subscription period. + """ + + period: "SubscriptionPeriod" = proto.Field( + proto.ENUM, + number=1, + enum="SubscriptionPeriod", + ) + period_length: int = proto.Field( + proto.INT64, + number=2, + ) + amount: types.Price = proto.Field( + proto.MESSAGE, + number=3, + message=types.Price, + ) + + +class HeadlineOfferInstallment(proto.Message): + r"""A message that represents installment. + + Attributes: + months (int): + The number of installments the buyer has to + pay. + amount (google.shopping.type.types.Price): + The amount the buyer has to pay per month. + downpayment (google.shopping.type.types.Price): + The up-front down payment amount the buyer + has to pay. + """ + + months: int = proto.Field( + proto.INT64, + number=1, + ) + amount: types.Price = proto.Field( + proto.MESSAGE, + number=2, + message=types.Price, + ) + downpayment: types.Price = proto.Field( + proto.MESSAGE, + number=3, + message=types.Price, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-shopping-css/noxfile.py b/packages/google-shopping-css/noxfile.py index 67b7265f7586..a9ceef47133c 100644 --- a/packages/google-shopping-css/noxfile.py +++ b/packages/google-shopping-css/noxfile.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2023 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,7 +35,15 @@ DEFAULT_PYTHON_VERSION = "3.10" -UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] +UNIT_TEST_PYTHON_VERSIONS: List[str] = [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", + "3.12", + "3.13", +] UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", "asyncmock", @@ -49,7 +57,7 @@ UNIT_TEST_EXTRAS: List[str] = [] UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} -SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12"] +SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] SYSTEM_TEST_STANDARD_DEPENDENCIES = [ "mock", "pytest", @@ -168,7 +176,7 @@ def install_unittest_dependencies(session, *constraints): def unit(session, protobuf_implementation): # Install all test dependencies, then install this package in-place. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"): + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): session.skip("cpp implementation is not supported in python 3.11+") constraints_path = str( @@ -368,7 +376,7 @@ def docfx(session): ) -@nox.session(python="3.12") +@nox.session(python="3.13") @nox.parametrize( "protobuf_implementation", ["python", "upb", "cpp"], @@ -376,7 +384,7 @@ def docfx(session): def prerelease_deps(session, protobuf_implementation): """Run all tests with prerelease versions of dependencies installed.""" - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"): + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies diff --git a/packages/google-shopping-css/scripts/decrypt-secrets.sh b/packages/google-shopping-css/scripts/decrypt-secrets.sh index 0018b421ddf8..120b0ddc4364 100755 --- a/packages/google-shopping-css/scripts/decrypt-secrets.sh +++ b/packages/google-shopping-css/scripts/decrypt-secrets.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2023 Google LLC All rights reserved. +# Copyright 2024 Google LLC All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/packages/google-shopping-css/setup.py b/packages/google-shopping-css/setup.py index ab352792bba2..2a5b1cd2083f 100644 --- a/packages/google-shopping-css/setup.py +++ b/packages/google-shopping-css/setup.py @@ -44,6 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0", "proto-plus >= 1.22.3, <2.0.0dev", + "proto-plus >= 1.25.0, <2.0.0dev; python_version >= '3.13'", "protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "google-shopping-type >= 0.1.6, <1.0.0dev", ] @@ -83,6 +84,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", ], diff --git a/packages/google-shopping-css/testing/constraints-3.13.txt b/packages/google-shopping-css/testing/constraints-3.13.txt new file mode 100644 index 000000000000..4cae520d02b2 --- /dev/null +++ b/packages/google-shopping-css/testing/constraints-3.13.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +google-shopping-type diff --git a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.py b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.py index f985762cdb9b..de62ca81bcde 100644 --- a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.py +++ b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.py @@ -2495,6 +2495,16 @@ def test_insert_css_product_input_rest_call_success(request_type): "custom_label_2": "custom_label_2_value", "custom_label_3": "custom_label_3_value", "custom_label_4": "custom_label_4_value", + "headline_offer_installment": { + "months": 665, + "amount": {}, + "downpayment": {}, + }, + "headline_offer_subscription_cost": { + "period": 1, + "period_length": 1380, + "amount": {}, + }, }, "custom_attributes": [ {"name": "name_value", "value": "value_value", "group_values": {}}