Skip to content

Commit 52ec808

Browse files
fix: require python 3.7+ (#468)
* 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 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update python_requires in setup.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 06c0270 commit 52ec808

16 files changed

+115
-86
lines changed

.github/.OwlBot.lock.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
17-
# created: 2022-05-05T22:08:23.383410683Z
16+
digest: sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c
17+
# created: 2022-07-05T18:31:20.838186805Z
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "prerelease_deps"
7+
}

.kokoro/presubmit/prerelease-deps.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "prerelease_deps"
7+
}

.kokoro/samples/python3.6/common.cfg

-40
This file was deleted.

.kokoro/samples/python3.6/continuous.cfg

-7
This file was deleted.

.kokoro/samples/python3.6/periodic-head.cfg

-11
This file was deleted.

.kokoro/samples/python3.6/periodic.cfg

-6
This file was deleted.

.kokoro/samples/python3.6/presubmit.cfg

-6
This file was deleted.

.kokoro/test-samples-impl.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export PYTHONUNBUFFERED=1
3333
env | grep KOKORO
3434

3535
# Install nox
36-
python3.6 -m pip install --upgrade --quiet nox
36+
python3.9 -m pip install --upgrade --quiet nox
3737

3838
# Use secrets acessor service account to get secrets
3939
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
@@ -76,7 +76,7 @@ for file in samples/**/requirements.txt; do
7676
echo "------------------------------------------------------------"
7777

7878
# Use nox to execute the tests for the project.
79-
python3.6 -m nox -s "$RUN_TESTS_SESSION"
79+
python3.9 -m nox -s "$RUN_TESTS_SESSION"
8080
EXIT=$?
8181

8282
# If this is a periodic build, send the test log to the FlakyBot.

CONTRIBUTING.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to add a feature:
2222
documentation.
2323

2424
- The feature must work fully on the following CPython versions:
25-
3.6, 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows.
25+
3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows.
2626

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -221,13 +221,11 @@ Supported Python Versions
221221

222222
We support:
223223

224-
- `Python 3.6`_
225224
- `Python 3.7`_
226225
- `Python 3.8`_
227226
- `Python 3.9`_
228227
- `Python 3.10`_
229228

230-
.. _Python 3.6: https://docs.python.org/3.6/
231229
.. _Python 3.7: https://docs.python.org/3.7/
232230
.. _Python 3.8: https://docs.python.org/3.8/
233231
.. _Python 3.9: https://docs.python.org/3.9/
@@ -239,7 +237,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
239237
.. _config: https://github.com/googleapis/python-bigquery-sqlalchemy/blob/main/noxfile.py
240238

241239

242-
We also explicitly decided to support Python 3 beginning with version 3.6.
240+
We also explicitly decided to support Python 3 beginning with version 3.7.
243241
Reasons for this include:
244242

245243
- Encouraging use of newest versions of Python 3

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ dependencies.
5050

5151
Supported Python Versions
5252
^^^^^^^^^^^^^^^^^^^^^^^^^
53-
Python >= 3.6
53+
Python >= 3.7
5454

5555
Unsupported Python Versions
5656
^^^^^^^^^^^^^^^^^^^^^^^^^^^
57-
Python <= 3.5.
57+
Python <= 3.6.
5858

5959

6060
Mac/Linux

noxfile.py

+89-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import os
2121
import pathlib
2222
import re
23+
import re
2324
import shutil
2425
import warnings
2526

@@ -31,7 +32,7 @@
3132

3233
DEFAULT_PYTHON_VERSION = "3.8"
3334

