Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
fix: require python 3.7+ (#126)
Browse files Browse the repository at this point in the history
* chore(python): drop python 3.6

Source-Link: googleapis/synthtool@4f89b13
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

* fix typo

* 🦉 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 <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Jul 16, 2022
1 parent a5149a4 commit 2df9df8
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149
# created: 2022-05-05T15:17:27.599381182Z
digest: sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c
# created: 2022-07-05T18:31:20.838186805Z
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
python: ['3.7', '3.8', '3.9', '3.10']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
7 changes: 7 additions & 0 deletions .kokoro/continuous/prerelease-deps.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "prerelease_deps"
}
7 changes: 7 additions & 0 deletions .kokoro/presubmit/prerelease-deps.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "prerelease_deps"
}
40 changes: 0 additions & 40 deletions .kokoro/samples/python3.6/common.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions .kokoro/samples/python3.6/continuous.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions .kokoro/samples/python3.6/periodic-head.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.6/periodic.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.6/presubmit.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apigeeconnect",
"name_pretty": "Apigee Connect API",
"name_pretty": "Apigee Connect",
"product_documentation": "https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect",
"client_documentation": "https://cloud.google.com/python/docs/reference/apigeeconnect/latest",
"issue_tracker": "",
Expand All @@ -12,5 +12,6 @@
"api_id": "apigeeconnect.googleapis.com",
"default_version": "v1",
"codeowner_team": "",
"api_shortname": "apigeeconnect"
"api_shortname": "apigeeconnect",
"api_description": "allows the Apigee hybrid management plane to connect securely to the MART service in the runtime plane without requiring you to expose the MART endpoint on the internet."
}
6 changes: 2 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand All @@ -239,7 +237,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-apigee-connect/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
Expand Down
48 changes: 33 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
Python Client for Apigee Connect
================================
Python Client for Apigee Connect API
====================================

|ga| |pypi| |versions|
|stable| |pypi| |versions|

`Apigee Connect`_: allows the Apigee hybrid management plane to connect securely to the MART
service in the runtime plane without requiring you to expose the MART endpoint on the internet.
If you use Apigee Connect, you do not need to configure the MART ingress gateway with a host alias
and an authorized DNS certificate.
`Apigee Connect API`_: allows the Apigee hybrid management plane to connect securely to the MART service in the runtime plane without requiring you to expose the MART endpoint on the internet.

- `Client Library Documentation`_
- `Product Documentation`_

.. |ga| image:: https://img.shields.io/badge/support-ga-gold.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#ga-support
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-apigee-connect.svg
:target: https://pypi.org/project/google-cloud-apigee-connect/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-apigee-connect.svg
:target: https://pypi.org/project/google-cloud-apigee-connect/
.. _Apigee Connect: https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect
.. _Apigee Connect API: https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/apigeeconnect/latest
.. _Product Documentation: https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect

Expand All @@ -33,7 +30,7 @@ In order to use this library, you first need to go through the following steps:

.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Apigee Connect API.: https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect#add-apigee-connect-to-the-hybrid-runtime
.. _Enable the Apigee Connect API.: https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html

Installation
Expand All @@ -50,6 +47,27 @@ dependencies.
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/


Code samples and snippets
~~~~~~~~~~~~~~~~~~~~~~~~~

Code samples and snippets live in the `samples/` folder.


Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Our client libraries are compatible with all current [active](https://devguide.python.org/devcycle/#in-development-main-branch) and [maintenance](https://devguide.python.org/devcycle/#maintenance-branches) versions of
Python.

Python >= 3.7

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python <= 3.6

If you are using an [end-of-life](https://devguide.python.org/devcycle/#end-of-life-branches)
version of Python, we recommend that you update as soon as possible to an actively supported version.


Mac/Linux
^^^^^^^^^

Expand All @@ -74,12 +92,12 @@ Windows
Next Steps
~~~~~~~~~~

- Read the `Client Library Documentation`_ for Apigee Connect
- Read the `Client Library Documentation`_ for Apigee Connect API
to see other available methods on the client.
- Read the `Apigee Connect Product documentation`_ to learn
- Read the `Apigee Connect API Product documentation`_ to learn
more about the product and see How-to Guides.
- View this `README`_ to see the full list of Cloud
APIs that we cover.

.. _Apigee Connect Product documentation: https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
.. _Apigee Connect API Product documentation: https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
90 changes: 89 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import os
import pathlib
import re
import shutil
import warnings

Expand All @@ -31,7 +32,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",
Expand Down Expand Up @@ -325,3 +326,90 @@ def docfx(session):
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)


@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
def prerelease_deps(session):
"""Run all tests with prerelease versions of dependencies installed."""

# Install all dependencies
session.install("-e", ".[all, tests, tracing]")
session.install(*UNIT_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
# constraints file containing all dependencies and extras.
with open(
CURRENT_DIRECTORY
/ "testing"
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
encoding="utf-8",
) as constraints_file:
constraints_text = constraints_file.read()

# Ignore leading whitespace and comment lines.
constraints_deps = [
match.group(1)
for match in re.finditer(
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
)
]

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(
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
)
session.run("python", "-c", "import grpc; print(grpc.__version__)")

session.run("py.test", "tests/unit")

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")
2 changes: 1 addition & 1 deletion scripts/readme-gen/templates/install_deps.tmpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand All @@ -75,7 +74,7 @@
],
platforms="Posix; MacOS X; Windows",
packages=packages,
python_requires=">=3.6",
python_requires=">=3.7",
namespace_packages=namespaces,
install_requires=dependencies,
include_package_data=True,
Expand Down

0 comments on commit 2df9df8

Please sign in to comment.