Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appengine/flexible/django_cloudsql/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django==5.0.3; python_version >= "3.10"
Django==4.2.8; python_version < "3.10"
Django==4.2.11; python_version < "3.10"
gunicorn==20.1.0
psycopg2-binary==2.9.9
django-environ==0.10.0
Expand Down
2 changes: 1 addition & 1 deletion appengine/flexible/hello_world_django/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==5.0.3; python_version >= "3.10"
Django==4.2.8; python_version >= "3.8" and python_version < "3.10"
Django==4.2.11; python_version >= "3.8" and python_version < "3.10"
Django==3.2.25; python_version < "3.8"
gunicorn==20.1.0
2 changes: 1 addition & 1 deletion appengine/flexible/twilio/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Flask==2.3.3; python_version < '3.7'
Werkzeug==3.0.1; python_version > '3.6'
Werkzeug==2.3.7; python_version < '3.7'
gunicorn==20.1.0
twilio==9.0.2
twilio==9.0.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@

TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
# An envvar key for determining the project id to use. Change it
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django==5.0.3; python_version >= "3.10"
Django==4.2.8; python_version >= "3.8" and python_version < "3.10"
Django==4.2.11; python_version >= "3.8" and python_version < "3.10"
Django==3.2.25; python_version < "3.8"
gunicorn==20.1.0
psycopg2-binary==2.9.9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==5.0.3; python_version >= "3.10"
Django==4.2.8; python_version >= "3.8" and python_version < "3.10"
Django==4.2.11; python_version >= "3.8" and python_version < "3.10"
Django==3.2.25; python_version < "3.8"
gunicorn==20.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Flask==2.0.3; python_version < '3.7'
gunicorn==20.1.0
imageio==2.29.0
numpy==1.21.6
pillow==10.0.1
pillow==10.3.0
scipy==1.7.3
Werkzeug==2.3.7
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Flask==3.0.0; python_version > '3.6'
Flask==2.0.3; python_version < '3.7'
gunicorn==20.1.0
twilio==9.0.2
twilio==9.0.3
Werkzeug==3.0.1; python_version >= '3.7'
Werkzeug==2.3.7; python_version < '3.7'
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
2 changes: 1 addition & 1 deletion bigquery-migration/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-bigquery-migration==0.11.0
google-cloud-bigquery-migration==0.11.7
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-enterpriseknowledgegraph==0.3.2
google-cloud-enterpriseknowledgegraph==0.3.9
2 changes: 1 addition & 1 deletion enterpriseknowledgegraph/search/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-enterpriseknowledgegraph==0.3.2
google-cloud-enterpriseknowledgegraph==0.3.9
4 changes: 3 additions & 1 deletion generative_ai/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
def embed_text(
texts: List[str] = ["banana muffins? ", "banana bread? banana muffins?"],
task: str = "RETRIEVAL_DOCUMENT",
model_name: str = "textembedding-gecko@003"
model_name: str = "textembedding-gecko@003",
) -> List[List[float]]:
"""Embeds texts with a pre-trained, foundational model."""
model = TextEmbeddingModel.from_pretrained(model_name)
inputs = [TextEmbeddingInput(text, task) for text in texts]
embeddings = model.get_embeddings(inputs)
return [embedding.values for embedding in embeddings]


# [END aiplatform_sdk_embedding]


Expand Down
4 changes: 3 additions & 1 deletion generative_ai/embedding_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ def embed_text(
texts: List[str] = ["banana muffins? ", "banana bread? banana muffins?"],
task: str = "QUESTION_ANSWERING",
model_name: str = "text-embedding-preview-0409",
dimensionality: Optional[int] = 256
dimensionality: Optional[int] = 256,
) -> List[List[float]]:
"""Embeds texts with a pre-trained, foundational model."""
model = TextEmbeddingModel.from_pretrained(model_name)
inputs = [TextEmbeddingInput(text, task) for text in texts]
kwargs = dict(output_dimensionality=dimensionality) if dimensionality else {}
embeddings = model.get_embeddings(inputs, **kwargs)
return [embedding.values for embedding in embeddings]


