diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index fccaa8e8..889f77df 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -1,4 +1,4 @@
-# Copyright 2022 Google LLC
+# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,4 +13,4 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
- digest: sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1
+ digest: sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320
diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml
index 23000c05..8057a769 100644
--- a/.github/workflows/unittest.yml
+++ b/.github/workflows/unittest.yml
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- python: ['3.7', '3.8', '3.9', '3.10']
+ python: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout
uses: actions/checkout@v3
diff --git a/.kokoro/samples/python3.11/common.cfg b/.kokoro/samples/python3.11/common.cfg
new file mode 100644
index 00000000..2a869633
--- /dev/null
+++ b/.kokoro/samples/python3.11/common.cfg
@@ -0,0 +1,40 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.11"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-311"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-dialogflow-cx/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-dialogflow-cx/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.11/continuous.cfg b/.kokoro/samples/python3.11/continuous.cfg
new file mode 100644
index 00000000..a1c8d975
--- /dev/null
+++ b/.kokoro/samples/python3.11/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.11/periodic-head.cfg b/.kokoro/samples/python3.11/periodic-head.cfg
new file mode 100644
index 00000000..e720571b
--- /dev/null
+++ b/.kokoro/samples/python3.11/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-dialogflow-cx/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.11/periodic.cfg b/.kokoro/samples/python3.11/periodic.cfg
new file mode 100644
index 00000000..71cd1e59
--- /dev/null
+++ b/.kokoro/samples/python3.11/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
diff --git a/.kokoro/samples/python3.11/presubmit.cfg b/.kokoro/samples/python3.11/presubmit.cfg
new file mode 100644
index 00000000..a1c8d975
--- /dev/null
+++ b/.kokoro/samples/python3.11/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 2ef9a1c2..77566c0c 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.14.0"
+ ".": "1.14.1"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 869124dc..a63e466f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## [1.14.1](https://github.com/googleapis/python-dialogflow-cx/compare/v1.14.0...v1.14.1) (2023-01-06)
+
+
+### Documentation
+
+* **samples:** Update previous month logic to avoid zero-index bug in webhook_prebuilt_telecom sample ([#479](https://github.com/googleapis/python-dialogflow-cx/issues/479)) ([38c188a](https://github.com/googleapis/python-dialogflow-cx/commit/38c188ac7ec89471fdaff3981e8e66c820ff683c))
+
## [1.14.0](https://github.com/googleapis/python-dialogflow-cx/compare/v1.13.5...v1.14.0) (2022-12-15)
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 9dc661ea..790e8808 100644
--- a/CONTRIBUTING.rst
+++ b/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 and 3.10 on both UNIX and Windows.
+ 3.7, 3.8, 3.9, 3.10 and 3.11 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.10 -- -k
+ $ nox -s unit-3.11 -- -k
.. note::
@@ -225,11 +225,13 @@ We support:
- `Python 3.8`_
- `Python 3.9`_
- `Python 3.10`_
+- `Python 3.11`_
.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
+.. _Python 3.11: https://docs.python.org/3.11/
Supported versions can be found in our ``noxfile.py`` `config`_.
diff --git a/google/cloud/dialogflowcx/gapic_version.py b/google/cloud/dialogflowcx/gapic_version.py
index 624a2e53..ce4885ab 100644
--- a/google/cloud/dialogflowcx/gapic_version.py
+++ b/google/cloud/dialogflowcx/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "1.14.0" # {x-release-please-version}
+__version__ = "1.14.1" # {x-release-please-version}
diff --git a/google/cloud/dialogflowcx_v3/gapic_version.py b/google/cloud/dialogflowcx_v3/gapic_version.py
index 624a2e53..ce4885ab 100644
--- a/google/cloud/dialogflowcx_v3/gapic_version.py
+++ b/google/cloud/dialogflowcx_v3/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "1.14.0" # {x-release-please-version}
+__version__ = "1.14.1" # {x-release-please-version}
diff --git a/google/cloud/dialogflowcx_v3beta1/gapic_version.py b/google/cloud/dialogflowcx_v3beta1/gapic_version.py
index 624a2e53..ce4885ab 100644
--- a/google/cloud/dialogflowcx_v3beta1/gapic_version.py
+++ b/google/cloud/dialogflowcx_v3beta1/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "1.14.0" # {x-release-please-version}
+__version__ = "1.14.1" # {x-release-please-version}
diff --git a/noxfile.py b/noxfile.py
index 3d1da786..b4e2fc22 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -31,7 +31,7 @@
DEFAULT_PYTHON_VERSION = "3.8"
-UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
+UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
"asyncmock",
diff --git a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3.json b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3.json
index a1665584..7432d92a 100644
--- a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3.json
+++ b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3.json
@@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow-cx",
- "version": "1.14.0"
+ "version": "1.14.1"
},
"snippets": [
{
diff --git a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3beta1.json
index 9bd23dd8..74c3cf60 100644
--- a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3beta1.json
+++ b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3beta1.json
@@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow-cx",
- "version": "1.14.0"
+ "version": "1.14.1"
},
"snippets": [
{
diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py
index e8283c38..1224cbe2 100644
--- a/samples/snippets/noxfile.py
+++ b/samples/snippets/noxfile.py
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
# DO NOT EDIT - automatically generated.
# All versions used to test samples.
-ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
+ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt
index 26afa0f9..4f8bb0a9 100644
--- a/samples/snippets/requirements.txt
+++ b/samples/snippets/requirements.txt
@@ -1,2 +1,3 @@
-google-cloud-dialogflow-cx==1.13.5
+google-cloud-dialogflow-cx==1.14.0
Flask==2.2.2
+python-dateutil==2.8.2
diff --git a/samples/snippets/webhook_prebuilt_telecom.py b/samples/snippets/webhook_prebuilt_telecom.py
index c786ef17..40b1124a 100644
--- a/samples/snippets/webhook_prebuilt_telecom.py
+++ b/samples/snippets/webhook_prebuilt_telecom.py
@@ -263,6 +263,7 @@ def cxPrebuiltAgentsTelecom(request):
# based on today's date
def get_date_details(bill_state):
from datetime import date
+ from dateutil.relativedelta import relativedelta
monthNames = [
"January",
@@ -280,13 +281,15 @@ def get_date_details(bill_state):
]
today = date.today()
# index starts with 0
- first_month_name = monthNames[today.month - 1]
+ first_month_name = monthNames[(today.month - 1)]
firstDay = today.replace(day=1)
first_day_str = str(firstDay)
- last_month_name = monthNames[today.month - 2]
- last_month_first_day_str = str(today.replace(day=1, month=(today.month - 1)))
- second_last_month_name = monthNames[today.month - 3]
+ last_month_name = monthNames[(today.month - 1) - 1]
+ last_month_first_day_str = str(
+ today.replace(day=1, month=(today - relativedelta(months=1)).month)
+ )
+ second_last_month_name = monthNames[(today.month - 1) - 2]
if bill_state == "current":
return [first_month_name, first_day_str, last_month_name]
else:
diff --git a/samples/snippets/webhook_prebuilt_telecom_test.py b/samples/snippets/webhook_prebuilt_telecom_test.py
index 4a627930..b7ac9e17 100644
--- a/samples/snippets/webhook_prebuilt_telecom_test.py
+++ b/samples/snippets/webhook_prebuilt_telecom_test.py
@@ -45,7 +45,6 @@ def test_detect_customeranomaly_current(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["anomaly_detect"] == "true"
assert res["sessionInfo"]["parameters"]["total_bill"] == 1054.34
assert res["sessionInfo"]["parameters"]["first_month"] == str(
@@ -73,12 +72,11 @@ def test_detect_customeranomaly_other(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
today = date.today()
assert res["sessionInfo"]["parameters"]["anomaly_detect"] == "false"
assert res["sessionInfo"]["parameters"]["total_bill"] == 1054.34
assert res["sessionInfo"]["parameters"]["first_month"] == str(
- today.replace(day=1, month=(today.month - 1))
+ today.replace(day=1, month=1 + ((today.month - 2) % 12))
)
@@ -98,7 +96,6 @@ def test_validate_phoneline(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["phone_line_verified"] == "true"
@@ -118,7 +115,6 @@ def test_invalid_phoneline(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["phone_line_verified"] == "false"
@@ -138,7 +134,6 @@ def test_invalid_phoneline2(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["domestic_coverage"] == "true"
@@ -156,7 +151,6 @@ def test_cruiseplan_coverage(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["port_is_covered"] == "true"
@@ -174,7 +168,6 @@ def test_cruiseplan_notcovered(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["port_is_covered"] == "false"
@@ -192,7 +185,6 @@ def test_international_coverage1(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["coverage"] == "both"
@@ -210,7 +202,6 @@ def test_international_coverage2(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["coverage"] == "monthly_only"
@@ -228,7 +219,6 @@ def test_international_coverage3(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["coverage"] == "neither"
@@ -246,7 +236,6 @@ def test_cheapest_plan1(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["monthly_cost"] == 70
assert res["sessionInfo"]["parameters"]["daily_cost"] == 400
assert res["sessionInfo"]["parameters"]["suggested_plan"] == "monthly"
@@ -266,7 +255,6 @@ def test_cheapest_plan2(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["monthly_cost"] == 70
assert res["sessionInfo"]["parameters"]["daily_cost"] == 200
assert res["sessionInfo"]["parameters"]["suggested_plan"] == "monthly"
@@ -286,7 +274,6 @@ def test_cheapest_plan3(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["monthly_cost"] == 70
assert res["sessionInfo"]["parameters"]["daily_cost"] == 50
assert res["sessionInfo"]["parameters"]["suggested_plan"] == "daily"
@@ -306,7 +293,6 @@ def test_cheapest_plan4(app):
with app.test_request_context(json=request):
res = cxPrebuiltAgentsTelecom(flask.request)
- print(res)
assert res["sessionInfo"]["parameters"]["suggested_plan"] == "null"