Skip to content

Commit

Permalink
fix: require python 3.7+ (#410)
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

* require python 3.7+ in setup.py

* remove python 3.6 sample configs

* exclude templated README

* remove python 3.6 from noxfile

* remove python 3.6 from remaining files

* remove testing/constraints-3.6.txt

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 committed Aug 10, 2022
1 parent 5b5e775 commit 7ddb8c0
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 124 deletions.
4 changes: 2 additions & 2 deletions .github/.OwlBot.lock.yaml
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
# created: 2022-05-05T22:08:23.383410683Z
digest: sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c
# created: 2022-07-05T18:31:20.838186805Z
2 changes: 0 additions & 2 deletions .github/sync-repo-settings.yaml
Expand Up @@ -11,12 +11,10 @@ branchProtectionRules:
# No Kokoro: the following are Github actions
- 'lint'
- 'mypy'
- 'unit-3.6'
- 'unit-3.7'
- 'unit-3.8'
- 'unit-3.9'
- 'unit-3.10'
- 'unit_wo_grpc-3.6'
- 'unit_wo_grpc-3.10'
- 'cover'
- 'docs'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/unittest.yml
Expand Up @@ -13,7 +13,6 @@ jobs:
matrix:
option: ["", "_wo_grpc"]
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
Expand Down
7 changes: 7 additions & 0 deletions .kokoro/continuous/prerelease-deps.cfg
@@ -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
@@ -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
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
16 changes: 1 addition & 15 deletions CONTRIBUTING.rst
Expand Up @@ -21,7 +21,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 @@ -197,13 +197,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 @@ -215,18 +213,6 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-api-core/blob/main/noxfile.py


We also explicitly decided to support Python 3 beginning with version 3.6.
Reasons for this include:

- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
- `Unicode literal support`_ which allows for a cleaner codebase that
works in both Python 2 and Python 3

.. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django
.. _projects: http://flask.pocoo.org/docs/0.10/python3/
.. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/

**********
Versioning
**********
Expand Down
7 changes: 5 additions & 2 deletions README.rst
Expand Up @@ -16,13 +16,16 @@ common helpers used by all Google API clients. For more information, see the

Supported Python Versions
-------------------------
Python >= 3.6
Python >= 3.7


Unsupported Python Versions
---------------------------

Python == 2.7, Python == 3.5.
Python == 2.7, Python == 3.5, Python == 3.6.

The last version of this library compatible with Python 2.7 and 3.5 is
`google-api-core==1.31.1`.

The last version of this library compatible with Python 3.6 is
`google-api-core==2.8.2`.
2 changes: 1 addition & 1 deletion google/api_core/grpc_helpers_async.py
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""AsyncIO helpers for :mod:`grpc` supporting 3.6+.
"""AsyncIO helpers for :mod:`grpc` supporting 3.7+.
Please combine more detailed docstring in grpc_helpers.py to use following
functions. This module is implementing the same surface with AsyncIO semantics.
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
@@ -1,4 +1,4 @@
[mypy]
python_version = 3.6
python_version = 3.7
namespace_packages = True
ignore_missing_imports = True
19 changes: 9 additions & 10 deletions noxfile.py
Expand Up @@ -43,14 +43,14 @@
]


def _greater_or_equal_than_36(version_string):
def _greater_or_equal_than_37(version_string):
tokens = version_string.split(".")
for i, token in enumerate(tokens):
try:
tokens[i] = int(token)
except ValueError:
pass
return tokens >= [3, 6]
return tokens >= [3, 7]


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down Expand Up @@ -122,9 +122,9 @@ def default(session, install_grpc=True):
),
]

# Inject AsyncIO content and proto-plus, if version >= 3.6.
# Inject AsyncIO content and proto-plus, if version >= 3.7.
# proto-plus is needed for a field mask test in test_protobuf_helpers.py
if _greater_or_equal_than_36(session.python):
if _greater_or_equal_than_37(session.python):
session.install("asyncmock", "pytest-asyncio", "proto-plus")

# Having positional arguments means the user wants to run specific tests.
Expand All @@ -136,28 +136,27 @@ def default(session, install_grpc=True):
session.run(*pytest_args)


@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
def unit(session):
"""Run the unit test suite."""
default(session)


@nox.session(python=["3.6", "3.10"])
@nox.session(python=["3.8", "3.10"])
def unit_wo_grpc(session):
"""Run the unit test suite w/o grpcio installed"""
default(session, install_grpc=False)


@nox.session(python="3.6")
@nox.session(python="3.8")
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""

session.install("docutils", "Pygments")
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")


# No 3.7 because pytype supports up to 3.6 only.
@nox.session(python="3.6")
@nox.session(python="3.8")
def pytype(session):
"""Run type-checking."""
session.install(".[grpc]", "pytype >= 2019.3.21")
Expand All @@ -178,7 +177,7 @@ def mypy(session):
session.run("mypy", "google", "tests")


@nox.session(python="3.6")
@nox.session(python="3.8")
def cover(session):
"""Run the final coverage report.
Expand Down
1 change: 1 addition & 0 deletions owlbot.py
Expand Up @@ -30,6 +30,7 @@
".coveragerc", # layout
"CONTRIBUTING.rst", # no systests
".github/workflows/unittest.yml", # exclude unittest gh action
"README.rst",
]
templated_files = common.py_library(microgenerator=True, cov_level=100)
s.move(templated_files, excludes=excludes)
Expand Down
2 changes: 1 addition & 1 deletion scripts/readme-gen/templates/install_deps.tmpl.rst
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
2 changes: 1 addition & 1 deletion setup.cfg
@@ -1,5 +1,5 @@
[pytype]
python_version = 3.6
python_version = 3.7
inputs =
google/
exclude =
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -80,7 +80,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 @@ -93,7 +92,7 @@
namespace_packages=namespaces,
install_requires=dependencies,
extras_require=extras,
python_requires=">=3.6",
python_requires=">=3.7",
include_package_data=True,
zip_safe=False,
)
14 changes: 0 additions & 14 deletions testing/constraints-3.6.txt

This file was deleted.

0 comments on commit 7ddb8c0

Please sign in to comment.