34-
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
35+
UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
3536
UNIT_TEST_STANDARD_DEPENDENCIES = [
3637
"mock",
3738
"asyncmock",
@@ -477,3 +478,90 @@ def docfx(session):
477478
os.path.join("docs", ""),
478479
os.path.join("docs", "_build", "html", ""),
479480
)
481+
482+
483+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
484+
def prerelease_deps(session):
485+
"""Run all tests with prerelease versions of dependencies installed."""
486+
487+
# Install all dependencies
488+
session.install("-e", ".[all, tests, tracing]")
489+
session.install(*UNIT_TEST_STANDARD_DEPENDENCIES)
490+
system_deps_all = (
491+
SYSTEM_TEST_STANDARD_DEPENDENCIES
492+
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
493+
+ SYSTEM_TEST_EXTRAS
494+
)
495+
session.install(*system_deps_all)
496+
497+
# Because we test minimum dependency versions on the minimum Python
498+
# version, the first version we test with in the unit tests sessions has a
499+
# constraints file containing all dependencies and extras.
500+
with open(
501+
CURRENT_DIRECTORY
502+
/ "testing"
503+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
504+
encoding="utf-8",
505+
) as constraints_file:
506+
constraints_text = constraints_file.read()
507+
508+
# Ignore leading whitespace and comment lines.
509+
constraints_deps = [
510+
match.group(1)
511+
for match in re.finditer(
512+
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
513+
)
514+
]
515+
516+
session.install(*constraints_deps)
517+
518+
if os.path.exists("samples/snippets/requirements.txt"):
519+
session.install("-r", "samples/snippets/requirements.txt")
520+
521+
if os.path.exists("samples/snippets/requirements-test.txt"):
522+
session.install("-r", "samples/snippets/requirements-test.txt")
523+
524+
prerel_deps = [
525+
"protobuf",
526+
# dependency of grpc
527+
"six",
528+
"googleapis-common-protos",
529+
"grpcio",
530+
"grpcio-status",
531+
"google-api-core",
532+
"proto-plus",
533+
"google-cloud-testutils",
534+
# dependencies of google-cloud-testutils"
535+
"click",
536+
]
537+
538+
for dep in prerel_deps:
539+
session.install("--pre", "--no-deps", "--upgrade", dep)
540+
541+
# Remaining dependencies
542+
other_deps = [
543+
"requests",
544+
"google-auth",
545+
]
546+
session.install(*other_deps)
547+
548+
# Print out prerelease package versions
549+
session.run(
550+
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
551+
)
552+
session.run("python", "-c", "import grpc; print(grpc.__version__)")
553+
554+
session.run("py.test", "tests/unit")
555+
556+
system_test_path = os.path.join("tests", "system.py")
557+
system_test_folder_path = os.path.join("tests", "system")
558+
559+
# Only run system tests if found.
560+
if os.path.exists(system_test_path) or os.path.exists(system_test_folder_path):
561+
session.run("py.test", "tests/system")
562+
563+
snippets_test_path = os.path.join("samples", "snippets")
564+
565+
# Only run samples tests if found.
566+
if os.path.exists(snippets_test_path):
567+
session.run("py.test", "samples/snippets")

owlbot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"3.10": ["tests", "geography"],
3434
}
3535
templated_files = common.py_library(
36-
unit_test_python_versions=["3.6", "3.7", "3.8", "3.9", "3.10"],
3736
system_test_python_versions=["3.8", "3.10"],
3837
cov_level=100,
3938
unit_test_extras=extras,
@@ -47,6 +46,7 @@
4746
"docs/multiprocessing.rst",
4847
# exclude gh actions as credentials are needed for tests
4948
".github/workflows",
49+
"README.rst",
5050
])
5151

5252
# ----------------------------------------------------------------------------

samples/snippets/noxfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8989

9090
# DO NOT EDIT - automatically generated.
9191
# All versions used to test samples.
92-
ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
92+
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
9393

9494
# Any default versions that should be ignored.
9595
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

scripts/readme-gen/templates/install_deps.tmpl.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Install Dependencies
1212
.. _Python Development Environment Setup Guide:
1313
https://cloud.google.com/python/setup
1414

15-
#. Create a virtualenv. Samples are compatible with Python 3.6+.
15+
#. Create a virtualenv. Samples are compatible with Python 3.7+.
1616

1717
.. code-block:: bash
1818

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def readme():
6969
"License :: OSI Approved :: MIT License",
7070
"Programming Language :: Python",
7171
"Programming Language :: Python :: 3",
72-
"Programming Language :: Python :: 3.6",
7372
"Programming Language :: Python :: 3.7",
7473
"Programming Language :: Python :: 3.8",
7574
"Programming Language :: Python :: 3.9",
@@ -96,7 +95,7 @@ def readme():
9695
"future",
9796
],
9897
extras_require=extras,
99-
python_requires=">=3.6, <3.11",
98+
python_requires=">=3.7, <3.11",
10099
tests_require=["packaging", "pytz"],
101100
entry_points={
102101
"sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"]

0 commit comments

Comments
 (0)