diff --git a/language/v2/language_classify_gcs.py b/language/v2/language_classify_gcs.py new file mode 100644 index 00000000000..176ecf265a5 --- /dev/null +++ b/language/v2/language_classify_gcs.py @@ -0,0 +1,63 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-language + +# sample-metadata +# title: Classify Content (GCS) +# description: Classifying Content in text file stored in Cloud Storage + +# [START language_classify_gcs] +from google.cloud import language_v2 + + +def sample_classify_text( + gcs_content_uri: str = "gs://cloud-samples-data/language/classify-entertainment.txt", +) -> None: + """ + Classifies Content in text file stored in Cloud Storage. + + Args: + gcs_content_uri: Google Cloud Storage URI where the file content is located. + e.g. gs://[Your Bucket]/[Path to File]. + """ + + client = language_v2.LanguageServiceClient() + + # Available types: PLAIN_TEXT, HTML + document_type_in_plain_text = language_v2.Document.Type.PLAIN_TEXT + + # Optional. If not specified, the language is automatically detected. + # For list of supported languages: + # https://cloud.google.com/natural-language/docs/languages + language_code = "en" + document = { + "gcs_content_uri": gcs_content_uri, + "type_": document_type_in_plain_text, + "language_code": language_code, + } + + response = client.classify_text(request={"document": document}) + # Loop through classified categories returned from the API + for category in response.categories: + # Get the name of the category representing the document. + # See the predefined taxonomy of categories: + # https://cloud.google.com/natural-language/docs/categories + print(f"Category name: {category.name}") + # Get the confidence. Number representing how certain the classifier + # is that this category represents the provided text. + print(f"Confidence: {category.confidence}") +# [END language_classify_gcs] diff --git a/language/v2/language_classify_gcs_test.py b/language/v2/language_classify_gcs_test.py new file mode 100644 index 00000000000..7daf31426b5 --- /dev/null +++ b/language/v2/language_classify_gcs_test.py @@ -0,0 +1,27 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import language_classify_gcs + + +def test_sample_classify_text_gcs(capsys: ...) -> None: + assert os.environ["GOOGLE_CLOUD_PROJECT"] != "" + + language_classify_gcs.sample_classify_text() + captured = capsys.readouterr() + assert "Category name: " in captured.out + assert "Confidence: " in captured.out diff --git a/language/v2/language_classify_text.py b/language/v2/language_classify_text.py new file mode 100644 index 00000000000..eea28b9c643 --- /dev/null +++ b/language/v2/language_classify_text.py @@ -0,0 +1,62 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-language + +# sample-metadata +# title: Classify Content +# description: Classifying Content in a String + +# [START language_classify_text] +from google.cloud import language_v2 + + +def sample_classify_text( + text_content: str = "That actor on TV makes movies in Hollywood and also stars in a variety of popular new TV shows.", +) -> None: + """ + Classifies Content in a string. + + Args: + text_content: The text content to analyze. + """ + + client = language_v2.LanguageServiceClient() + + # Available types: PLAIN_TEXT, HTML + document_type_in_plain_text = language_v2.Document.Type.PLAIN_TEXT + + # Optional. If not specified, the language is automatically detected. + # For list of supported languages: + # https://cloud.google.com/natural-language/docs/languages + language_code = "en" + document = { + "content": text_content, + "type_": document_type_in_plain_text, + "language_code": language_code, + } + + response = client.classify_text(request={"document": document}) + # Loop through classified categories returned from the API + for category in response.categories: + # Get the name of the category representing the document. + # See the predefined taxonomy of categories: + # https://cloud.google.com/natural-language/docs/categories + print(f"Category name: {category.name}") + # Get the confidence. Number representing how certain the classifier + # is that this category represents the provided text. + print(f"Confidence: {category.confidence}") +# [END language_classify_text] diff --git a/language/v2/language_classify_text_test.py b/language/v2/language_classify_text_test.py new file mode 100644 index 00000000000..bb0f4577e0e --- /dev/null +++ b/language/v2/language_classify_text_test.py @@ -0,0 +1,27 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import language_classify_text + + +def test_sample_classify_text(capsys: ...) -> None: + assert os.environ["GOOGLE_CLOUD_PROJECT"] != "" + + language_classify_text.sample_classify_text() + captured = capsys.readouterr() + assert "Category name: " in captured.out + assert "Confidence: " in captured.out diff --git a/language/v2/language_entities_gcs.py b/language/v2/language_entities_gcs.py new file mode 100644 index 00000000000..62af92f3abf --- /dev/null +++ b/language/v2/language_entities_gcs.py @@ -0,0 +1,91 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-language + +# sample-metadata +# title: Analyzing Entities (GCS) +# description: Analyzing Entities in text file stored in Cloud Storage + +# [START language_entities_gcs] +from google.cloud import language_v2 + + +def sample_analyze_entities( + gcs_content_uri: str = "gs://cloud-samples-data/language/entity.txt", +) -> None: + """ + Analyzes Entities in text file stored in Cloud Storage. + + Args: + gcs_content_uri: Google Cloud Storage URI where the file content is located. + e.g. gs://[Your Bucket]/[Path to File] + """ + + client = language_v2.LanguageServiceClient() + + # Available types: PLAIN_TEXT, HTML + document_type_in_plain_text = language_v2.Document.Type.PLAIN_TEXT + + # Optional. If not specified, the language is automatically detected. + # For list of supported languages: + # https://cloud.google.com/natural-language/docs/languages + language_code = "en" + document = { + "gcs_content_uri": gcs_content_uri, + "type_": document_type_in_plain_text, + "language_code": language_code, + } + + # Available values: NONE, UTF8, UTF16, UTF32. + # See https://cloud.google.com/natural-language/docs/reference/rest/v2/EncodingType. + encoding_type = language_v2.EncodingType.UTF8 + + response = client.analyze_entities( + request={"document": document, "encoding_type": encoding_type} + ) + + for entity in response.entities: + print(f"Representative name for the entity: {entity.name}") + + # Get entity type, e.g. PERSON, LOCATION, ADDRESS, NUMBER, et al. + # See https://cloud.google.com/natural-language/docs/reference/rest/v2/Entity#type. + print(f"Entity type: {language_v2.Entity.Type(entity.type_).name}") + + # Loop over the metadata associated with entity. + # Some entity types may have additional metadata, e.g. ADDRESS entities + # may have metadata for the address street_name, postal_code, et al. + for metadata_name, metadata_value in entity.metadata.items(): + print(f"{metadata_name}: {metadata_value}") + + # Loop over the mentions of this entity in the input document. + # The API currently supports proper noun mentions. + for mention in entity.mentions: + print(f"Mention text: {mention.text.content}") + + # Get the mention type, e.g. PROPER for proper noun + print( + "Mention type:" f" {language_v2.EntityMention.Type(mention.type_).name}" + ) + + # Get the probability score associated with the first mention of the entity in the (0, 1.0] range. + print(f"Probability score: {mention.probability}") + + # Get the language of the text, which will be the same as + # the language specified in the request or, if not specified, + # the automatically-detected language. + print(f"Language of the text: {response.language_code}") +# [END language_entities_gcs] diff --git a/language/v2/language_entities_gcs_test.py b/language/v2/language_entities_gcs_test.py new file mode 100644 index 00000000000..5e7653b5ed5 --- /dev/null +++ b/language/v2/language_entities_gcs_test.py @@ -0,0 +1,31 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import language_entities_gcs + + +def test_sample_analyze_entities_gcs(capsys: ...) -> None: + assert os.environ["GOOGLE_CLOUD_PROJECT"] != "" + + language_entities_gcs.sample_analyze_entities() + captured = capsys.readouterr() + assert "Representative name for the entity: " in captured.out + assert "Entity type: " in captured.out + assert "Mention text: " in captured.out + assert "Mention type: " in captured.out + assert "Probability score: " in captured.out + assert "Language of the text: " in captured.out diff --git a/language/v2/language_entities_text.py b/language/v2/language_entities_text.py new file mode 100644 index 00000000000..8f07aa49ca4 --- /dev/null +++ b/language/v2/language_entities_text.py @@ -0,0 +1,86 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-language + +# sample-metadata +# title: Analyzing Entities +# description: Analyzing Entities in a String + +# [START language_entities_text] +from google.cloud import language_v2 + + +def sample_analyze_entities(text_content: str = "California is a state.") -> None: + """ + Analyzes Entities in a string. + + Args: + text_content: The text content to analyze + """ + + client = language_v2.LanguageServiceClient() + + # Available types: PLAIN_TEXT, HTML + document_type_in_plain_text = language_v2.Document.Type.PLAIN_TEXT + + # Optional. If not specified, the language is automatically detected. + # For list of supported languages: + # https://cloud.google.com/natural-language/docs/languages + language_code = "en" + document = { + "content": text_content, + "type_": document_type_in_plain_text, + "language_code": language_code, + } + + # Available values: NONE, UTF8, UTF16, UTF32. + # See https://cloud.google.com/natural-language/docs/reference/rest/v2/EncodingType. + encoding_type = language_v2.EncodingType.UTF8 + + response = client.analyze_entities( + request={"document": document, "encoding_type": encoding_type} + ) + + for entity in response.entities: + print(f"Representative name for the entity: {entity.name}") + + # Get entity type, e.g. PERSON, LOCATION, ADDRESS, NUMBER, et al. + # See https://cloud.google.com/natural-language/docs/reference/rest/v2/Entity#type. + print(f"Entity type: {language_v2.Entity.Type(entity.type_).name}") + + # Loop over the metadata associated with entity. + # Some entity types may have additional metadata, e.g. ADDRESS entities + # may have metadata for the address street_name, postal_code, et al. + for metadata_name, metadata_value in entity.metadata.items(): + print(f"{metadata_name}: {metadata_value}") + + # Loop over the mentions of this entity in the input document. + # The API currently supports proper noun mentions. + for mention in entity.mentions: + print(f"Mention text: {mention.text.content}") + + # Get the mention type, e.g. PROPER for proper noun + print(f"Mention type: {language_v2.EntityMention.Type(mention.type_).name}") + + # Get the probability score associated with the first mention of the entity in the (0, 1.0] range. + print(f"Probability score: {mention.probability}") + + # Get the language of the text, which will be the same as + # the language specified in the request or, if not specified, + # the automatically-detected language. + print(f"Language of the text: {response.language_code}") +# [END language_entities_text] diff --git a/language/v2/language_entities_text_test.py b/language/v2/language_entities_text_test.py new file mode 100644 index 00000000000..48933347ae6 --- /dev/null +++ b/language/v2/language_entities_text_test.py @@ -0,0 +1,31 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import language_entities_text + + +def test_sample_analyze_entities_text(capsys: ...) -> None: + assert os.environ["GOOGLE_CLOUD_PROJECT"] != "" + + language_entities_text.sample_analyze_entities() + captured = capsys.readouterr() + assert "Representative name for the entity: " in captured.out + assert "Entity type: " in captured.out + assert "Mention text: " in captured.out + assert "Mention type: " in captured.out + assert "Probability score: " in captured.out + assert "Language of the text: " in captured.out diff --git a/language/v2/language_sentiment_gcs.py b/language/v2/language_sentiment_gcs.py new file mode 100644 index 00000000000..27b24fccd94 --- /dev/null +++ b/language/v2/language_sentiment_gcs.py @@ -0,0 +1,73 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-language + +# sample-metadata +# title: Analyzing Sentiment (GCS) +# description: Analyzing Sentiment in text file stored in Cloud Storage + +# [START language_sentiment_gcs] +from google.cloud import language_v2 + + +def sample_analyze_sentiment( + gcs_content_uri: str = "gs://cloud-samples-data/language/sentiment-positive.txt", +) -> None: + """ + Analyzes Sentiment in text file stored in Cloud Storage. + + Args: + gcs_content_uri: Google Cloud Storage URI where the file content is located. + e.g. gs://[Your Bucket]/[Path to File] + """ + + client = language_v2.LanguageServiceClient() + + # Available types: PLAIN_TEXT, HTML + document_type_in_plain_text = language_v2.Document.Type.PLAIN_TEXT + + # Optional. If not specified, the language is automatically detected. + # For list of supported languages: + # https://cloud.google.com/natural-language/docs/languages + language_code = "en" + document = { + "gcs_content_uri": gcs_content_uri, + "type_": document_type_in_plain_text, + "language_code": language_code, + } + + # Available values: NONE, UTF8, UTF16, UTF32 + # See https://cloud.google.com/natural-language/docs/reference/rest/v2/EncodingType. + encoding_type = language_v2.EncodingType.UTF8 + + response = client.analyze_sentiment( + request={"document": document, "encoding_type": encoding_type} + ) + # Get overall sentiment of the input document + print(f"Document sentiment score: {response.document_sentiment.score}") + print(f"Document sentiment magnitude: {response.document_sentiment.magnitude}") + # Get sentiment for all sentences in the document + for sentence in response.sentences: + print(f"Sentence text: {sentence.text.content}") + print(f"Sentence sentiment score: {sentence.sentiment.score}") + print(f"Sentence sentiment magnitude: {sentence.sentiment.magnitude}") + + # Get the language of the text, which will be the same as + # the language specified in the request or, if not specified, + # the automatically-detected language. + print(f"Language of the text: {response.language_code}") +# [END language_sentiment_gcs] diff --git a/language/v2/language_sentiment_gcs_test.py b/language/v2/language_sentiment_gcs_test.py new file mode 100644 index 00000000000..837ee400928 --- /dev/null +++ b/language/v2/language_sentiment_gcs_test.py @@ -0,0 +1,31 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import language_sentiment_gcs + + +def test_sample_analyze_sentiment_gcs(capsys: ...) -> None: + assert os.environ["GOOGLE_CLOUD_PROJECT"] != "" + + language_sentiment_gcs.sample_analyze_sentiment() + captured = capsys.readouterr() + assert "Document sentiment score: " in captured.out + assert "Document sentiment magnitude: " in captured.out + assert "Sentence text: " in captured.out + assert "Sentence sentiment score: " in captured.out + assert "Sentence sentiment magnitude: " in captured.out + assert "Language of the text: " in captured.out diff --git a/language/v2/language_sentiment_text.py b/language/v2/language_sentiment_text.py new file mode 100644 index 00000000000..bf50a0df1cb --- /dev/null +++ b/language/v2/language_sentiment_text.py @@ -0,0 +1,72 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-language + +# sample-metadata +# title: Analyzing Sentiment +# description: Analyzing Sentiment in a String + +# [START language_sentiment_text] +from google.cloud import language_v2 + + +def sample_analyze_sentiment(text_content: str = "I am so happy and joyful.") -> None: + """ + Analyzes Sentiment in a string. + + Args: + text_content: The text content to analyze. + """ + + client = language_v2.LanguageServiceClient() + + # text_content = 'I am so happy and joyful.' + + # Available types: PLAIN_TEXT, HTML + document_type_in_plain_text = language_v2.Document.Type.PLAIN_TEXT + + # Optional. If not specified, the language is automatically detected. + # For list of supported languages: + # https://cloud.google.com/natural-language/docs/languages + language_code = "en" + document = { + "content": text_content, + "type_": document_type_in_plain_text, + "language_code": language_code, + } + + # Available values: NONE, UTF8, UTF16, UTF32 + # See https://cloud.google.com/natural-language/docs/reference/rest/v2/EncodingType. + encoding_type = language_v2.EncodingType.UTF8 + + response = client.analyze_sentiment( + request={"document": document, "encoding_type": encoding_type} + ) + # Get overall sentiment of the input document + print(f"Document sentiment score: {response.document_sentiment.score}") + print(f"Document sentiment magnitude: {response.document_sentiment.magnitude}") + # Get sentiment for all sentences in the document + for sentence in response.sentences: + print(f"Sentence text: {sentence.text.content}") + print(f"Sentence sentiment score: {sentence.sentiment.score}") + print(f"Sentence sentiment magnitude: {sentence.sentiment.magnitude}") + + # Get the language of the text, which will be the same as + # the language specified in the request or, if not specified, + # the automatically-detected language. + print(f"Language of the text: {response.language_code}") +# [END language_sentiment_text] diff --git a/language/v2/language_sentiment_text_test.py b/language/v2/language_sentiment_text_test.py new file mode 100644 index 00000000000..613135dfcad --- /dev/null +++ b/language/v2/language_sentiment_text_test.py @@ -0,0 +1,31 @@ +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import language_sentiment_text + + +def test_sample_analyze_sentiment_text(capsys: ...) -> None: + assert os.environ["GOOGLE_CLOUD_PROJECT"] != "" + + language_sentiment_text.sample_analyze_sentiment() + captured = capsys.readouterr() + assert "Document sentiment score: " in captured.out + assert "Document sentiment magnitude: " in captured.out + assert "Sentence text: " in captured.out + assert "Sentence sentiment score: " in captured.out + assert "Sentence sentiment magnitude: " in captured.out + assert "Language of the text: " in captured.out diff --git a/language/v2/noxfile_config.py b/language/v2/noxfile_config.py new file mode 100644 index 00000000000..38a32880121 --- /dev/null +++ b/language/v2/noxfile_config.py @@ -0,0 +1,42 @@ +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Default TEST_CONFIG_OVERRIDE for python repos. + +# You can copy this file into your directory, then it will be imported from +# the noxfile.py. + +# The source of truth: +# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/noxfile_config.py + +TEST_CONFIG_OVERRIDE = { + # You can opt out from the test for specific Python versions. + "ignored_versions": ["2.7", "3.7", "3.8", "3.10"], + # Old samples are opted out of enforcing Python type hints + # All new samples should feature them + "enforce_type_hints": True, + # 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 + # to use your own Cloud project. + "gcloud_project_env": "GOOGLE_CLOUD_PROJECT", + # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', + # If you need to use a specific version of pip, + # change pip_version_override to the string representation + # of the version number, for example, "20.2.4" + "pip_version_override": None, + # A dictionary you want to inject into your test. Don't put any + # secrets here. These values will override predefined values. + "envs": {}, +} diff --git a/language/v2/requirements-test.txt b/language/v2/requirements-test.txt new file mode 100644 index 00000000000..49780e03569 --- /dev/null +++ b/language/v2/requirements-test.txt @@ -0,0 +1 @@ +pytest==7.2.0 diff --git a/language/v2/requirements.txt b/language/v2/requirements.txt new file mode 100644 index 00000000000..35c9e5e4dc6 --- /dev/null +++ b/language/v2/requirements.txt @@ -0,0 +1 @@ +google-cloud-language==2.11.0