Skip to content

Commit b94a249

Browse files
fix: require python 3.7+ (#459)
* 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 * trigger ci Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 0ed3d4e commit b94a249

File tree

17 files changed

+98
-136
lines changed

17 files changed

+98
-136
lines changed

packages/google-cloud-monitoring/.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 2 deletions
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:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97
17-
# created: 2022-06-12T16:09:31.61859086Z
16+
digest: sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c
17+
# created: 2022-07-05T18:31:20.838186805Z

packages/google-cloud-monitoring/.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
11+
python: ['3.7', '3.8', '3.9', '3.10']
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v3

packages/google-cloud-monitoring/.kokoro/samples/python3.6/common.cfg

Lines changed: 0 additions & 40 deletions
This file was deleted.

packages/google-cloud-monitoring/.kokoro/samples/python3.6/continuous.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/google-cloud-monitoring/.kokoro/samples/python3.6/periodic-head.cfg

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/google-cloud-monitoring/.kokoro/samples/python3.6/periodic.cfg

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/google-cloud-monitoring/.kokoro/samples/python3.6/presubmit.cfg

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/google-cloud-monitoring/.kokoro/test-samples-impl.sh

Lines changed: 2 additions & 2 deletions
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.

packages/google-cloud-monitoring/.repo-metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
"api_id": "monitoring.googleapis.com",
1313
"default_version": "v3",
1414
"codeowner_team": "",
15-
"api_shortname": "monitoring"
15+
"api_shortname": "monitoring",
16+
"api_description": "collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation. Using the BindPlane service, you can also collect this data from over 150 common application components, on-premise systems, and hybrid cloud systems. Stackdriver ingests that data and generates insights via dashboards, charts, and alerts. BindPlane is included with your Google Cloud project at no additional cost."
1617
}

packages/google-cloud-monitoring/CONTRIBUTING.rst

Lines changed: 2 additions & 4 deletions
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-monitoring/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

packages/google-cloud-monitoring/README.rst

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
Python Client for Cloud Monitoring API
2-
=======================================================
1+
Python Client for Stackdriver Monitoring API
2+
============================================
33

4-
|ga| |pypi| |versions|
4+
|stable| |pypi| |versions|
55

6-
`Cloud Monitoring API`_: Manages your Cloud Monitoring data and
7-
configurations. Most projects must be associated with a Google Cloud account,
8-
with a few exceptions as noted on the individual method pages.
6+
`Stackdriver Monitoring API`_: collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation. Using the BindPlane service, you can also collect this data from over 150 common application components, on-premise systems, and hybrid cloud systems. Stackdriver ingests that data and generates insights via dashboards, charts, and alerts. BindPlane is included with your Google Cloud project at no additional cost.
97

108
- `Client Library Documentation`_
119
- `Product Documentation`_
1210

13-
.. |ga| image:: https://img.shields.io/badge/support-GA-gold.svg
14-
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
11+
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
12+
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
1513
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-monitoring.svg
1614
:target: https://pypi.org/project/google-cloud-monitoring/
1715
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-monitoring.svg
1816
:target: https://pypi.org/project/google-cloud-monitoring/
19-
.. _Cloud Monitoring API: https://cloud.google.com/monitoring/api/ref_v3/rest/
17+
.. _Stackdriver Monitoring API: https://cloud.google.com/monitoring/docs
2018
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/monitoring/latest
2119
.. _Product Documentation: https://cloud.google.com/monitoring/docs
2220

@@ -27,12 +25,12 @@ In order to use this library, you first need to go through the following steps:
2725

2826
1. `Select or create a Cloud Platform project.`_
2927
2. `Enable billing for your project.`_
30-
3. `Enable the Cloud Monitoring API.`_
28+
3. `Enable the Stackdriver Monitoring API.`_
3129
4. `Setup Authentication.`_
3230

3331
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
3432
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
35-
.. _Enable the Cloud Monitoring API.: https://cloud.google.com/monitoring/api/enable-api
33+
.. _Enable the Stackdriver Monitoring API.: https://cloud.google.com/monitoring/docs
3634
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
3735

3836
Installation
@@ -49,15 +47,25 @@ dependencies.
4947
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
5048

5149

50+
Code samples and snippets
51+
~~~~~~~~~~~~~~~~~~~~~~~~~
52+
53+
Code samples and snippets live in the `samples/` folder.
54+
55+
5256
Supported Python Versions
5357
^^^^^^^^^^^^^^^^^^^^^^^^^
54-
Python >= 3.6
58+
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
59+
Python.
60+
61+
Python >= 3.7
5562

5663
Unsupported Python Versions
5764
^^^^^^^^^^^^^^^^^^^^^^^^^^^
58-
Python == 2.7.
65+
Python <= 3.6
5966