# [END generativeaionvertexai_sdk_embedding]


Expand Down
2 changes: 1 addition & 1 deletion generative_ai/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pandas==1.3.5; python_version == '3.7'
pandas==2.0.1; python_version > '3.7'
pillow==9.5.0; python_version < '3.8'
pillow==10.0.1; python_version >= '3.8'
pillow==10.3.0; python_version >= '3.8'
google-cloud-aiplatform[pipelines]==1.46.0
google-auth==2.17.3
anthropic[vertex]==0.21.3
20 changes: 20 additions & 0 deletions iap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ service account private key can impersonate that account!
```
2. Copy `validate_jwt.py` into your application.

## Using generate_self_signed_jwt

### Self-signed JWT with IAM Credentials API

1. Install the libraries listed in `requirements.txt`, e.g. by running:
```
virtualenv/bin/pip install -r requirements.txt
```
2. Call sign_jwt with service account email and target resource url.
3. Use resulting token to access application.

### Self-signed JWT with local key file
1. Install the libraries listed in `requirements.txt`, e.g. by running:
```
virtualenv/bin/pip install -r requirements.txt
```
2. Download credential file for service account
3. Call sign_jwt_with_key_file with service account email and target resource url
4. Use resulting token to access application.

## Running Tests

1. Deploy `app_engine_app` to a project.
Expand Down
2 changes: 1 addition & 1 deletion kubernetes_engine/django_tutorial/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django==5.0.3; python_version >= "3.10"
Django==4.2.8; python_version >= "3.8" and python_version < "3.10"
Django==4.2.11; python_version >= "3.8" and python_version < "3.10"
Django==3.2.25; python_version < "3.8"
# Uncomment the mysqlclient requirement if you are using MySQL rather than
# PostgreSQL. You must also have a MySQL client installed in that case.
Expand Down
4 changes: 2 additions & 2 deletions media-translation/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-media-translation==0.11.4
google-cloud-media-translation==0.11.9
pyaudio==0.2.14
six==1.16.0
six==1.16.0
2 changes: 1 addition & 1 deletion profiler/appengine/standard_python37/noxfile_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7", "3.6", "3.8", "3.9", "3.10", "3.11"],
"ignored_versions": ["2.7", "3.6", "3.8", "3.9", "3.10", "3.11", "3.12"],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
"enforce_type_hints": False,
Expand Down
2 changes: 1 addition & 1 deletion run/django/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django==5.0.3; python_version >= "3.10"
Django==4.2.8; python_version >= "3.8" and python_version < "3.10"
Django==4.2.11; python_version >= "3.8" and python_version < "3.10"
Django==3.2.25; python_version < "3.8"
django-storages[google]==1.13.2
django-environ==0.10.0
Expand Down
2 changes: 1 addition & 1 deletion video/stitcher/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-api-python-client==2.88.0
grpcio==1.59.3
google-cloud-video-stitcher==0.7.2
google-cloud-video-stitcher==0.7.9
2 changes: 1 addition & 1 deletion vision/snippets/crop_hints/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-vision==3.4.2
pillow==9.5.0; python_version < '3.8'
pillow==10.2.0; python_version >= '3.8'
pillow==10.3.0; python_version >= '3.8'
2 changes: 1 addition & 1 deletion vision/snippets/document_text/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-vision==3.4.2
pillow==9.5.0; python_version < '3.8'
pillow==10.2.0; python_version >= '3.8'
pillow==10.3.0; python_version >= '3.8'
2 changes: 1 addition & 1 deletion vision/snippets/face_detection/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-vision==3.4.2
pillow==9.5.0; python_version < '3.8'
pillow==10.2.0; python_version >= '3.8'
pillow==10.3.0; python_version >= '3.8'