From 968f9723a4664aa34aa294a9bd3a6baab1fc954e Mon Sep 17 00:00:00 2001 From: Averi Kitsch Date: Wed, 24 Jul 2019 14:54:53 -0700 Subject: [PATCH 01/85] Add Cloud Scheduler sample [(#1968)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1968) * scheduler sample * scheduler tutorial draft * create and delete requests completed * updated region tag * update error * fix linting * Update styling * Update license * Update license * Update license * Update license --- scheduler/snippets/README.md | 0 scheduler/snippets/app.yaml | 18 +++++++ scheduler/snippets/create_job.py | 77 +++++++++++++++++++++++++++ scheduler/snippets/create_job_test.py | 33 ++++++++++++ scheduler/snippets/main.py | 42 +++++++++++++++ scheduler/snippets/main_test.py | 45 ++++++++++++++++ scheduler/snippets/requirements.txt | 3 ++ 7 files changed, 218 insertions(+) create mode 100644 scheduler/snippets/README.md create mode 100644 scheduler/snippets/app.yaml create mode 100644 scheduler/snippets/create_job.py create mode 100644 scheduler/snippets/create_job_test.py create mode 100644 scheduler/snippets/main.py create mode 100644 scheduler/snippets/main_test.py create mode 100644 scheduler/snippets/requirements.txt diff --git a/scheduler/snippets/README.md b/scheduler/snippets/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/scheduler/snippets/app.yaml b/scheduler/snippets/app.yaml new file mode 100644 index 000000000000..8afa34736dad --- /dev/null +++ b/scheduler/snippets/app.yaml @@ -0,0 +1,18 @@ +# Copyright 2019 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. + +# [START cloud_scheduler_python_yaml] +runtime: python37 +service: my-service +# [END cloud_scheduler_python_yaml] diff --git a/scheduler/snippets/create_job.py b/scheduler/snippets/create_job.py new file mode 100644 index 000000000000..f5025ca1a349 --- /dev/null +++ b/scheduler/snippets/create_job.py @@ -0,0 +1,77 @@ +# Copyright 2019 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. + + +def create_scheduler_job(project_id, location_id, service_id): + """Create a job with an App Engine target via the Cloud Scheduler API""" + # [START cloud_scheduler_create_job] + from google.cloud import scheduler + + # Create a client. + client = scheduler.CloudSchedulerClient() + + # TODO(developer): Uncomment and set the following variables + # project_id = 'PROJECT_ID' + # location_id = 'LOCATION_ID' + # service_id = 'my-service' + + # Construct the fully qualified location path. + parent = client.location_path(project_id, location_id) + + # Construct the request body. + job = { + 'app_engine_http_target': { + 'app_engine_routing': { + 'service': service_id + }, + 'relative_uri': '/log_payload', + 'http_method': 'POST', + 'body': 'Hello World'.encode() + }, + 'schedule': '* * * * *', + 'time_zone': 'America/Los_Angeles' + } + + # Use the client to send the job creation request. + response = client.create_job(parent, job) + + print('Created job: {}'.format(response.name)) + # [END cloud_scheduler_create_job] + return response + + +def delete_scheduler_job(project_id, location_id, job_id): + """Delete a job via the Cloud Scheduler API""" + # [START cloud_scheduler_delete_job] + from google.cloud import scheduler + from google.api_core.exceptions import GoogleAPICallError + + # Create a client. + client = scheduler.CloudSchedulerClient() + + # TODO(developer): Uncomment and set the following variables + # project_id = 'PROJECT_ID' + # location_id = 'LOCATION_ID' + # job_id = 'JOB_ID' + + # Construct the fully qualified job path. + job = client.job_path(project_id, location_id, job_id) + + # Use the client to send the job deletion request. + try: + client.delete_job(job) + print("Job deleted.") + except GoogleAPICallError as e: + print("Error: %s" % e) + # [END cloud_scheduler_delete_job] diff --git a/scheduler/snippets/create_job_test.py b/scheduler/snippets/create_job_test.py new file mode 100644 index 000000000000..ab03c1b7629d --- /dev/null +++ b/scheduler/snippets/create_job_test.py @@ -0,0 +1,33 @@ +# Copyright 2019 Google Inc. 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. +# 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. + +import os + +import create_job + +TEST_PROJECT_ID = os.getenv('GCLOUD_PROJECT') +TEST_LOCATION = os.getenv('LOCATION_ID', 'us-central1') + + +def test_create_job(capsys): + create_result = create_job.create_scheduler_job( + TEST_PROJECT_ID, TEST_LOCATION, 'my-service') + out, _ = capsys.readouterr() + assert 'Created job:' in out + + job_name = create_result.name.split('/')[-1] + create_job.delete_scheduler_job(TEST_PROJECT_ID, TEST_LOCATION, job_name) + + out, _ = capsys.readouterr() + assert 'Job deleted.' in out diff --git a/scheduler/snippets/main.py b/scheduler/snippets/main.py new file mode 100644 index 000000000000..9d4d97537d27 --- /dev/null +++ b/scheduler/snippets/main.py @@ -0,0 +1,42 @@ +# Copyright 2019 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. + +"""App Engine app to serve as an endpoint for Cloud Scheduler samples.""" + +# [START cloud_scheduler_app] +from flask import Flask, request + +app = Flask(__name__) + + +# Define relative URI for job endpoint +@app.route('/log_payload', methods=['POST']) +def example_task_handler(): + """Log the job payload.""" + payload = request.get_data(as_text=True) or '(empty payload)' + print('Received job with payload: {}'.format(payload)) + return 'Printed job payload: {}'.format(payload) +# [END cloud_scheduler_app] + + +@app.route('/') +def hello(): + """Basic index to verify app is serving.""" + return 'Hello World!' + + +if __name__ == '__main__': + # This is used when running locally. Gunicorn is used to run the + # application on Google App Engine. See entrypoint in app.yaml. + app.run(host='127.0.0.1', port=8080, debug=True) diff --git a/scheduler/snippets/main_test.py b/scheduler/snippets/main_test.py new file mode 100644 index 000000000000..3d6745a5605c --- /dev/null +++ b/scheduler/snippets/main_test.py @@ -0,0 +1,45 @@ +# Copyright 2019 Google Inc. 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. +# 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. + +import pytest + + +@pytest.fixture +def app(): + import main + main.app.testing = True + return main.app.test_client() + + +def test_index(app): + r = app.get('/') + assert r.status_code == 200 + + +def test_log_payload(capsys, app): + payload = 'test_payload' + + r = app.post('/log_payload', data=payload) + assert r.status_code == 200 + + out, _ = capsys.readouterr() + assert payload in out + + +def test_empty_payload(capsys, app): + r = app.post('/log_payload') + assert r.status_code == 200 + + out, _ = capsys.readouterr() + assert 'empty payload' in out diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt new file mode 100644 index 000000000000..6fc789799aab --- /dev/null +++ b/scheduler/snippets/requirements.txt @@ -0,0 +1,3 @@ +Flask==1.0.2 +gunicorn==19.9.0 +google-cloud-scheduler==0.1.0 From b3ce5f89eee95ba4689d01e18c30a3313273a8de Mon Sep 17 00:00:00 2001 From: Gus Class Date: Mon, 7 Oct 2019 15:45:22 -0700 Subject: [PATCH 02/85] Adds updates for samples profiler ... vision [(#2439)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/2439) --- scheduler/snippets/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 6fc789799aab..ce011c6b0045 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==1.0.2 +Flask==1.1.1 gunicorn==19.9.0 -google-cloud-scheduler==0.1.0 +google-cloud-scheduler==1.2.1 From 550c788383e9a4f153639695d8e5a372f139854f Mon Sep 17 00:00:00 2001 From: DPEBot Date: Fri, 20 Dec 2019 17:41:38 -0800 Subject: [PATCH 03/85] Auto-update dependencies. [(#2005)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/2005) * Auto-update dependencies. * Revert update of appengine/flexible/datastore. * revert update of appengine/flexible/scipy * revert update of bigquery/bqml * revert update of bigquery/cloud-client * revert update of bigquery/datalab-migration * revert update of bigtable/quickstart * revert update of compute/api * revert update of container_registry/container_analysis * revert update of dataflow/run_template * revert update of datastore/cloud-ndb * revert update of dialogflow/cloud-client * revert update of dlp * revert update of functions/imagemagick * revert update of functions/ocr/app * revert update of healthcare/api-client/fhir * revert update of iam/api-client * revert update of iot/api-client/gcs_file_to_device * revert update of iot/api-client/mqtt_example * revert update of language/automl * revert update of run/image-processing * revert update of vision/automl * revert update testing/requirements.txt * revert update of vision/cloud-client/detect * revert update of vision/cloud-client/product_search * revert update of jobs/v2/api_client * revert update of jobs/v3/api_client * revert update of opencensus * revert update of translate/cloud-client * revert update to speech/cloud-client Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Co-authored-by: Doug Mahugh --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index ce011c6b0045..76053790f870 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==1.1.1 -gunicorn==19.9.0 +gunicorn==20.0.4 google-cloud-scheduler==1.2.1 From 1fa2ad7dc3fbecc1e3b0255f1f9de339187391bd Mon Sep 17 00:00:00 2001 From: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Date: Wed, 1 Apr 2020 19:11:50 -0700 Subject: [PATCH 04/85] Simplify noxfile setup. [(#2806)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/2806) * chore(deps): update dependency requests to v2.23.0 * Simplify noxfile and add version control. * Configure appengine/standard to only test Python 2.7. * Update Kokokro configs to match noxfile. * Add requirements-test to each folder. * Remove Py2 versions from everything execept appengine/standard. * Remove conftest.py. * Remove appengine/standard/conftest.py * Remove 'no-sucess-flaky-report' from pytest.ini. * Add GAE SDK back to appengine/standard tests. * Fix typo. * Roll pytest to python 2 version. * Add a bunch of testing requirements. * Remove typo. * Add appengine lib directory back in. * Add some additional requirements. * Fix issue with flake8 args. * Even more requirements. * Readd appengine conftest.py. * Add a few more requirements. * Even more Appengine requirements. * Add webtest for appengine/standard/mailgun. * Add some additional requirements. * Add workaround for issue with mailjet-rest. * Add responses for appengine/standard/mailjet. Co-authored-by: Renovate Bot --- scheduler/snippets/requirements-test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 scheduler/snippets/requirements-test.txt diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt new file mode 100644 index 000000000000..781d4326c947 --- /dev/null +++ b/scheduler/snippets/requirements-test.txt @@ -0,0 +1 @@ +pytest==5.3.2 From 1177245b1c9af8994fc9bb4a9ce4938c7e17a345 Mon Sep 17 00:00:00 2001 From: "Leah E. Cole" <6719667+leahecole@users.noreply.github.com> Date: Tue, 14 Apr 2020 12:10:24 -0700 Subject: [PATCH 05/85] update flask in scheduler [(#3403)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3403) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 76053790f870..ee7e2a0d4f76 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==1.1.1 +Flask==1.1.2 gunicorn==20.0.4 google-cloud-scheduler==1.2.1 From ad74ad0db8f085601ea17c86ab86c6b73b65eeee Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 20 May 2020 03:26:02 +0200 Subject: [PATCH 06/85] Update dependency google-cloud-scheduler to v1.3.0 [(#3840)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3840) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index ee7e2a0d4f76..4179b5a1da03 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==1.1.2 gunicorn==20.0.4 -google-cloud-scheduler==1.2.1 +google-cloud-scheduler==1.3.0 From 15cc3019bd49269fb35605be4f0a6b88b5bca05e Mon Sep 17 00:00:00 2001 From: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Date: Tue, 9 Jun 2020 14:34:27 -0700 Subject: [PATCH 07/85] Replace GCLOUD_PROJECT with GOOGLE_CLOUD_PROJECT. [(#4022)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/4022) --- scheduler/snippets/create_job_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/create_job_test.py b/scheduler/snippets/create_job_test.py index ab03c1b7629d..e6b8a0eb719b 100644 --- a/scheduler/snippets/create_job_test.py +++ b/scheduler/snippets/create_job_test.py @@ -16,7 +16,7 @@ import create_job -TEST_PROJECT_ID = os.getenv('GCLOUD_PROJECT') +TEST_PROJECT_ID = os.getenv('GOOGLE_CLOUD_PROJECT') TEST_LOCATION = os.getenv('LOCATION_ID', 'us-central1') From 14f7dcbf1ec7a9f26c8ce9fc85abdd8755c2ad6c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 13 Jul 2020 00:46:30 +0200 Subject: [PATCH 08/85] chore(deps): update dependency pytest to v5.4.3 [(#4279)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/4279) * chore(deps): update dependency pytest to v5.4.3 * specify pytest for python 2 in appengine Co-authored-by: Leah Cole --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 781d4326c947..79738af5f268 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==5.3.2 +pytest==5.4.3 From e5c8e0932f6a922e2088e3812929f0422eaf173e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 1 Aug 2020 21:51:00 +0200 Subject: [PATCH 09/85] Update dependency pytest to v6 [(#4390)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/4390) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 79738af5f268..7e460c8c866e 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==5.4.3 +pytest==6.0.1 From 6570af14c9ca148e70ed900d3aa42af60cfef94e Mon Sep 17 00:00:00 2001 From: Dan O'Meara Date: Thu, 20 Aug 2020 00:46:15 +0000 Subject: [PATCH 10/85] chore: update templates --- scheduler/snippets/noxfile.py | 224 ++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 scheduler/snippets/noxfile.py diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py new file mode 100644 index 000000000000..ba55d7ce53ca --- /dev/null +++ b/scheduler/snippets/noxfile.py @@ -0,0 +1,224 @@ +# Copyright 2019 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. + +from __future__ import print_function + +import os +from pathlib import Path +import sys + +import nox + + +# WARNING - WARNING - WARNING - WARNING - WARNING +# WARNING - WARNING - WARNING - WARNING - WARNING +# DO NOT EDIT THIS FILE EVER! +# WARNING - WARNING - WARNING - WARNING - WARNING +# WARNING - WARNING - WARNING - WARNING - WARNING + +# Copy `noxfile_config.py` to your directory and modify it instead. + + +# `TEST_CONFIG` dict is a configuration hook that allows users to +# modify the test configurations. The values here should be in sync +# with `noxfile_config.py`. Users will copy `noxfile_config.py` into +# their directory and modify it. + +TEST_CONFIG = { + # You can opt out from the test for specific Python versions. + 'ignored_versions': ["2.7"], + + # 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', + + # A dictionary you want to inject into your test. Don't put any + # secrets here. These values will override predefined values. + 'envs': {}, +} + + +try: + # Ensure we can import noxfile_config in the project's directory. + sys.path.append('.') + from noxfile_config import TEST_CONFIG_OVERRIDE +except ImportError as e: + print("No user noxfile_config found: detail: {}".format(e)) + TEST_CONFIG_OVERRIDE = {} + +# Update the TEST_CONFIG with the user supplied values. +TEST_CONFIG.update(TEST_CONFIG_OVERRIDE) + + +def get_pytest_env_vars(): + """Returns a dict for pytest invocation.""" + ret = {} + + # Override the GCLOUD_PROJECT and the alias. + env_key = TEST_CONFIG['gcloud_project_env'] + # This should error out if not set. + ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key] + + # Apply user supplied envs. + ret.update(TEST_CONFIG['envs']) + return ret + + +# DO NOT EDIT - automatically generated. +# All versions used to tested samples. +ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"] + +# Any default versions that should be ignored. +IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] + +TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) + +INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False)) +# +# Style Checks +# + + +def _determine_local_import_names(start_dir): + """Determines all import names that should be considered "local". + + This is used when running the linter to insure that import order is + properly checked. + """ + file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)] + return [ + basename + for basename, extension in file_ext_pairs + if extension == ".py" + or os.path.isdir(os.path.join(start_dir, basename)) + and basename not in ("__pycache__") + ] + + +# Linting with flake8. +# +# We ignore the following rules: +# E203: whitespace before ‘:’ +# E266: too many leading ‘#’ for block comment +# E501: line too long +# I202: Additional newline in a section of imports +# +# We also need to specify the rules which are ignored by default: +# ['E226', 'W504', 'E126', 'E123', 'W503', 'E24', 'E704', 'E121'] +FLAKE8_COMMON_ARGS = [ + "--show-source", + "--builtin=gettext", + "--max-complexity=20", + "--import-order-style=google", + "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py", + "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202", + "--max-line-length=88", +] + + +@nox.session +def lint(session): + session.install("flake8", "flake8-import-order") + + local_names = _determine_local_import_names(".") + args = FLAKE8_COMMON_ARGS + [ + "--application-import-names", + ",".join(local_names), + "." + ] + session.run("flake8", *args) + + +# +# Sample Tests +# + + +PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] + + +def _session_tests(session, post_install=None): + """Runs py.test for a particular project.""" + if os.path.exists("requirements.txt"): + session.install("-r", "requirements.txt") + + if os.path.exists("requirements-test.txt"): + session.install("-r", "requirements-test.txt") + + if INSTALL_LIBRARY_FROM_SOURCE: + session.install("-e", _get_repo_root()) + + if post_install: + post_install(session) + + session.run( + "pytest", + *(PYTEST_COMMON_ARGS + session.posargs), + # Pytest will return 5 when no tests are collected. This can happen + # on travis where slow and flaky tests are excluded. + # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html + success_codes=[0, 5], + env=get_pytest_env_vars() + ) + + +@nox.session(python=ALL_VERSIONS) +def py(session): + """Runs py.test for a sample using the specified version of Python.""" + if session.python in TESTED_VERSIONS: + _session_tests(session) + else: + session.skip("SKIPPED: {} tests are disabled for this sample.".format( + session.python + )) + + +# +# Readmegen +# + + +def _get_repo_root(): + """ Returns the root folder of the project. """ + # Get root of this repository. Assume we don't have directories nested deeper than 10 items. + p = Path(os.getcwd()) + for i in range(10): + if p is None: + break + if Path(p / ".git").exists(): + return str(p) + p = p.parent + raise Exception("Unable to detect repository root.") + + +GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")]) + + +@nox.session +@nox.parametrize("path", GENERATED_READMES) +def readmegen(session, path): + """(Re-)generates the readme for a sample.""" + session.install("jinja2", "pyyaml") + dir_ = os.path.dirname(path) + + if os.path.exists(os.path.join(dir_, "requirements.txt")): + session.install("-r", os.path.join(dir_, "requirements.txt")) + + in_file = os.path.join(dir_, "README.rst.in") + session.run( + "python", _get_repo_root() + "/scripts/readme-gen/readme_gen.py", in_file + ) From 46f68055109bfbd28f05b0cdd3771b9b7b992c29 Mon Sep 17 00:00:00 2001 From: Dan O'Meara Date: Thu, 27 Aug 2020 12:15:44 -0700 Subject: [PATCH 11/85] feat!: migrate to microgenerator (#29) * feat!: migrate to microgenerator * chore: lint and coverage fixes * chore: uses correct method in example Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- scheduler/snippets/create_job.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scheduler/snippets/create_job.py b/scheduler/snippets/create_job.py index f5025ca1a349..646a89780e73 100644 --- a/scheduler/snippets/create_job.py +++ b/scheduler/snippets/create_job.py @@ -27,7 +27,7 @@ def create_scheduler_job(project_id, location_id, service_id): # service_id = 'my-service' # Construct the fully qualified location path. - parent = client.location_path(project_id, location_id) + parent = f"projects/{project_id}/locations/{location_id}" # Construct the request body. job = { @@ -36,7 +36,7 @@ def create_scheduler_job(project_id, location_id, service_id): 'service': service_id }, 'relative_uri': '/log_payload', - 'http_method': 'POST', + 'http_method': 1, 'body': 'Hello World'.encode() }, 'schedule': '* * * * *', @@ -44,7 +44,12 @@ def create_scheduler_job(project_id, location_id, service_id): } # Use the client to send the job creation request. - response = client.create_job(parent, job) + response = client.create_job( + request={ + "parent": parent, + "job": job + } + ) print('Created job: {}'.format(response.name)) # [END cloud_scheduler_create_job] @@ -66,11 +71,11 @@ def delete_scheduler_job(project_id, location_id, job_id): # job_id = 'JOB_ID' # Construct the fully qualified job path. - job = client.job_path(project_id, location_id, job_id) + job = f"projects/{project_id}/locations/{location_id}/jobs/{job_id}" # Use the client to send the job deletion request. try: - client.delete_job(job) + client.delete_job(name=job) print("Job deleted.") except GoogleAPICallError as e: print("Error: %s" % e) From f70f153861127d82ef26ca47dbd636dc8bca8506 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 16 Oct 2020 21:56:06 +0200 Subject: [PATCH 12/85] chore(deps): update dependency google-cloud-scheduler to v2 (#32) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Update | Change | |---|---|---| | [google-cloud-scheduler](https://togithub.com/googleapis/python-scheduler) | major | `==1.3.0` -> `==2.0.0` | --- ### Release Notes
googleapis/python-scheduler ### [`v2.0.0`](https://togithub.com/googleapis/python-scheduler/blob/master/CHANGELOG.md#​200-httpswwwgithubcomgoogleapispython-schedulercomparev130v200-2020-08-27) [Compare Source](https://togithub.com/googleapis/python-scheduler/compare/v1.3.0...v2.0.0) ##### ⚠ BREAKING CHANGES - migrate to microgenerator ([#​29](https://togithub.com/googleapis/python-scheduler/issues/29)) ##### Features - migrate to microgenerator ([#​29](https://www.github.com/googleapis/python-scheduler/issues/29)) ([82f66ed](https://www.github.com/googleapis/python-scheduler/commit/82f66ed9c163b2f6597bf5661469ca9ca1bef741)) ##### Bug Fixes - update retry configs ([#​20](https://www.github.com/googleapis/python-scheduler/issues/20)) ([7f82c9f](https://www.github.com/googleapis/python-scheduler/commit/7f82c9ffc292d72907de66bf6d5fa39e38d26085))
--- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-scheduler). --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 4179b5a1da03..69e717f3f3db 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==1.1.2 gunicorn==20.0.4 -google-cloud-scheduler==1.3.0 +google-cloud-scheduler==2.0.0 From 9e60c5ef81426adf5e98307efb4fc3a0b7a73f50 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 8 Dec 2020 15:36:31 -0800 Subject: [PATCH 13/85] chore: update templates (#44) --- scheduler/snippets/noxfile.py | 39 ++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index ba55d7ce53ca..bca0522ec4d9 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -17,6 +17,7 @@ import os from pathlib import Path import sys +from typing import Callable, Dict, List, Optional import nox @@ -39,6 +40,10 @@ # You can opt out from the test for specific Python versions. 'ignored_versions': ["2.7"], + # 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 @@ -64,7 +69,7 @@ TEST_CONFIG.update(TEST_CONFIG_OVERRIDE) -def get_pytest_env_vars(): +def get_pytest_env_vars() -> Dict[str, str]: """Returns a dict for pytest invocation.""" ret = {} @@ -93,7 +98,7 @@ def get_pytest_env_vars(): # -def _determine_local_import_names(start_dir): +def _determine_local_import_names(start_dir: str) -> List[str]: """Determines all import names that should be considered "local". This is used when running the linter to insure that import order is @@ -131,8 +136,11 @@ def _determine_local_import_names(start_dir): @nox.session -def lint(session): - session.install("flake8", "flake8-import-order") +def lint(session: nox.sessions.Session) -> None: + if not TEST_CONFIG['enforce_type_hints']: + session.install("flake8", "flake8-import-order") + else: + session.install("flake8", "flake8-import-order", "flake8-annotations") local_names = _determine_local_import_names(".") args = FLAKE8_COMMON_ARGS + [ @@ -141,8 +149,18 @@ def lint(session): "." ] session.run("flake8", *args) +# +# Black +# +@nox.session +def blacken(session: nox.sessions.Session) -> None: + session.install("black") + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + session.run("black", *python_files) + # # Sample Tests # @@ -151,7 +169,7 @@ def lint(session): PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] -def _session_tests(session, post_install=None): +def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None: """Runs py.test for a particular project.""" if os.path.exists("requirements.txt"): session.install("-r", "requirements.txt") @@ -177,7 +195,7 @@ def _session_tests(session, post_install=None): @nox.session(python=ALL_VERSIONS) -def py(session): +def py(session: nox.sessions.Session) -> None: """Runs py.test for a sample using the specified version of Python.""" if session.python in TESTED_VERSIONS: _session_tests(session) @@ -192,7 +210,7 @@ def py(session): # -def _get_repo_root(): +def _get_repo_root() -> Optional[str]: """ Returns the root folder of the project. """ # Get root of this repository. Assume we don't have directories nested deeper than 10 items. p = Path(os.getcwd()) @@ -201,6 +219,11 @@ def _get_repo_root(): break if Path(p / ".git").exists(): return str(p) + # .git is not available in repos cloned via Cloud Build + # setup.py is always in the library's root, so use that instead + # https://github.com/googleapis/synthtool/issues/792 + if Path(p / "setup.py").exists(): + return str(p) p = p.parent raise Exception("Unable to detect repository root.") @@ -210,7 +233,7 @@ def _get_repo_root(): @nox.session @nox.parametrize("path", GENERATED_READMES) -def readmegen(session, path): +def readmegen(session: nox.sessions.Session, path: str) -> None: """(Re-)generates the readme for a sample.""" session.install("jinja2", "pyyaml") dir_ = os.path.dirname(path) From ce8c20642cadf901525c1469cc42a1a10c6abc18 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 9 Dec 2020 02:19:47 +0100 Subject: [PATCH 14/85] chore(deps): update dependency google-cloud-scheduler to v2.1.0 (#45) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 69e717f3f3db..430f241bce0f 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==1.1.2 gunicorn==20.0.4 -google-cloud-scheduler==2.0.0 +google-cloud-scheduler==2.1.0 From 16f8aa4bd8f5c876b6be0b71b36fe0b04b1616cd Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 5 Mar 2021 03:42:58 +0100 Subject: [PATCH 15/85] chore(deps): update dependency google-cloud-scheduler to v2.1.1 (#64) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 430f241bce0f..cc1fdb07b7fb 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==1.1.2 gunicorn==20.0.4 -google-cloud-scheduler==2.1.0 +google-cloud-scheduler==2.1.1 From 06f4f7b92de5a5bde23048c06ea3733b3d68b7db Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 27 Mar 2021 05:09:45 +0100 Subject: [PATCH 16/85] chore(deps): update dependency gunicorn to v20.1.0 (#69) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index cc1fdb07b7fb..0b948685deb8 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==1.1.2 -gunicorn==20.0.4 +gunicorn==20.1.0 google-cloud-scheduler==2.1.1 From 0d5787cb01705aed3821440da6d9757bc3bd539e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 30 Mar 2021 12:18:09 -0700 Subject: [PATCH 17/85] feat: add `from_service_account_info` (#67) * chore: upgrade gapic-generator-python to 0.39.1 fix: fix sphinx identifiers PiperOrigin-RevId: 350246057 Source-Author: Google APIs Source-Date: Tue Jan 5 16:44:11 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 520682435235d9c503983a360a2090025aa47cd1 Source-Link: https://github.com/googleapis/googleapis/commit/520682435235d9c503983a360a2090025aa47cd1 * chore: update Go generator, rules_go, and protobuf PiperOrigin-RevId: 352816749 Source-Author: Google APIs Source-Date: Wed Jan 20 10:06:23 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: ceaaf31b3d13badab7cf9d3b570f5639db5593d9 Source-Link: https://github.com/googleapis/googleapis/commit/ceaaf31b3d13badab7cf9d3b570f5639db5593d9 * chore: upgrade gapic-generator-python to 0.40.5 PiperOrigin-RevId: 354996675 Source-Author: Google APIs Source-Date: Mon Feb 1 12:11:49 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 20712b8fe95001b312f62c6c5f33e3e3ec92cfaf Source-Link: https://github.com/googleapis/googleapis/commit/20712b8fe95001b312f62c6c5f33e3e3ec92cfaf * chore: update gapic-generator-python PiperOrigin-RevId: 355923884 Source-Author: Google APIs Source-Date: Fri Feb 5 14:04:52 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 5e3dacee19405529b841b53797df799c2383536c Source-Link: https://github.com/googleapis/googleapis/commit/5e3dacee19405529b841b53797df799c2383536c * chore: update gapic-generator-python to 0.40.11 PiperOrigin-RevId: 359562873 Source-Author: Google APIs Source-Date: Thu Feb 25 10:52:32 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 07932bb995e7dc91b43620ea8402c6668c7d102c Source-Link: https://github.com/googleapis/googleapis/commit/07932bb995e7dc91b43620ea8402c6668c7d102c * chore: upgrade gapic-generator-python to 0.42.2 PiperOrigin-RevId: 361662015 Source-Author: Google APIs Source-Date: Mon Mar 8 14:47:18 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 28a591963253d52ce3a25a918cafbdd9928de8cf Source-Link: https://github.com/googleapis/googleapis/commit/28a591963253d52ce3a25a918cafbdd9928de8cf * chore: upgrade gapic-generator-python to 0.43.1 PiperOrigin-RevId: 364411656 Source-Author: Google APIs Source-Date: Mon Mar 22 14:40:22 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 149a3a84c29c9b8189576c7442ccb6dcf6a8f95b Source-Link: https://github.com/googleapis/googleapis/commit/149a3a84c29c9b8189576c7442ccb6dcf6a8f95b * chore: regen Co-authored-by: Bu Sun Kim --- scheduler/snippets/noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index bca0522ec4d9..97bf7da80e39 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -85,7 +85,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to tested samples. -ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"] +ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] From 63519f5ee79bb2dd0f6f7db0765a67a47848dd32 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 1 Apr 2021 19:26:26 +0200 Subject: [PATCH 18/85] chore(deps): update dependency google-cloud-scheduler to v2.2.0 (#72) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 0b948685deb8..5838fa3e580c 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==1.1.2 gunicorn==20.1.0 -google-cloud-scheduler==2.1.1 +google-cloud-scheduler==2.2.0 From a53f45baf5e92a41eb76e18f191a94e215649458 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 May 2021 11:13:11 -0400 Subject: [PATCH 19/85] chore: migrate to owl bot (#82) * chore: migrate to owl bot * chore: copy files from googleapis-gen dfccedc726d558444c665121fb5c1d08a5978e94 * chore: run the post processor --- scheduler/snippets/noxfile.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 97bf7da80e39..956cdf4f9250 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -172,10 +172,16 @@ def blacken(session: nox.sessions.Session) -> None: def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None: """Runs py.test for a particular project.""" if os.path.exists("requirements.txt"): - session.install("-r", "requirements.txt") + if os.path.exists("constraints.txt"): + session.install("-r", "requirements.txt", "-c", "constraints.txt") + else: + session.install("-r", "requirements.txt") if os.path.exists("requirements-test.txt"): - session.install("-r", "requirements-test.txt") + if os.path.exists("constraints-test.txt"): + session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") + else: + session.install("-r", "requirements-test.txt") if INSTALL_LIBRARY_FROM_SOURCE: session.install("-e", _get_repo_root()) From 1aeabac6f10eef766dc2708604fc56b41b4067f7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 14 May 2021 03:01:43 +0200 Subject: [PATCH 20/85] chore(deps): update dependency flask to v1.1.3 (#87) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 5838fa3e580c..7e40ee42d12d 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==1.1.2 +Flask==1.1.3 gunicorn==20.1.0 google-cloud-scheduler==2.2.0 From b70b6a8124c095cb1085356f4de03dc84babfb85 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 14 May 2021 03:03:20 +0200 Subject: [PATCH 21/85] chore(deps): update dependency pytest to v6.2.4 (#85) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 7e460c8c866e..95ea1e6a02b0 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==6.0.1 +pytest==6.2.4 From c10480ffd2b35690ab8af0de63cb0f77f6c39241 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 14 May 2021 03:13:55 +0200 Subject: [PATCH 22/85] chore(deps): update dependency flask to v2 (#83) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 7e40ee42d12d..fc6ce7d5174c 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==1.1.3 +Flask==2.0.0 gunicorn==20.1.0 google-cloud-scheduler==2.2.0 From ec1dfc478278dae071e9fd484cc32ff35420da73 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 21 May 2021 18:13:56 +0200 Subject: [PATCH 23/85] chore(deps): update dependency flask to v2.0.1 (#92) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index fc6ce7d5174c..fe1cf64a0785 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.0.0 +Flask==2.0.1 gunicorn==20.1.0 google-cloud-scheduler==2.2.0 From cb7e2248a4db69e726fdb89be733177203c17406 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 22 May 2021 09:18:21 +0000 Subject: [PATCH 24/85] chore: new owl bot post processor docker image (#94) gcr.io/repo-automation-bots/owlbot-python:latest@sha256:3c3a445b3ddc99ccd5d31edc4b4519729635d20693900db32c4f587ed51f7479 --- scheduler/snippets/noxfile.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 956cdf4f9250..5ff9e1db5808 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -50,7 +50,10 @@ # 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': {}, @@ -170,6 +173,9 @@ def blacken(session: nox.sessions.Session) -> None: def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None: + if TEST_CONFIG["pip_version_override"]: + pip_version = TEST_CONFIG["pip_version_override"] + session.install(f"pip=={pip_version}") """Runs py.test for a particular project.""" if os.path.exists("requirements.txt"): if os.path.exists("constraints.txt"): From 55f24a1e522f11aa72a163b3f60b27c35eb3f9fd Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 3 Jul 2021 13:36:22 +0200 Subject: [PATCH 25/85] chore(deps): update dependency google-cloud-scheduler to v2.3.0 (#107) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-scheduler](https://togithub.com/googleapis/python-scheduler) | `==2.2.0` -> `==2.3.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.0/compatibility-slim/2.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.0/confidence-slim/2.2.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/python-scheduler ### [`v2.3.0`](https://togithub.com/googleapis/python-scheduler/blob/master/CHANGELOG.md#​230-httpswwwgithubcomgoogleapispython-schedulercomparev220v230-2021-07-01) [Compare Source](https://togithub.com/googleapis/python-scheduler/compare/v2.2.0...v2.3.0) ##### Features - add always_use_jwt_access ([#​102](https://www.github.com/googleapis/python-scheduler/issues/102)) ([bd5550b](https://www.github.com/googleapis/python-scheduler/commit/bd5550b4c7732ad20c5a16fa0ac2c9f86704b8fc)) ##### Bug Fixes - **deps:** add packaging requirement ([#​89](https://www.github.com/googleapis/python-scheduler/issues/89)) ([8966559](https://www.github.com/googleapis/python-scheduler/commit/8966559b7bf2e4409906ca4a5eb831a011ba3484)) - disable always_use_jwt_access ([#​106](https://www.github.com/googleapis/python-scheduler/issues/106)) ([c8dd497](https://www.github.com/googleapis/python-scheduler/commit/c8dd497c56f475c63c05c2ba5708067cc03c4173)) ##### Documentation - omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#​1127](https://www.github.com/googleapis/python-scheduler/issues/1127)) ([#​99](https://www.github.com/googleapis/python-scheduler/issues/99)) ([2dcbcdf](https://www.github.com/googleapis/python-scheduler/commit/2dcbcdf36c7678ee62d2b76ea31bee69f597d3b2)), closes [#​1126](https://www.github.com/googleapis/python-scheduler/issues/1126)
--- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-scheduler). --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index fe1cf64a0785..79b7d6a55f77 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.1 gunicorn==20.1.0 -google-cloud-scheduler==2.2.0 +google-cloud-scheduler==2.3.0 From 3b4dd7dcbc109c5f5352f2c7fa4c8f099a345ce0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 22 Jul 2021 13:50:39 +0000 Subject: [PATCH 26/85] feat: add Samples section to CONTRIBUTING.rst (#111) Source-Link: https://github.com/googleapis/synthtool/commit/52e4e46eff2a0b70e3ff5506a02929d089d077d4 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:6186535cbdbf6b9fe61f00294929221d060634dae4a0795c1cefdbc995b2d605 --- scheduler/snippets/noxfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 5ff9e1db5808..6a8ccdae22c9 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -28,8 +28,9 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -# Copy `noxfile_config.py` to your directory and modify it instead. +BLACK_VERSION = "black==19.10b0" +# Copy `noxfile_config.py` to your directory and modify it instead. # `TEST_CONFIG` dict is a configuration hook that allows users to # modify the test configurations. The values here should be in sync @@ -159,7 +160,7 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: - session.install("black") + session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) From fbaf3f43854a20aa4dd07eb1a1f53719343bb466 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 22 Jul 2021 16:02:28 +0200 Subject: [PATCH 27/85] chore(deps): update dependency google-cloud-scheduler to v2.3.1 (#113) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-scheduler](https://togithub.com/googleapis/python-scheduler) | `==2.3.0` -> `==2.3.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.1/compatibility-slim/2.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.1/confidence-slim/2.3.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/python-scheduler ### [`v2.3.1`](https://togithub.com/googleapis/python-scheduler/blob/master/CHANGELOG.md#​231-httpswwwgithubcomgoogleapispython-schedulercomparev230v231-2021-07-20) [Compare Source](https://togithub.com/googleapis/python-scheduler/compare/v2.3.0...v2.3.1)
--- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-scheduler). --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 79b7d6a55f77..f777207ecfe8 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.1 gunicorn==20.1.0 -google-cloud-scheduler==2.3.0 +google-cloud-scheduler==2.3.1 From c8b896ffd84a06fb7e855d9d2d0420e0c993fd41 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 29 Jul 2021 13:03:58 +0200 Subject: [PATCH 28/85] chore(deps): update dependency google-cloud-scheduler to v2.3.2 (#119) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index f777207ecfe8..1a3c50e8e0ab 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.1 gunicorn==20.1.0 -google-cloud-scheduler==2.3.1 +google-cloud-scheduler==2.3.2 From 6781a8e9741a7e763c47ad6e657ae93863be2b52 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 11 Aug 2021 16:32:39 +0000 Subject: [PATCH 29/85] chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py (#121) Source-Link: https://github.com/googleapis/synthtool/commit/6252f2cd074c38f37b44abe5e96d128733eb1b61 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:50e35228649c47b6ca82aa0be3ff9eb2afce51c82b66c4a03fe4afeb5ff6c0fc --- scheduler/snippets/noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 6a8ccdae22c9..125bb619cc49 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -96,7 +96,7 @@ def get_pytest_env_vars() -> Dict[str, str]: TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) -INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False)) +INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true") # # Style Checks # From e293c92d968f53dbb6515ddd943a918a04e62683 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 13 Aug 2021 16:06:14 +0000 Subject: [PATCH 30/85] chore: drop mention of Python 2.7 from templates (#123) Source-Link: https://github.com/googleapis/synthtool/commit/facee4cc1ea096cd8bcc008bb85929daa7c414c0 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803 --- scheduler/snippets/noxfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 125bb619cc49..e73436a15626 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -39,7 +39,7 @@ TEST_CONFIG = { # You can opt out from the test for specific Python versions. - 'ignored_versions': ["2.7"], + 'ignored_versions': [], # Old samples are opted out of enforcing Python type hints # All new samples should feature them @@ -88,8 +88,8 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. -# All versions used to tested samples. -ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"] +# All versions used to test samples. +ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] From 5ea3801c3fe1281459b1802b2b50d7a6829f9fdb Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 31 Aug 2021 17:02:14 +0200 Subject: [PATCH 31/85] chore(deps): update dependency pytest to v6.2.5 (#128) Co-authored-by: Anthonios Partheniou --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 95ea1e6a02b0..927094516e65 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==6.2.4 +pytest==6.2.5 From 27a3549839a100677f3b623e80fb89e6465f5d03 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 17 Sep 2021 15:36:52 +0000 Subject: [PATCH 32/85] chore: blacken samples noxfile template (#132) --- scheduler/snippets/noxfile.py | 44 ++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index e73436a15626..b008613f03ff 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -39,17 +39,15 @@ TEST_CONFIG = { # You can opt out from the test for specific Python versions. - 'ignored_versions': [], - + "ignored_versions": [], # Old samples are opted out of enforcing Python type hints # All new samples should feature them - 'enforce_type_hints': False, - + "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 # to use your own Cloud project. - 'gcloud_project_env': 'GOOGLE_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 @@ -57,13 +55,13 @@ "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': {}, + "envs": {}, } try: # Ensure we can import noxfile_config in the project's directory. - sys.path.append('.') + sys.path.append(".") from noxfile_config import TEST_CONFIG_OVERRIDE except ImportError as e: print("No user noxfile_config found: detail: {}".format(e)) @@ -78,12 +76,12 @@ def get_pytest_env_vars() -> Dict[str, str]: ret = {} # Override the GCLOUD_PROJECT and the alias. - env_key = TEST_CONFIG['gcloud_project_env'] + env_key = TEST_CONFIG["gcloud_project_env"] # This should error out if not set. - ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key] + ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key] # Apply user supplied envs. - ret.update(TEST_CONFIG['envs']) + ret.update(TEST_CONFIG["envs"]) return ret @@ -92,11 +90,14 @@ def get_pytest_env_vars() -> Dict[str, str]: ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] # Any default versions that should be ignored. -IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] +IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) -INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true") +INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ( + "True", + "true", +) # # Style Checks # @@ -141,7 +142,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]: @nox.session def lint(session: nox.sessions.Session) -> None: - if not TEST_CONFIG['enforce_type_hints']: + if not TEST_CONFIG["enforce_type_hints"]: session.install("flake8", "flake8-import-order") else: session.install("flake8", "flake8-import-order", "flake8-annotations") @@ -150,9 +151,11 @@ def lint(session: nox.sessions.Session) -> None: args = FLAKE8_COMMON_ARGS + [ "--application-import-names", ",".join(local_names), - "." + ".", ] session.run("flake8", *args) + + # # Black # @@ -165,6 +168,7 @@ def blacken(session: nox.sessions.Session) -> None: session.run("black", *python_files) + # # Sample Tests # @@ -173,7 +177,9 @@ def blacken(session: nox.sessions.Session) -> None: PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] -def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None: +def _session_tests( + session: nox.sessions.Session, post_install: Callable = None +) -> None: if TEST_CONFIG["pip_version_override"]: pip_version = TEST_CONFIG["pip_version_override"] session.install(f"pip=={pip_version}") @@ -203,7 +209,7 @@ def _session_tests(session: nox.sessions.Session, post_install: Callable = None) # on travis where slow and flaky tests are excluded. # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html success_codes=[0, 5], - env=get_pytest_env_vars() + env=get_pytest_env_vars(), ) @@ -213,9 +219,9 @@ def py(session: nox.sessions.Session) -> None: if session.python in TESTED_VERSIONS: _session_tests(session) else: - session.skip("SKIPPED: {} tests are disabled for this sample.".format( - session.python - )) + session.skip( + "SKIPPED: {} tests are disabled for this sample.".format(session.python) + ) # From 0ff898dfc32a73cb70587360243a6fc01eb4e1fc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 27 Sep 2021 19:48:29 +0200 Subject: [PATCH 33/85] chore(deps): update dependency google-cloud-scheduler to v2.3.3 (#137) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 1a3c50e8e0ab..bfce1fde4f6c 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.1 gunicorn==20.1.0 -google-cloud-scheduler==2.3.2 +google-cloud-scheduler==2.3.3 From c126e4fef4ed9d8b97148cc23aae4b033dda0bad Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 15:56:16 +0000 Subject: [PATCH 34/85] chore: fail samples nox session if python version is missing (#140) --- scheduler/snippets/noxfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index b008613f03ff..1fd8956fbf01 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -98,6 +98,10 @@ def get_pytest_env_vars() -> Dict[str, str]: "True", "true", ) + +# Error if a python version is missing +nox.options.error_on_missing_interpreters = True + # # Style Checks # From a91d7485bd4434d231c8c72601fb8e22198330cd Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 30 Sep 2021 19:10:14 +0200 Subject: [PATCH 35/85] chore(deps): update dependency google-cloud-scheduler to v2.3.4 (#141) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-scheduler](https://togithub.com/googleapis/python-scheduler) | `==2.3.3` -> `==2.3.4` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.4/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.4/compatibility-slim/2.3.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-scheduler/2.3.4/confidence-slim/2.3.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/python-scheduler ### [`v2.3.4`](https://togithub.com/googleapis/python-scheduler/blob/master/CHANGELOG.md#​234-httpswwwgithubcomgoogleapispython-schedulercomparev233v234-2021-09-30) [Compare Source](https://togithub.com/googleapis/python-scheduler/compare/v2.3.3...v2.3.4)
--- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-scheduler). --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index bfce1fde4f6c..ff1ce36af66d 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.1 gunicorn==20.1.0 -google-cloud-scheduler==2.3.3 +google-cloud-scheduler==2.3.4 From 5c935a8a80f05a91ea3597cf5ba4a5ec88e33955 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 13:16:44 -0400 Subject: [PATCH 36/85] chore(python): Add kokoro configs for python 3.10 samples testing (#147) Source-Link: https://github.com/googleapis/synthtool/commit/c6e69c4726a233ad8d496961ec265d29e54010b7 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b Co-authored-by: Owl Bot --- scheduler/snippets/noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 1fd8956fbf01..93a9122cc457 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -87,7 +87,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to test samples. -ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] From da79254efdb4b6065153423181f170e1f978fb1c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 8 Oct 2021 19:40:10 +0200 Subject: [PATCH 37/85] chore(deps): update dependency flask to v2.0.2 (#142) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [Flask](https://palletsprojects.com/p/flask) ([changelog](https://flask.palletsprojects.com/changes/)) | `==2.0.1` -> `==2.0.2` | [![age](https://badges.renovateapi.com/packages/pypi/Flask/2.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/Flask/2.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/Flask/2.0.2/compatibility-slim/2.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/Flask/2.0.2/confidence-slim/2.0.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-scheduler). --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index ff1ce36af66d..cd7204fc7a64 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.0.1 +Flask==2.0.2 gunicorn==20.1.0 google-cloud-scheduler==2.3.4 From b1c36170a2cfde9e6d65bda736a0434d9ab6b5e3 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 12 Oct 2021 23:55:07 +0200 Subject: [PATCH 38/85] chore(deps): update dependency google-cloud-scheduler to v2.4.0 (#148) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index cd7204fc7a64..df8122337ec1 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.2 gunicorn==20.1.0 -google-cloud-scheduler==2.3.4 +google-cloud-scheduler==2.4.0 From bed5ebc789ac495b6df26113b5d17f2276406cae Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 25 Oct 2021 22:16:46 +0200 Subject: [PATCH 39/85] chore(deps): update dependency google-cloud-scheduler to v2.5.0 (#154) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index df8122337ec1..b579ed6376e9 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.2 gunicorn==20.1.0 -google-cloud-scheduler==2.4.0 +google-cloud-scheduler==2.5.0 From 6b4d434a09a6538762eab549b2fda42fb49d79dc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 10 Nov 2021 20:39:00 -0500 Subject: [PATCH 40/85] chore(python): run blacken session for all directories with a noxfile (#162) Source-Link: https://github.com/googleapis/synthtool/commit/bc0de6ee2489da6fb8eafd021a8c58b5cc30c947 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:39ad8c0570e4f5d2d3124a509de4fe975e799e2b97e0f58aed88f8880d5a8b60 Co-authored-by: Owl Bot --- scheduler/snippets/create_job.py | 25 +++++++++---------------- scheduler/snippets/create_job_test.py | 13 +++++++------ scheduler/snippets/main.py | 18 ++++++++++-------- scheduler/snippets/main_test.py | 11 ++++++----- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/scheduler/snippets/create_job.py b/scheduler/snippets/create_job.py index 646a89780e73..aeea5750b277 100644 --- a/scheduler/snippets/create_job.py +++ b/scheduler/snippets/create_job.py @@ -31,27 +31,20 @@ def create_scheduler_job(project_id, location_id, service_id): # Construct the request body. job = { - 'app_engine_http_target': { - 'app_engine_routing': { - 'service': service_id - }, - 'relative_uri': '/log_payload', - 'http_method': 1, - 'body': 'Hello World'.encode() + "app_engine_http_target": { + "app_engine_routing": {"service": service_id}, + "relative_uri": "/log_payload", + "http_method": 1, + "body": "Hello World".encode(), }, - 'schedule': '* * * * *', - 'time_zone': 'America/Los_Angeles' + "schedule": "* * * * *", + "time_zone": "America/Los_Angeles", } # Use the client to send the job creation request. - response = client.create_job( - request={ - "parent": parent, - "job": job - } - ) + response = client.create_job(request={"parent": parent, "job": job}) - print('Created job: {}'.format(response.name)) + print("Created job: {}".format(response.name)) # [END cloud_scheduler_create_job] return response diff --git a/scheduler/snippets/create_job_test.py b/scheduler/snippets/create_job_test.py index e6b8a0eb719b..da61f0ef03ac 100644 --- a/scheduler/snippets/create_job_test.py +++ b/scheduler/snippets/create_job_test.py @@ -16,18 +16,19 @@ import create_job -TEST_PROJECT_ID = os.getenv('GOOGLE_CLOUD_PROJECT') -TEST_LOCATION = os.getenv('LOCATION_ID', 'us-central1') +TEST_PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT") +TEST_LOCATION = os.getenv("LOCATION_ID", "us-central1") def test_create_job(capsys): create_result = create_job.create_scheduler_job( - TEST_PROJECT_ID, TEST_LOCATION, 'my-service') + TEST_PROJECT_ID, TEST_LOCATION, "my-service" + ) out, _ = capsys.readouterr() - assert 'Created job:' in out + assert "Created job:" in out - job_name = create_result.name.split('/')[-1] + job_name = create_result.name.split("/")[-1] create_job.delete_scheduler_job(TEST_PROJECT_ID, TEST_LOCATION, job_name) out, _ = capsys.readouterr() - assert 'Job deleted.' in out + assert "Job deleted." in out diff --git a/scheduler/snippets/main.py b/scheduler/snippets/main.py index 9d4d97537d27..4dad6afe73af 100644 --- a/scheduler/snippets/main.py +++ b/scheduler/snippets/main.py @@ -21,22 +21,24 @@ # Define relative URI for job endpoint -@app.route('/log_payload', methods=['POST']) +@app.route("/log_payload", methods=["POST"]) def example_task_handler(): """Log the job payload.""" - payload = request.get_data(as_text=True) or '(empty payload)' - print('Received job with payload: {}'.format(payload)) - return 'Printed job payload: {}'.format(payload) + payload = request.get_data(as_text=True) or "(empty payload)" + print("Received job with payload: {}".format(payload)) + return "Printed job payload: {}".format(payload) + + # [END cloud_scheduler_app] -@app.route('/') +@app.route("/") def hello(): """Basic index to verify app is serving.""" - return 'Hello World!' + return "Hello World!" -if __name__ == '__main__': +if __name__ == "__main__": # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. - app.run(host='127.0.0.1', port=8080, debug=True) + app.run(host="127.0.0.1", port=8080, debug=True) diff --git a/scheduler/snippets/main_test.py b/scheduler/snippets/main_test.py index 3d6745a5605c..75371c4b3c97 100644 --- a/scheduler/snippets/main_test.py +++ b/scheduler/snippets/main_test.py @@ -18,19 +18,20 @@ @pytest.fixture def app(): import main + main.app.testing = True return main.app.test_client() def test_index(app): - r = app.get('/') + r = app.get("/") assert r.status_code == 200 def test_log_payload(capsys, app): - payload = 'test_payload' + payload = "test_payload" - r = app.post('/log_payload', data=payload) + r = app.post("/log_payload", data=payload) assert r.status_code == 200 out, _ = capsys.readouterr() @@ -38,8 +39,8 @@ def test_log_payload(capsys, app): def test_empty_payload(capsys, app): - r = app.post('/log_payload') + r = app.post("/log_payload") assert r.status_code == 200 out, _ = capsys.readouterr() - assert 'empty payload' in out + assert "empty payload" in out From f13312b8e81830deafbc18125806da0f63e59bad Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 07:48:02 -0500 Subject: [PATCH 41/85] chore(samples): Add check for tests in directory (#172) Source-Link: https://github.com/googleapis/synthtool/commit/52aef91f8d25223d9dbdb4aebd94ba8eea2101f3 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 Co-authored-by: Owl Bot --- scheduler/snippets/noxfile.py | 70 +++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 93a9122cc457..3bbef5d54f44 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -14,6 +14,7 @@ from __future__ import print_function +import glob import os from pathlib import Path import sys @@ -184,37 +185,44 @@ def blacken(session: nox.sessions.Session) -> None: def _session_tests( session: nox.sessions.Session, post_install: Callable = None ) -> None: - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") - else: - session.install("-r", "requirements-test.txt") - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) + # check for presence of tests + test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + if len(test_list) == 0: + print("No tests found, skipping directory.") + else: + if TEST_CONFIG["pip_version_override"]: + pip_version = TEST_CONFIG["pip_version_override"] + session.install(f"pip=={pip_version}") + """Runs py.test for a particular project.""" + if os.path.exists("requirements.txt"): + if os.path.exists("constraints.txt"): + session.install("-r", "requirements.txt", "-c", "constraints.txt") + else: + session.install("-r", "requirements.txt") + + if os.path.exists("requirements-test.txt"): + if os.path.exists("constraints-test.txt"): + session.install( + "-r", "requirements-test.txt", "-c", "constraints-test.txt" + ) + else: + session.install("-r", "requirements-test.txt") + + if INSTALL_LIBRARY_FROM_SOURCE: + session.install("-e", _get_repo_root()) + + if post_install: + post_install(session) + + session.run( + "pytest", + *(PYTEST_COMMON_ARGS + session.posargs), + # Pytest will return 5 when no tests are collected. This can happen + # on travis where slow and flaky tests are excluded. + # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html + success_codes=[0, 5], + env=get_pytest_env_vars(), + ) @nox.session(python=ALL_VERSIONS) From 73fee33b63c86573fba9a8c552d1635f3bbc2960 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 18 Jan 2022 20:30:23 -0500 Subject: [PATCH 42/85] chore(python): Noxfile recognizes that tests can live in a folder (#176) Source-Link: https://github.com/googleapis/synthtool/commit/4760d8dce1351d93658cb11d02a1b7ceb23ae5d7 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 Co-authored-by: Owl Bot --- scheduler/snippets/noxfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 3bbef5d54f44..20cdfc620138 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -187,6 +187,7 @@ def _session_tests( ) -> None: # check for presence of tests test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + test_list.extend(glob.glob("tests")) if len(test_list) == 0: print("No tests found, skipping directory.") else: From a67014537109e8b5bbd94b74a16d85c83288b44b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 7 Feb 2022 23:00:43 +0100 Subject: [PATCH 43/85] chore(deps): update dependency google-cloud-scheduler to v2.6.0 (#182) Co-authored-by: Charles Engelke --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index b579ed6376e9..ddeab31822ec 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.2 gunicorn==20.1.0 -google-cloud-scheduler==2.5.0 +google-cloud-scheduler==2.6.0 From 16675ec88aeb4d497d624cf700ef79b05fa19a63 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 8 Feb 2022 22:52:35 +0100 Subject: [PATCH 44/85] chore(deps): update dependency pytest to v7 (#188) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 927094516e65..4a46ff600804 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==6.2.5 +pytest==7.0.0 From 8cb0024fa6892f1e0501238bceaa2a08ccf034d7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 14 Feb 2022 16:52:08 +0100 Subject: [PATCH 45/85] chore(deps): update dependency pytest to v7.0.1 (#190) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 4a46ff600804..c2845bffbe89 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.0.0 +pytest==7.0.1 From 2ec7d60e3dca53f64a4b9f11f1f5d8629c1f2cf9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 23 Feb 2022 16:49:21 +0100 Subject: [PATCH 46/85] chore(deps): update dependency flask to v2.0.3 (#191) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index ddeab31822ec..755fcae18ad0 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.0.2 +Flask==2.0.3 gunicorn==20.1.0 google-cloud-scheduler==2.6.0 From 6c5028d20478f0f2bccf80c3a233018401a015ab Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 1 Mar 2022 00:14:31 +0100 Subject: [PATCH 47/85] chore(deps): update all dependencies (#196) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 755fcae18ad0..69aa6e915ee9 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.3 gunicorn==20.1.0 -google-cloud-scheduler==2.6.0 +google-cloud-scheduler==2.6.1 From 89f34e714ed50bcf272c47eb1027022abe366bf7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 13:18:24 -0500 Subject: [PATCH 48/85] chore: Adding support for pytest-xdist and pytest-parallel (#204) Source-Link: https://github.com/googleapis/synthtool/commit/82f5cb283efffe96e1b6cd634738e0e7de2cd90a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- scheduler/snippets/noxfile.py | 78 ++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 20cdfc620138..85f5836dba3a 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -188,42 +188,52 @@ def _session_tests( # check for presence of tests test_list = glob.glob("*_test.py") + glob.glob("test_*.py") test_list.extend(glob.glob("tests")) + if len(test_list) == 0: print("No tests found, skipping directory.") - else: - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install( - "-r", "requirements-test.txt", "-c", "constraints-test.txt" - ) - else: - session.install("-r", "requirements-test.txt") - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) + return + + if TEST_CONFIG["pip_version_override"]: + pip_version = TEST_CONFIG["pip_version_override"] + session.install(f"pip=={pip_version}") + """Runs py.test for a particular project.""" + concurrent_args = [] + if os.path.exists("requirements.txt"): + if os.path.exists("constraints.txt"): + session.install("-r", "requirements.txt", "-c", "constraints.txt") + else: + session.install("-r", "requirements.txt") + with open("requirements.txt") as rfile: + packages = rfile.read() + + if os.path.exists("requirements-test.txt"): + if os.path.exists("constraints-test.txt"): + session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") + else: + session.install("-r", "requirements-test.txt") + with open("requirements-test.txt") as rtfile: + packages += rtfile.read() + + if INSTALL_LIBRARY_FROM_SOURCE: + session.install("-e", _get_repo_root()) + + if post_install: + post_install(session) + + if "pytest-parallel" in packages: + concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) + elif "pytest-xdist" in packages: + concurrent_args.extend(["-n", "auto"]) + + session.run( + "pytest", + *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args), + # Pytest will return 5 when no tests are collected. This can happen + # on travis where slow and flaky tests are excluded. + # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html + success_codes=[0, 5], + env=get_pytest_env_vars(), + ) @nox.session(python=ALL_VERSIONS) From 0be5f30a0b59045e93ee3c829fb1608f4e9ec4a3 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 7 Mar 2022 21:12:56 +0100 Subject: [PATCH 49/85] chore(deps): update dependency google-cloud-scheduler to v2.6.2 (#207) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 69aa6e915ee9..3650280954b1 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.0.3 gunicorn==20.1.0 -google-cloud-scheduler==2.6.1 +google-cloud-scheduler==2.6.2 From 0dc68ec486b93bf41531b0af8e2a89e660414bfa Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 13 Mar 2022 17:21:33 +0100 Subject: [PATCH 50/85] chore(deps): update dependency pytest to v7.1.0 (#209) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index c2845bffbe89..824a8a7a0ce6 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.0.1 +pytest==7.1.0 From 474f483b0f408aca04ee2f389551be259022dcfc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 19 Mar 2022 11:13:01 +0100 Subject: [PATCH 51/85] chore(deps): update dependency pytest to v7.1.1 (#210) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 824a8a7a0ce6..4f6bf643fc5e 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 From 846f3eb7118d4c303e1b80ca1f69c95059b0f368 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 19:58:16 -0400 Subject: [PATCH 52/85] chore(python): use black==22.3.0 (#215) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe Co-authored-by: Owl Bot --- scheduler/snippets/noxfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 85f5836dba3a..25f87a215d4c 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -253,7 +253,7 @@ def py(session: nox.sessions.Session) -> None: def _get_repo_root() -> Optional[str]: - """ Returns the root folder of the project. """ + """Returns the root folder of the project.""" # Get root of this repository. Assume we don't have directories nested deeper than 10 items. p = Path(os.getcwd()) for i in range(10): From 07798d77be0af554a380c44ae2d50d8a8c3299d9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 30 Mar 2022 16:08:01 +0200 Subject: [PATCH 53/85] chore(deps): update dependency flask to v2.1.0 (#214) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 3650280954b1..87636c1ac423 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.0.3 +Flask==2.1.0 gunicorn==20.1.0 google-cloud-scheduler==2.6.2 From bced2934233202505f294664659a7612564f27d5 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 31 Mar 2022 01:33:30 +0200 Subject: [PATCH 54/85] chore(deps): update dependency flask to v2.1.1 (#217) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 87636c1ac423..1351752a382e 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.1.0 +Flask==2.1.1 gunicorn==20.1.0 google-cloud-scheduler==2.6.2 From 90d1dfb54f449a9b555c2961ed242f32cd7335e0 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 14 Apr 2022 23:37:46 +0200 Subject: [PATCH 55/85] chore(deps): update dependency google-cloud-scheduler to v2.6.3 (#228) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 1351752a382e..8c37eb3cd932 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.1.1 gunicorn==20.1.0 -google-cloud-scheduler==2.6.2 +google-cloud-scheduler==2.6.3 From b34c0f56a4a590e6e04003bca9da3e0511cf97bb Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 21:01:01 -0400 Subject: [PATCH 56/85] chore(python): add nox session to sort python imports (#229) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- scheduler/snippets/create_job.py | 2 +- scheduler/snippets/noxfile.py | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/create_job.py b/scheduler/snippets/create_job.py index aeea5750b277..0163828374c5 100644 --- a/scheduler/snippets/create_job.py +++ b/scheduler/snippets/create_job.py @@ -52,8 +52,8 @@ def create_scheduler_job(project_id, location_id, service_id): def delete_scheduler_job(project_id, location_id, job_id): """Delete a job via the Cloud Scheduler API""" # [START cloud_scheduler_delete_job] - from google.cloud import scheduler from google.api_core.exceptions import GoogleAPICallError + from google.cloud import scheduler # Create a client. client = scheduler.CloudSchedulerClient() diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 25f87a215d4c..3b3ffa5d2b0f 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -22,7 +22,6 @@ import nox - # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING # DO NOT EDIT THIS FILE EVER! @@ -30,6 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +168,33 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # From 70a139387e4cac98f073f750aa1577896c111707 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 25 Apr 2022 17:08:27 +0200 Subject: [PATCH 57/85] chore(deps): update dependency pytest to v7.1.2 (#232) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 4f6bf643fc5e..d00689e0623a 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.1 +pytest==7.1.2 From b16e42f40e150eef21e9f1f89f37125bc4ffd3c9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 28 Apr 2022 21:22:10 +0200 Subject: [PATCH 58/85] chore(deps): update dependency flask to v2.1.2 (#234) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 8c37eb3cd932..0846430cc028 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.1.1 +Flask==2.1.2 gunicorn==20.1.0 google-cloud-scheduler==2.6.3 From 658b898ffa006700ddd1a0213d77f8e43c14060e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 10 Jul 2022 06:54:52 -0400 Subject: [PATCH 59/85] fix: require python 3.7+ (#256) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(python): drop python 3.6 Source-Link: https://github.com/googleapis/synthtool/commit/4f89b13af10d086458f9b379e56a614f9d6dab7b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c * add api_description to .repo-metadata.json * require python 3.7+ in setup.py * remove python 3.6 sample configs * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update name_pretty in .repo-metadata.json * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- scheduler/snippets/noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 3b3ffa5d2b0f..e9eb1cbfa5db 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -88,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to test samples. -ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] From 8033d128d4fc5e017d8efa1d124c2bb78ec348ad Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 16 Jul 2022 20:49:02 +0200 Subject: [PATCH 60/85] chore(deps): update all dependencies (#248) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 0846430cc028..55730838c33a 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.1.2 gunicorn==20.1.0 -google-cloud-scheduler==2.6.3 +google-cloud-scheduler==2.6.4 From fd7bcc8692347bb0583a2f45c4232e602d8e4fe2 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 2 Aug 2022 16:01:16 +0200 Subject: [PATCH 61/85] chore(deps): update all dependencies (#262) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- scheduler/snippets/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 55730838c33a..af515cfac88a 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.1.2 +Flask==2.1.3 gunicorn==20.1.0 -google-cloud-scheduler==2.6.4 +google-cloud-scheduler==2.7.0 From 95134d132292e605045be07b31d898f44fa33936 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 2 Aug 2022 16:13:53 +0200 Subject: [PATCH 62/85] chore(deps): update all dependencies (#263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * revert * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Anthonios Partheniou Co-authored-by: Owl Bot --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index af515cfac88a..8873ec1fdb2a 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.1.3 +Flask==2.2.0 gunicorn==20.1.0 google-cloud-scheduler==2.7.0 From 87edcb8c846fcc4523b319c9f1989a6e75581ea1 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 5 Aug 2022 21:41:33 +0200 Subject: [PATCH 63/85] chore(deps): update all dependencies (#265) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 8873ec1fdb2a..e3a234136160 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.2.0 +Flask==2.2.1 gunicorn==20.1.0 google-cloud-scheduler==2.7.0 From 52af804878d812a2b7136e00fcaa656ebca887e4 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 9 Aug 2022 12:07:45 +0200 Subject: [PATCH 64/85] chore(deps): update all dependencies (#266) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index e3a234136160..1e87b8fc7051 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.2.1 +Flask==2.2.2 gunicorn==20.1.0 google-cloud-scheduler==2.7.0 From 178a74e43b13f05a0626fef3a20777d5db55c4dc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 16 Aug 2022 16:27:20 +0200 Subject: [PATCH 65/85] chore(deps): update dependency google-cloud-scheduler to v2.7.1 (#271) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 1e87b8fc7051..0b2e04029f14 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.2.2 gunicorn==20.1.0 -google-cloud-scheduler==2.7.0 +google-cloud-scheduler==2.7.1 From d3fa2821728d08022c4d3239ff242cb97d803a1a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 6 Sep 2022 18:37:00 +0200 Subject: [PATCH 66/85] chore(deps): update dependency pytest to v7.1.3 (#281) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index d00689e0623a..e07168502ea9 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.2 +pytest==7.1.3 From 9f76a9e7e252ac509870c5b151304cc51af16f36 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 16:18:34 +0000 Subject: [PATCH 67/85] chore: detect samples tests in nested directories (#286) Source-Link: https://github.com/googleapis/synthtool/commit/50db768f450a50d7c1fd62513c113c9bb96fd434 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978 --- scheduler/snippets/noxfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index e9eb1cbfa5db..c1715136d645 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -207,8 +207,10 @@ def _session_tests( session: nox.sessions.Session, post_install: Callable = None ) -> None: # check for presence of tests - test_list = glob.glob("*_test.py") + glob.glob("test_*.py") - test_list.extend(glob.glob("tests")) + test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob( + "**/test_*.py", recursive=True + ) + test_list.extend(glob.glob("**/tests", recursive=True)) if len(test_list) == 0: print("No tests found, skipping directory.") From d0233de9acf376cd46e58879c0aeb1b5754ae747 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 4 Oct 2022 15:35:04 +0200 Subject: [PATCH 68/85] chore(deps): update dependency google-cloud-scheduler to v2.7.2 (#290) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 0b2e04029f14..9e4db12d012c 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.2.2 gunicorn==20.1.0 -google-cloud-scheduler==2.7.1 +google-cloud-scheduler==2.7.2 From 75c9e22f484d144be25045aa218c3c4f0bd17520 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 10 Oct 2022 20:17:20 +0200 Subject: [PATCH 69/85] chore(deps): update dependency google-cloud-scheduler to v2.7.3 (#293) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 9e4db12d012c..de74d2f9f01c 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.2.2 gunicorn==20.1.0 -google-cloud-scheduler==2.7.2 +google-cloud-scheduler==2.7.3 From 824d0a7ad156551dea5a3ec893228f8c6c1fca2c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 26 Oct 2022 12:53:46 +0200 Subject: [PATCH 70/85] chore(deps): update dependency pytest to v7.2.0 (#294) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index e07168502ea9..49780e035690 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.3 +pytest==7.2.0 From 938c067c4a11a576c4a4076ba59ce80c9936afe6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 26 Nov 2022 11:01:27 -0500 Subject: [PATCH 71/85] chore(python): drop flake8-import-order in samples noxfile (#299) Source-Link: https://github.com/googleapis/synthtool/commit/6ed3a831cb9ff69ef8a504c353e098ec0192ad93 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb Co-authored-by: Owl Bot --- scheduler/snippets/noxfile.py | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index c1715136d645..0577084695fc 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -18,7 +18,7 @@ import os from pathlib import Path import sys -from typing import Callable, Dict, List, Optional +from typing import Callable, Dict, Optional import nox @@ -108,22 +108,6 @@ def get_pytest_env_vars() -> Dict[str, str]: # -def _determine_local_import_names(start_dir: str) -> List[str]: - """Determines all import names that should be considered "local". - - This is used when running the linter to insure that import order is - properly checked. - """ - file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)] - return [ - basename - for basename, extension in file_ext_pairs - if extension == ".py" - or os.path.isdir(os.path.join(start_dir, basename)) - and basename not in ("__pycache__") - ] - - # Linting with flake8. # # We ignore the following rules: @@ -138,7 +122,6 @@ def _determine_local_import_names(start_dir: str) -> List[str]: "--show-source", "--builtin=gettext", "--max-complexity=20", - "--import-order-style=google", "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py", "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202", "--max-line-length=88", @@ -148,14 +131,11 @@ def _determine_local_import_names(start_dir: str) -> List[str]: @nox.session def lint(session: nox.sessions.Session) -> None: if not TEST_CONFIG["enforce_type_hints"]: - session.install("flake8", "flake8-import-order") + session.install("flake8") else: - session.install("flake8", "flake8-import-order", "flake8-annotations") + session.install("flake8", "flake8-annotations") - local_names = _determine_local_import_names(".") args = FLAKE8_COMMON_ARGS + [ - "--application-import-names", - ",".join(local_names), ".", ] session.run("flake8", *args) From 8e892271d82ae655b39306895e519ec110d9f017 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 15 Dec 2022 20:43:29 +0100 Subject: [PATCH 72/85] chore(deps): update dependency google-cloud-scheduler to v2.8.0 (#305) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index de74d2f9f01c..e090a4f80d17 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.2.2 gunicorn==20.1.0 -google-cloud-scheduler==2.7.3 +google-cloud-scheduler==2.8.0 From 8efe9e5ac5458635ce8257ab23e67a82132f9c6f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 6 Jan 2023 12:32:02 -0500 Subject: [PATCH 73/85] chore(python): add support for python 3.11 (#306) Source-Link: https://github.com/googleapis/synthtool/commit/7197a001ffb6d8ce7b0b9b11c280f0c536c1033a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 Co-authored-by: Owl Bot --- scheduler/snippets/noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py index 0577084695fc..de104dbc64d3 100644 --- a/scheduler/snippets/noxfile.py +++ b/scheduler/snippets/noxfile.py @@ -88,7 +88,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"] From 9b4d5c10c691b382305c2394d8bf48c01d17ba8c Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 10 Jan 2023 19:24:03 +0000 Subject: [PATCH 74/85] chore(deps): update dependency google-cloud-scheduler to v2.9.0 (#309) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index e090a4f80d17..2fb858c1d5f0 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.2.2 gunicorn==20.1.0 -google-cloud-scheduler==2.8.0 +google-cloud-scheduler==2.9.0 From c781e8ffd824d8f0b1a53d1dad1da74f56aff4e4 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 14 Jan 2023 18:08:36 +0000 Subject: [PATCH 75/85] chore(deps): update dependency pytest to v7.2.1 (#310) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 49780e035690..805eb2a9f845 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.2.0 +pytest==7.2.1 From 9cfbd694c30d117be1edf4c9f1a1cd2690566c00 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 24 Jan 2023 15:07:25 +0000 Subject: [PATCH 76/85] chore(deps): update dependency google-cloud-scheduler to v2.9.1 (#314) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 2fb858c1d5f0..6505cca3afc7 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.2.2 gunicorn==20.1.0 -google-cloud-scheduler==2.9.0 +google-cloud-scheduler==2.9.1 From 1934ff5916fa5b6c376bfd662611b425058ee9fd Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 1 Mar 2023 10:10:57 +0000 Subject: [PATCH 77/85] chore(deps): update all dependencies (#321) --- scheduler/snippets/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 6505cca3afc7..1e3e69c8af64 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.2.2 +Flask==2.2.3 gunicorn==20.1.0 -google-cloud-scheduler==2.9.1 +google-cloud-scheduler==2.10.0 From 794e2dedd1a24ed8380222174cf46467a7f1ab3a Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 4 Mar 2023 11:31:11 +0000 Subject: [PATCH 78/85] chore(deps): update dependency pytest to v7.2.2 (#326) --- scheduler/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements-test.txt b/scheduler/snippets/requirements-test.txt index 805eb2a9f845..c021c5b5b702 100644 --- a/scheduler/snippets/requirements-test.txt +++ b/scheduler/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.2.1 +pytest==7.2.2 From 89a650b975531bd8384be6e133e1670e5a074eed Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 6 Apr 2023 17:16:29 +0100 Subject: [PATCH 79/85] chore(deps): update dependency google-cloud-scheduler to v2.11.0 (#329) --- scheduler/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/requirements.txt b/scheduler/snippets/requirements.txt index 1e3e69c8af64..8ac51b47973d 100644 --- a/scheduler/snippets/requirements.txt +++ b/scheduler/snippets/requirements.txt @@ -1,3 +1,3 @@ Flask==2.2.3 gunicorn==20.1.0 -google-cloud-scheduler==2.10.0 +google-cloud-scheduler==2.11.0 From dddd0e2b6053b02886d6f9381d634f49047649f5 Mon Sep 17 00:00:00 2001 From: MiaCY <97990237+MiaCY@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:42:29 -0700 Subject: [PATCH 80/85] Update license header --- scheduler/snippets/create_job_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/create_job_test.py b/scheduler/snippets/create_job_test.py index da61f0ef03ac..09d88bb7b676 100644 --- a/scheduler/snippets/create_job_test.py +++ b/scheduler/snippets/create_job_test.py @@ -1,4 +1,4 @@ -# Copyright 2019 Google Inc. All Rights Reserved. +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From af35759abbd7de5ab25dfc4f4408ca22709a77c8 Mon Sep 17 00:00:00 2001 From: MiaCY <97990237+MiaCY@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:43:03 -0700 Subject: [PATCH 81/85] Update license header --- scheduler/snippets/main_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/main_test.py b/scheduler/snippets/main_test.py index 75371c4b3c97..6419f1366ec7 100644 --- a/scheduler/snippets/main_test.py +++ b/scheduler/snippets/main_test.py @@ -1,4 +1,4 @@ -# Copyright 2019 Google Inc. All Rights Reserved. +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From d8cedb4cf40068467d9820da42b10f6b7036571f Mon Sep 17 00:00:00 2001 From: Mia Yang Date: Tue, 11 Apr 2023 15:21:14 -0700 Subject: [PATCH 82/85] add noxfile_config and remove README --- scheduler/README.md | 3 - scheduler/snippets/README.md | 0 scheduler/snippets/noxfile.py | 292 --------------------------- scheduler/snippets/noxfile_config.py | 42 ++++ 4 files changed, 42 insertions(+), 295 deletions(-) delete mode 100644 scheduler/README.md delete mode 100644 scheduler/snippets/README.md delete mode 100644 scheduler/snippets/noxfile.py create mode 100644 scheduler/snippets/noxfile_config.py diff --git a/scheduler/README.md b/scheduler/README.md deleted file mode 100644 index 88d88e9ccb37..000000000000 --- a/scheduler/README.md +++ /dev/null @@ -1,3 +0,0 @@ -These samples have been moved. - -https://github.com/googleapis/python-scheduler/tree/main/samples diff --git a/scheduler/snippets/README.md b/scheduler/snippets/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/scheduler/snippets/noxfile.py b/scheduler/snippets/noxfile.py deleted file mode 100644 index de104dbc64d3..000000000000 --- a/scheduler/snippets/noxfile.py +++ /dev/null @@ -1,292 +0,0 @@ -# Copyright 2019 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. - -from __future__ import print_function - -import glob -import os -from pathlib import Path -import sys -from typing import Callable, Dict, Optional - -import nox - -# WARNING - WARNING - WARNING - WARNING - WARNING -# WARNING - WARNING - WARNING - WARNING - WARNING -# DO NOT EDIT THIS FILE EVER! -# WARNING - WARNING - WARNING - WARNING - WARNING -# WARNING - WARNING - WARNING - WARNING - WARNING - -BLACK_VERSION = "black==22.3.0" -ISORT_VERSION = "isort==5.10.1" - -# Copy `noxfile_config.py` to your directory and modify it instead. - -# `TEST_CONFIG` dict is a configuration hook that allows users to -# modify the test configurations. The values here should be in sync -# with `noxfile_config.py`. Users will copy `noxfile_config.py` into -# their directory and modify it. - -TEST_CONFIG = { - # You can opt out from the test for specific Python versions. - "ignored_versions": [], - # 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 - # 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": {}, -} - - -try: - # Ensure we can import noxfile_config in the project's directory. - sys.path.append(".") - from noxfile_config import TEST_CONFIG_OVERRIDE -except ImportError as e: - print("No user noxfile_config found: detail: {}".format(e)) - TEST_CONFIG_OVERRIDE = {} - -# Update the TEST_CONFIG with the user supplied values. -TEST_CONFIG.update(TEST_CONFIG_OVERRIDE) - - -def get_pytest_env_vars() -> Dict[str, str]: - """Returns a dict for pytest invocation.""" - ret = {} - - # Override the GCLOUD_PROJECT and the alias. - env_key = TEST_CONFIG["gcloud_project_env"] - # This should error out if not set. - ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key] - - # Apply user supplied envs. - ret.update(TEST_CONFIG["envs"]) - return ret - - -# DO NOT EDIT - automatically generated. -# All versions used to test samples. -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"] - -TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) - -INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ( - "True", - "true", -) - -# Error if a python version is missing -nox.options.error_on_missing_interpreters = True - -# -# Style Checks -# - - -# Linting with flake8. -# -# We ignore the following rules: -# E203: whitespace before ‘:’ -# E266: too many leading ‘#’ for block comment -# E501: line too long -# I202: Additional newline in a section of imports -# -# We also need to specify the rules which are ignored by default: -# ['E226', 'W504', 'E126', 'E123', 'W503', 'E24', 'E704', 'E121'] -FLAKE8_COMMON_ARGS = [ - "--show-source", - "--builtin=gettext", - "--max-complexity=20", - "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py", - "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202", - "--max-line-length=88", -] - - -@nox.session -def lint(session: nox.sessions.Session) -> None: - if not TEST_CONFIG["enforce_type_hints"]: - session.install("flake8") - else: - session.install("flake8", "flake8-annotations") - - args = FLAKE8_COMMON_ARGS + [ - ".", - ] - session.run("flake8", *args) - - -# -# Black -# - - -@nox.session -def blacken(session: nox.sessions.Session) -> None: - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - python_files = [path for path in os.listdir(".") if path.endswith(".py")] - - session.run("black", *python_files) - - -# -# format = isort + black -# - - -@nox.session -def format(session: nox.sessions.Session) -> None: - """ - Run isort to sort imports. Then run black - to format code to uniform standard. - """ - session.install(BLACK_VERSION, ISORT_VERSION) - python_files = [path for path in os.listdir(".") if path.endswith(".py")] - - # Use the --fss option to sort imports using strict alphabetical order. - # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections - session.run("isort", "--fss", *python_files) - session.run("black", *python_files) - - -# -# Sample Tests -# - - -PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] - - -def _session_tests( - session: nox.sessions.Session, post_install: Callable = None -) -> None: - # check for presence of tests - test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob( - "**/test_*.py", recursive=True - ) - test_list.extend(glob.glob("**/tests", recursive=True)) - - if len(test_list) == 0: - print("No tests found, skipping directory.") - return - - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - concurrent_args = [] - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - with open("requirements.txt") as rfile: - packages = rfile.read() - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") - else: - session.install("-r", "requirements-test.txt") - with open("requirements-test.txt") as rtfile: - packages += rtfile.read() - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - if "pytest-parallel" in packages: - concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) - elif "pytest-xdist" in packages: - concurrent_args.extend(["-n", "auto"]) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) - - -@nox.session(python=ALL_VERSIONS) -def py(session: nox.sessions.Session) -> None: - """Runs py.test for a sample using the specified version of Python.""" - if session.python in TESTED_VERSIONS: - _session_tests(session) - else: - session.skip( - "SKIPPED: {} tests are disabled for this sample.".format(session.python) - ) - - -# -# Readmegen -# - - -def _get_repo_root() -> Optional[str]: - """Returns the root folder of the project.""" - # Get root of this repository. Assume we don't have directories nested deeper than 10 items. - p = Path(os.getcwd()) - for i in range(10): - if p is None: - break - if Path(p / ".git").exists(): - return str(p) - # .git is not available in repos cloned via Cloud Build - # setup.py is always in the library's root, so use that instead - # https://github.com/googleapis/synthtool/issues/792 - if Path(p / "setup.py").exists(): - return str(p) - p = p.parent - raise Exception("Unable to detect repository root.") - - -GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")]) - - -@nox.session -@nox.parametrize("path", GENERATED_READMES) -def readmegen(session: nox.sessions.Session, path: str) -> None: - """(Re-)generates the readme for a sample.""" - session.install("jinja2", "pyyaml") - dir_ = os.path.dirname(path) - - if os.path.exists(os.path.join(dir_, "requirements.txt")): - session.install("-r", os.path.join(dir_, "requirements.txt")) - - in_file = os.path.join(dir_, "README.rst.in") - session.run( - "python", _get_repo_root() + "/scripts/readme-gen/readme_gen.py", in_file - ) diff --git a/scheduler/snippets/noxfile_config.py b/scheduler/snippets/noxfile_config.py new file mode 100644 index 000000000000..ba1aa7675f69 --- /dev/null +++ b/scheduler/snippets/noxfile_config.py @@ -0,0 +1,42 @@ +# Copyright 2021 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.6"], + # 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 + # 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": {}, +} \ No newline at end of file From beb77fa4aa10aa2ccec2519f8fba70bdb9dc4eab Mon Sep 17 00:00:00 2001 From: Mia Yang Date: Tue, 11 Apr 2023 15:41:44 -0700 Subject: [PATCH 83/85] address linter --- scheduler/snippets/noxfile_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler/snippets/noxfile_config.py b/scheduler/snippets/noxfile_config.py index ba1aa7675f69..4622f7616789 100644 --- a/scheduler/snippets/noxfile_config.py +++ b/scheduler/snippets/noxfile_config.py @@ -39,4 +39,4 @@ # A dictionary you want to inject into your test. Don't put any # secrets here. These values will override predefined values. "envs": {}, -} \ No newline at end of file +} From 0209cf7855b55fe7d3cc0e409b80f89cec7aa9fb Mon Sep 17 00:00:00 2001 From: Mia Yang Date: Wed, 12 Apr 2023 13:57:45 -0700 Subject: [PATCH 84/85] add codeowner of scheduler samples --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5dff1fb66798..777c7b33584b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -78,6 +78,7 @@ /recaptcha_enterprise/demosite/* @Sita04 @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/recaptcha-customer-obsession-reviewers @GoogleCloudPlatform/python-samples-reviewers /retail/**/* @GoogleCloudPlatform/cloud-retail-team @GoogleCloudPlatform/python-samples-reviewers /run/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers +/scheduler/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /secretmanager/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /securitycenter/**/* @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /speech/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers From 53babdc614f9307565b3b7e09cd603965cff8771 Mon Sep 17 00:00:00 2001 From: Cathy Ouyang Date: Fri, 21 Apr 2023 14:00:46 -0700 Subject: [PATCH 85/85] fix region tags --- scheduler/snippets/app.yaml | 4 ++-- scheduler/snippets/create_job.py | 8 ++++---- scheduler/snippets/main.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scheduler/snippets/app.yaml b/scheduler/snippets/app.yaml index 8afa34736dad..e0e08d4312e1 100644 --- a/scheduler/snippets/app.yaml +++ b/scheduler/snippets/app.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START cloud_scheduler_python_yaml] +# [START cloudscheduler_python_yaml] runtime: python37 service: my-service -# [END cloud_scheduler_python_yaml] +# [END cloudscheduler_python_yaml] diff --git a/scheduler/snippets/create_job.py b/scheduler/snippets/create_job.py index 0163828374c5..7a863cdb637e 100644 --- a/scheduler/snippets/create_job.py +++ b/scheduler/snippets/create_job.py @@ -15,7 +15,7 @@ def create_scheduler_job(project_id, location_id, service_id): """Create a job with an App Engine target via the Cloud Scheduler API""" - # [START cloud_scheduler_create_job] + # [START cloudscheduler_create_job] from google.cloud import scheduler # Create a client. @@ -45,13 +45,13 @@ def create_scheduler_job(project_id, location_id, service_id): response = client.create_job(request={"parent": parent, "job": job}) print("Created job: {}".format(response.name)) - # [END cloud_scheduler_create_job] + # [END cloudscheduler_create_job] return response def delete_scheduler_job(project_id, location_id, job_id): """Delete a job via the Cloud Scheduler API""" - # [START cloud_scheduler_delete_job] + # [START cloudscheduler_delete_job] from google.api_core.exceptions import GoogleAPICallError from google.cloud import scheduler @@ -72,4 +72,4 @@ def delete_scheduler_job(project_id, location_id, job_id): print("Job deleted.") except GoogleAPICallError as e: print("Error: %s" % e) - # [END cloud_scheduler_delete_job] + # [END cloudscheduler_delete_job] diff --git a/scheduler/snippets/main.py b/scheduler/snippets/main.py index 4dad6afe73af..1c98ca2aef4d 100644 --- a/scheduler/snippets/main.py +++ b/scheduler/snippets/main.py @@ -14,7 +14,7 @@ """App Engine app to serve as an endpoint for Cloud Scheduler samples.""" -# [START cloud_scheduler_app] +# [START cloudscheduler_app] from flask import Flask, request app = Flask(__name__) @@ -29,7 +29,7 @@ def example_task_handler(): return "Printed job payload: {}".format(payload) -# [END cloud_scheduler_app] +# [END cloudscheduler_app] @app.route("/")