60-
The last version of this library compatible with Python 2.7 is google-cloud-monitoring==1.1.0.
67+
If you are using an [end-of-life](https://devguide.python.org/devcycle/#end-of-life-branches)
68+
version of Python, we recommend that you update as soon as possible to an actively supported version.
6169

6270

6371
Mac/Linux
@@ -81,12 +89,15 @@ Windows
8189
<your-env>\Scripts\activate
8290
<your-env>\Scripts\pip.exe install google-cloud-monitoring
8391
84-
8592
Next Steps
8693
~~~~~~~~~~
8794

88-
89-
- Read the `Client Library Documentation`_ for Cloud Monitoring API
95+
- Read the `Client Library Documentation`_ for Stackdriver Monitoring API
9096
to see other available methods on the client.
91-
- Read the `Product documentation`_ to learn more about the product and see
92-
How-to Guides.
97+
- Read the `Stackdriver Monitoring API Product documentation`_ to learn
98+
more about the product and see How-to Guides.
99+
- View this `README`_ to see the full list of Cloud
100+
APIs that we cover.
101+
102+
.. _Stackdriver Monitoring API Product documentation: https://cloud.google.com/monitoring/docs
103+
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst

packages/google-cloud-monitoring/noxfile.py

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
DEFAULT_PYTHON_VERSION = "3.8"
3333

34-
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
34+
UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
3535
UNIT_TEST_STANDARD_DEPENDENCIES = [
3636
"mock",
3737
"asyncmock",
@@ -335,28 +335,15 @@ def docfx(session):
335335
def prerelease_deps(session):
336336
"""Run all tests with prerelease versions of dependencies installed."""
337337

338-
prerel_deps = [
339-
"protobuf",
340-
"googleapis-common-protos",
341-
"google-auth",
342-
"grpcio",
343-
"grpcio-status",
344-
"google-api-core",
345-
"proto-plus",
346-
# dependencies of google-auth
347-
"cryptography",
348-
"pyasn1",
349-
]
350-
351-
for dep in prerel_deps:
352-
session.install("--pre", "--no-deps", "--upgrade", dep)
353-
354-
# Remaining dependencies
355-
other_deps = ["requests"]
356-
session.install(*other_deps)
357-
338+
# Install all dependencies
339+
session.install("-e", ".[all, tests, tracing]")
358340
session.install(*UNIT_TEST_STANDARD_DEPENDENCIES)
359-
session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES)
341+
system_deps_all = (
342+
SYSTEM_TEST_STANDARD_DEPENDENCIES
343+
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
344+
+ SYSTEM_TEST_EXTRAS
345+
)
346+
session.install(*system_deps_all)
360347

361348
# Because we test minimum dependency versions on the minimum Python
362349
# version, the first version we test with in the unit tests sessions has a
@@ -370,19 +357,44 @@ def prerelease_deps(session):
370357
constraints_text = constraints_file.read()
371358

372359
# Ignore leading whitespace and comment lines.
373-
deps = [
360+
constraints_deps = [
374361
match.group(1)
375362
for match in re.finditer(
376363
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
377364
)
378365
]
379366

380-
# Don't overwrite prerelease packages.
381-
deps = [dep for dep in deps if dep not in prerel_deps]
382-
# We use --no-deps to ensure that pre-release versions aren't overwritten
383-
# by the version ranges in setup.py.
384-
session.install(*deps)
385-
session.install("--no-deps", "-e", ".[all]")
367+
session.install(*constraints_deps)
368+
369+
if os.path.exists("samples/snippets/requirements.txt"):
370+
session.install("-r", "samples/snippets/requirements.txt")
371+
372+
if os.path.exists("samples/snippets/requirements-test.txt"):
373+
session.install("-r", "samples/snippets/requirements-test.txt")
374+
375+
prerel_deps = [
376+
"protobuf",
377+
# dependency of grpc
378+
"six",
379+
"googleapis-common-protos",
380+
"grpcio",
381+
"grpcio-status",
382+
"google-api-core",
383+
"proto-plus",
384+
"google-cloud-testutils",
385+
# dependencies of google-cloud-testutils"
386+
"click",
387+
]
388+
389+
for dep in prerel_deps:
390+
session.install("--pre", "--no-deps", "--upgrade", dep)
391+
392+
# Remaining dependencies
393+
other_deps = [
394+
"requests",
395+
"google-auth",
396+
]
397+
session.install(*other_deps)
386398

387399
# Print out prerelease package versions
388400
session.run(
@@ -391,5 +403,16 @@ def prerelease_deps(session):
391403
session.run("python", "-c", "import grpc; print(grpc.__version__)")
392404

393405
session.run("py.test", "tests/unit")
394-
session.run("py.test", "tests/system")
395-
session.run("py.test", "samples/snippets")
406+
407+
system_test_path = os.path.join("tests", "system.py")
408+
system_test_folder_path = os.path.join("tests", "system")
409+
410+
# Only run system tests if found.
411+
if os.path.exists(system_test_path) or os.path.exists(system_test_folder_path):
412+
session.run("py.test", "tests/system")
413+
414+
snippets_test_path = os.path.join("samples", "snippets")
415+
416+
# Only run samples tests if found.
417+
if os.path.exists(snippets_test_path):
418+
session.run("py.test", "samples/snippets")

packages/google-cloud-monitoring/samples/snippets/v3/alerts-client/noxfile.py

Lines changed: 1 addition & 1 deletion
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"]

packages/google-cloud-monitoring/samples/snippets/v3/cloud-client/noxfile.py

Lines changed: 1 addition & 1 deletion
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"]

packages/google-cloud-monitoring/samples/snippets/v3/uptime-check-client/noxfile.py

Lines changed: 1 addition & 1 deletion
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"]

packages/google-cloud-monitoring/scripts/readme-gen/templates/install_deps.tmpl.rst

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)