Skip to content

Commit f832838

Browse files
committed
Merge remote-tracking branch 'origin/main' into typo-error
2 parents 412f959 + d426ed8 commit f832838

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+861
-58
lines changed

.kokoro/tests/run_single_test.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ else
3838
fi
3939

4040
# Use nox to execute the tests for the project.
41-
nox -s "$RUN_TESTS_SESSION"
41+
test_subdir=$(realpath --relative-to ${PROJECT_ROOT} ${PWD})
42+
pushd $PROJECT_ROOT
43+
RUN_TESTS_SESSION=${RUN_TESTS_SESSION} make test dir=${test_subdir}
4244
EXIT=$?
45+
popd
4346

4447
echo "PWD: ${PWD}"
4548

Makefile

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,37 @@
99
# dir will use repo root as working directory if not specified.
1010
dir ?= $(shell pwd)
1111
# python version: defaults to 3.11
12-
py ?= "3.11"
12+
py ?= 3.11
1313

1414
INTERFACE_ACTIONS="build test lint"
1515
repo_root = $(shell pwd)
1616
.ONESHELL: #ease subdirectory work by using the same subshell for all commands
1717
.-PHONY: *
1818

19-
# Export env vars used to determine cloud project.
20-
export GOOGLE_CLOUD_PROJECT ?= ${GOOGLE_SAMPLES_PROJECT}
21-
export BUILD_SPECIFIC_GCLOUD_PROJECT ?= ${GOOGLE_SAMPLES_PROJECT}
19+
# GOOGLE_SAMPLES_PROJECT takes precedence over GOOGLE_CLOUD_PROJECT
20+
PROJECT_ID = ${GOOGLE_SAMPLES_PROJECT}
21+
ifeq (${PROJECT_ID},)
22+
PROJECT_ID = ${GOOGLE_CLOUD_PROJECT}
23+
endif
24+
# export our project ID as GOOGLE_CLOUD_PROJECT in the action environment
25+
override GOOGLE_CLOUD_PROJECT := ${PROJECT_ID}
26+
export GOOGLE_CLOUD_PROJECT
27+
export BUILD_SPECIFIC_GCLOUD_PROJECT ?= ${PROJECT_ID}
2228

2329
build: check-env
2430
pip install nox
2531
cd ${dir}
26-
pip install -r requirements.txt
2732

2833
test: check-env build noxfile.py
34+
# kokoro uses $RUN_TESTS_SESSION to indicate which session to run.
35+
# for local use, use a suitable default.
36+
ifndef RUN_TESTS_SESSION
2937
cd ${dir}
3038
nox -s py-$(py)
39+
else
40+
cd ${dir}
41+
nox -s ${RUN_TESTS_SESSION}
42+
endif
3143

3244
lint: check-env noxfile.py
3345
pip install nox black
@@ -41,8 +53,8 @@ noxfile.py:
4153
cp -n ${repo_root}/noxfile-template.py noxfile.py
4254

4355
check-env:
44-
ifndef GOOGLE_SAMPLES_PROJECT
45-
$(error GOOGLE_SAMPLES_PROJECT must be set to the name of a GCP project to use.)
56+
ifndef PROJECT_ID
57+
$(error At least one of the following env vars must be set: GOOGLE_SAMPLES_PROJECT, GOOGLE_CLOUD_PROJECT.)
4658
endif
4759
ifndef VIRTUAL_ENV
4860
$(warning Use of a Python Virtual Environment is recommended. See README.md for details.)

appengine/flexible/twilio/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Flask==2.3.3; python_version < '3.7'
33
Werkzeug==3.0.1; python_version > '3.6'
44
Werkzeug==2.3.7; python_version < '3.7'
55
gunicorn==20.1.0
6-
twilio==8.2.1
6+
twilio==9.0.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Flask==3.0.0; python_version > '3.6'
22
Flask==2.0.3; python_version < '3.7'
33
gunicorn==20.1.0
4-
twilio==8.2.1
4+
twilio==9.0.0
55
Werkzeug==3.0.1; python_version >= '3.7'
66
Werkzeug==2.3.7; python_version < '3.7'

firestore/cloud-client/snippets.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,9 @@ def delete_full_collection():
827827

828828
# [START firestore_data_delete_collection]
829829
def delete_collection(coll_ref, batch_size):
830+
if batch_size == 0:
831+
return
832+
830833
docs = coll_ref.list_documents(page_size=batch_size)
831834
deleted = 0
832835

@@ -844,6 +847,7 @@ def delete_collection(coll_ref, batch_size):
844847
delete_collection(db.collection("data"), 10)
845848
delete_collection(db.collection("objects"), 10)
846849
delete_collection(db.collection("users"), 10)
850+
delete_collection(db.collection("users"), 0)
847851

848852

849853
def collection_group_query(db):

generative_ai/chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ def science_tutoring(temperature: float = 0.2) -> None:
4545
return response
4646

4747

48+
# [END aiplatform_sdk_chat]
4849
if __name__ == "__main__":
4950
science_tutoring()
50-
# [END aiplatform_sdk_chat]

generative_ai/classify_news_items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ def classify_news_items(temperature: float = 0.2) -> None:
6262
return response
6363

6464

65+
# [END aiplatform_sdk_classify_news_items]
6566
if __name__ == "__main__":
6667
classify_news_items()
67-
# [END aiplatform_sdk_classify_news_items]

generative_ai/classify_news_items_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
@backoff.on_exception(backoff.expo, ResourceExhausted, max_time=10)
2222
def test_classify_news_items() -> None:
2323
content = classify_news_items.classify_news_items(temperature=0).text
24-
assert content == "business"
24+
assert "business" in content

generative_ai/code_chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ def write_a_function(temperature: float = 0.5) -> object:
3636
return response
3737

3838

39+
# [END aiplatform_sdk_code_chat]
3940
if __name__ == "__main__":
4041
write_a_function()
41-
# [END aiplatform_sdk_code_chat]

generative_ai/code_completion_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ def complete_code_function(temperature: float = 0.2) -> object:
3535
return response
3636

3737

38+
# [END aiplatform_sdk_code_completion_comment]
3839
if __name__ == "__main__":
3940
complete_code_function()
40-
# [END aiplatform_sdk_code_completion_comment]

0 commit comments

Comments
 (0)