From 2600ff568378e54ebf72ba3578af00e989ed8978 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 07:58:51 -0400 Subject: [PATCH] fix: require python 3.7+ (#195) 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 * require python 3.7+ in setup.py * remove python 3.6 sample configs * add api_description to .repo-metadata.json * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * exclude templated readme Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- packages/grafeas/.github/.OwlBot.lock.yaml | 4 +- .../.kokoro/samples/python3.6/common.cfg | 40 --------- .../.kokoro/samples/python3.6/continuous.cfg | 7 -- .../samples/python3.6/periodic-head.cfg | 11 --- .../.kokoro/samples/python3.6/periodic.cfg | 6 -- .../.kokoro/samples/python3.6/presubmit.cfg | 6 -- packages/grafeas/.kokoro/test-samples-impl.sh | 4 +- packages/grafeas/.repo-metadata.json | 1 + packages/grafeas/CONTRIBUTING.rst | 6 +- packages/grafeas/README.rst | 6 +- packages/grafeas/noxfile.py | 85 ++++++++++++------- packages/grafeas/owlbot.py | 1 + .../templates/install_deps.tmpl.rst | 2 +- packages/grafeas/setup.py | 3 +- 14 files changed, 67 insertions(+), 115 deletions(-) delete mode 100644 packages/grafeas/.kokoro/samples/python3.6/common.cfg delete mode 100644 packages/grafeas/.kokoro/samples/python3.6/continuous.cfg delete mode 100644 packages/grafeas/.kokoro/samples/python3.6/periodic-head.cfg delete mode 100644 packages/grafeas/.kokoro/samples/python3.6/periodic.cfg delete mode 100644 packages/grafeas/.kokoro/samples/python3.6/presubmit.cfg diff --git a/packages/grafeas/.github/.OwlBot.lock.yaml b/packages/grafeas/.github/.OwlBot.lock.yaml index 50b29ffd2050..1ce608523524 100644 --- a/packages/grafeas/.github/.OwlBot.lock.yaml +++ b/packages/grafeas/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97 -# created: 2022-06-12T16:09:31.61859086Z + digest: sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c +# created: 2022-07-05T18:31:20.838186805Z diff --git a/packages/grafeas/.kokoro/samples/python3.6/common.cfg b/packages/grafeas/.kokoro/samples/python3.6/common.cfg deleted file mode 100644 index 51d2c9c65bba..000000000000 --- a/packages/grafeas/.kokoro/samples/python3.6/common.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "py-3.6" -} - -# Declare build specific Cloud project. -env_vars: { - key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests-py36" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-grafeas/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-grafeas/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/packages/grafeas/.kokoro/samples/python3.6/continuous.cfg b/packages/grafeas/.kokoro/samples/python3.6/continuous.cfg deleted file mode 100644 index 7218af1499e5..000000000000 --- a/packages/grafeas/.kokoro/samples/python3.6/continuous.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} - diff --git a/packages/grafeas/.kokoro/samples/python3.6/periodic-head.cfg b/packages/grafeas/.kokoro/samples/python3.6/periodic-head.cfg deleted file mode 100644 index 03a0ec1dd39f..000000000000 --- a/packages/grafeas/.kokoro/samples/python3.6/periodic-head.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-grafeas/.kokoro/test-samples-against-head.sh" -} diff --git a/packages/grafeas/.kokoro/samples/python3.6/periodic.cfg b/packages/grafeas/.kokoro/samples/python3.6/periodic.cfg deleted file mode 100644 index 71cd1e597e38..000000000000 --- a/packages/grafeas/.kokoro/samples/python3.6/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} diff --git a/packages/grafeas/.kokoro/samples/python3.6/presubmit.cfg b/packages/grafeas/.kokoro/samples/python3.6/presubmit.cfg deleted file mode 100644 index a1c8d9759c88..000000000000 --- a/packages/grafeas/.kokoro/samples/python3.6/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/packages/grafeas/.kokoro/test-samples-impl.sh b/packages/grafeas/.kokoro/test-samples-impl.sh index 8a324c9c7bc6..2c6500cae0b9 100755 --- a/packages/grafeas/.kokoro/test-samples-impl.sh +++ b/packages/grafeas/.kokoro/test-samples-impl.sh @@ -33,7 +33,7 @@ export PYTHONUNBUFFERED=1 env | grep KOKORO # Install nox -python3.6 -m pip install --upgrade --quiet nox +python3.9 -m pip install --upgrade --quiet nox # Use secrets acessor service account to get secrets if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then @@ -76,7 +76,7 @@ for file in samples/**/requirements.txt; do echo "------------------------------------------------------------" # Use nox to execute the tests for the project. - python3.6 -m nox -s "$RUN_TESTS_SESSION" + python3.9 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? # If this is a periodic build, send the test log to the FlakyBot. diff --git a/packages/grafeas/.repo-metadata.json b/packages/grafeas/.repo-metadata.json index 604c9bac3810..0c33a490da5e 100644 --- a/packages/grafeas/.repo-metadata.json +++ b/packages/grafeas/.repo-metadata.json @@ -1,6 +1,7 @@ { "name": "grafeas", "name_pretty": "Grafeas", + "api_description": "An implementation of the Grafeas API, which stores, and enables querying and retrieval of critical metadata about all of your software artifacts.", "product_documentation": "https://grafeas.io", "client_documentation": "https://googleapis.dev/python/grafeas/latest", "issue_tracker": "", diff --git a/packages/grafeas/CONTRIBUTING.rst b/packages/grafeas/CONTRIBUTING.rst index 309d087b89f2..05081a7f76eb 100644 --- a/packages/grafeas/CONTRIBUTING.rst +++ b/packages/grafeas/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.6, 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows. + 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -221,13 +221,11 @@ Supported Python Versions We support: -- `Python 3.6`_ - `Python 3.7`_ - `Python 3.8`_ - `Python 3.9`_ - `Python 3.10`_ -.. _Python 3.6: https://docs.python.org/3.6/ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ .. _Python 3.9: https://docs.python.org/3.9/ @@ -239,7 +237,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/python-grafeas/blob/main/noxfile.py -We also explicitly decided to support Python 3 beginning with version 3.6. +We also explicitly decided to support Python 3 beginning with version 3.7. Reasons for this include: - Encouraging use of newest versions of Python 3 diff --git a/packages/grafeas/README.rst b/packages/grafeas/README.rst index dcdfab71dace..dcee94274ae2 100644 --- a/packages/grafeas/README.rst +++ b/packages/grafeas/README.rst @@ -35,11 +35,11 @@ dependencies. Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ -Python >= 3.6 +Python >= 3.7 Deprecated Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^ -Python == 2.7. +Python == 2.7, Python == 3.6. The last version of this library compatible with Python 2.7 is grafeas==0.4.1. @@ -75,4 +75,4 @@ Next Steps APIs that we cover. .. _Grafeas API Product documentation: https://grafeas.io/ -.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst \ No newline at end of file +.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst diff --git a/packages/grafeas/noxfile.py b/packages/grafeas/noxfile.py index d1064dd307ba..2d252e575cbb 100644 --- a/packages/grafeas/noxfile.py +++ b/packages/grafeas/noxfile.py @@ -31,7 +31,7 @@ DEFAULT_PYTHON_VERSION = "3.8" -UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", "asyncmock", @@ -331,28 +331,15 @@ def docfx(session): def prerelease_deps(session): """Run all tests with prerelease versions of dependencies installed.""" - prerel_deps = [ - "protobuf", - "googleapis-common-protos", - "google-auth", - "grpcio", - "grpcio-status", - "google-api-core", - "proto-plus", - # dependencies of google-auth - "cryptography", - "pyasn1", - ] - - for dep in prerel_deps: - session.install("--pre", "--no-deps", "--upgrade", dep) - - # Remaining dependencies - other_deps = ["requests"] - session.install(*other_deps) - + # Install all dependencies + session.install("-e", ".[all, tests, tracing]") session.install(*UNIT_TEST_STANDARD_DEPENDENCIES) - session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES) + system_deps_all = ( + SYSTEM_TEST_STANDARD_DEPENDENCIES + + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + + SYSTEM_TEST_EXTRAS + ) + session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a @@ -366,19 +353,44 @@ def prerelease_deps(session): constraints_text = constraints_file.read() # Ignore leading whitespace and comment lines. - deps = [ + constraints_deps = [ match.group(1) for match in re.finditer( r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE ) ] - # Don't overwrite prerelease packages. - deps = [dep for dep in deps if dep not in prerel_deps] - # We use --no-deps to ensure that pre-release versions aren't overwritten - # by the version ranges in setup.py. - session.install(*deps) - session.install("--no-deps", "-e", ".[all]") + session.install(*constraints_deps) + + if os.path.exists("samples/snippets/requirements.txt"): + session.install("-r", "samples/snippets/requirements.txt") + + if os.path.exists("samples/snippets/requirements-test.txt"): + session.install("-r", "samples/snippets/requirements-test.txt") + + prerel_deps = [ + "protobuf", + # dependency of grpc + "six", + "googleapis-common-protos", + "grpcio", + "grpcio-status", + "google-api-core", + "proto-plus", + "google-cloud-testutils", + # dependencies of google-cloud-testutils" + "click", + ] + + for dep in prerel_deps: + session.install("--pre", "--no-deps", "--upgrade", dep) + + # Remaining dependencies + other_deps = [ + "requests", + "google-auth", + ] + session.install(*other_deps) # Print out prerelease package versions session.run( @@ -387,5 +399,16 @@ def prerelease_deps(session): session.run("python", "-c", "import grpc; print(grpc.__version__)") session.run("py.test", "tests/unit") - session.run("py.test", "tests/system") - session.run("py.test", "samples/snippets") + + system_test_path = os.path.join("tests", "system.py") + system_test_folder_path = os.path.join("tests", "system") + + # Only run system tests if found. + if os.path.exists(system_test_path) or os.path.exists(system_test_folder_path): + session.run("py.test", "tests/system") + + snippets_test_path = os.path.join("samples", "snippets") + + # Only run samples tests if found. + if os.path.exists(snippets_test_path): + session.run("py.test", "samples/snippets") diff --git a/packages/grafeas/owlbot.py b/packages/grafeas/owlbot.py index 7be6c5b8b90b..89ef6f8d5332 100644 --- a/packages/grafeas/owlbot.py +++ b/packages/grafeas/owlbot.py @@ -238,6 +238,7 @@ def test_api_key_credentials.*?client_info=transports.base.DEFAULT_CLIENT_INFO, ".coveragerc", # microgenerator has a good .coveragerc file ".github/snippet-bot.yml", ".github/workflows", # exclude templated gh actions as tests require credentials + "README.rst", ] ) diff --git a/packages/grafeas/scripts/readme-gen/templates/install_deps.tmpl.rst b/packages/grafeas/scripts/readme-gen/templates/install_deps.tmpl.rst index 275d649890d7..6f069c6c87a5 100644 --- a/packages/grafeas/scripts/readme-gen/templates/install_deps.tmpl.rst +++ b/packages/grafeas/scripts/readme-gen/templates/install_deps.tmpl.rst @@ -12,7 +12,7 @@ Install Dependencies .. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup -#. Create a virtualenv. Samples are compatible with Python 3.6+. +#. Create a virtualenv. Samples are compatible with Python 3.7+. .. code-block:: bash diff --git a/packages/grafeas/setup.py b/packages/grafeas/setup.py index 9bfce58e76bb..047b85f77d97 100644 --- a/packages/grafeas/setup.py +++ b/packages/grafeas/setup.py @@ -60,7 +60,6 @@ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", @@ -72,7 +71,7 @@ packages=packages, namespace_packages=namespaces, install_requires=dependencies, - python_requires=">=3.6", + python_requires=">=3.7", scripts=["scripts/fixup_grafeas_v1_keywords.py"], include_package_data=True, zip_safe=False,