11# -*- coding: utf-8 -*-
2- #
3- # Copyright 2024 Google LLC
2+ # Copyright 2025 Google LLC
43#
54# Licensed under the Apache License, Version 2.0 (the "License");
65# you may not use this file except in compliance with the License.
76# You may obtain a copy of the License at
87#
9- # https ://www.apache.org/licenses/LICENSE-2.0
8+ # http ://www.apache.org/licenses/LICENSE-2.0
109#
1110# Unless required by applicable law or agreed to in writing, software
1211# distributed under the License is distributed on an "AS IS" BASIS,
1312# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1413# See the License for the specific language governing permissions and
1514# limitations under the License.
16-
17- # Generated by synthtool. DO NOT EDIT!
18-
19- from __future__ import absolute_import
20-
15+ #
2116import os
2217import pathlib
2318import re
3227
3328LINT_PATHS = ["docs" , "google" , "tests" , "noxfile.py" , "setup.py" ]
3429
35-
36- DEFAULT_PYTHON_VERSION = "3.10"
37-
38- UNIT_TEST_PYTHON_VERSIONS : List [str ] = [
30+ ALL_PYTHON = [
3931 "3.7" ,
4032 "3.8" ,
4133 "3.9" ,
4436 "3.12" ,
4537 "3.13" ,
4638]
39+
40+ DEFAULT_PYTHON_VERSION = ALL_PYTHON [- 1 ]
41+
42+ CURRENT_DIRECTORY = pathlib .Path (__file__ ).parent .absolute ()
43+
44+ LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt"
45+ PACKAGE_NAME = "google-cloud-kms"
46+
4747UNIT_TEST_STANDARD_DEPENDENCIES = [
4848 "mock" ,
4949 "asyncmock" ,
6969SYSTEM_TEST_EXTRAS : List [str ] = []
7070SYSTEM_TEST_EXTRAS_BY_PYTHON : Dict [str , List [str ]] = {}
7171
72- CURRENT_DIRECTORY = pathlib .Path (__file__ ).parent .absolute ()
73-
74- # 'docfx' is excluded since it only needs to run in 'docs-presubmit'
7572nox .options .sessions = [
7673 "unit" ,
7774 "system" ,
8683nox .options .error_on_missing_interpreters = True
8784
8885
86+ @nox .session (python = ALL_PYTHON )
87+ def mypy (session ):
88+ """Run the type checker."""
89+ session .install (
90+ "mypy" ,
91+ "types-requests" ,
92+ "types-protobuf" ,
93+ )
94+ session .install ("." )
95+ session .run (
96+ "mypy" ,
97+ "-p" ,
98+ "google" ,
99+ )
100+
101+
102+ @nox .session
103+ def update_lower_bounds (session ):
104+ """Update lower bounds in constraints.txt to match setup.py"""
105+ session .install ("google-cloud-testutils" )
106+ session .install ("." )
107+
108+ session .run (
109+ "lower-bound-checker" ,
110+ "update" ,
111+ "--package-name" ,
112+ PACKAGE_NAME ,
113+ "--constraints-file" ,
114+ str (LOWER_BOUND_CONSTRAINTS_FILE ),
115+ )
116+
117+
118+ @nox .session
119+ def check_lower_bounds (session ):
120+ """Check lower bounds in setup.py are reflected in constraints file"""
121+ session .install ("google-cloud-testutils" )
122+ session .install ("." )
123+
124+ session .run (
125+ "lower-bound-checker" ,
126+ "check" ,
127+ "--package-name" ,
128+ PACKAGE_NAME ,
129+ "--constraints-file" ,
130+ str (LOWER_BOUND_CONSTRAINTS_FILE ),
131+ )
132+
133+
89134@nox .session (python = DEFAULT_PYTHON_VERSION )
90135def lint (session ):
91136 """Run linters.
@@ -136,7 +181,7 @@ def format(session):
136181@nox .session (python = DEFAULT_PYTHON_VERSION )
137182def lint_setup_py (session ):
138183 """Verify that setup.py is valid (including RST check)."""
139- session .install ("docutils" , "pygments" )
184+ session .install ("setuptools" , " docutils" , "pygments" )
140185 session .run ("python" , "setup.py" , "check" , "--restructuredtext" , "--strict" )
141186
142187
@@ -168,7 +213,7 @@ def install_unittest_dependencies(session, *constraints):
168213 session .install ("-e" , "." , * constraints )
169214
170215
171- @nox .session (python = UNIT_TEST_PYTHON_VERSIONS )
216+ @nox .session (python = ALL_PYTHON )
172217@nox .parametrize (
173218 "protobuf_implementation" ,
174219 ["python" , "upb" , "cpp" ],
@@ -210,10 +255,7 @@ def unit(session, protobuf_implementation):
210255
211256
212257def install_systemtest_dependencies (session , * constraints ):
213- # Use pre-release gRPC for system tests.
214- # Exclude version 1.52.0rc1 which has a known issue.
215- # See https://github.com/grpc/grpc/issues/32163
216- session .install ("--pre" , "grpcio!=1.52.0rc1" )
258+ session .install ("--pre" , "grpcio" )
217259
218260 session .install (* SYSTEM_TEST_STANDARD_DEPENDENCIES , * constraints )
219261
@@ -295,7 +337,7 @@ def cover(session):
295337 session .run ("coverage" , "erase" )
296338
297339
298- @nox .session (python = DEFAULT_PYTHON_VERSION )
340+ @nox .session (python = "3.10" )
299341def docs (session ):
300342 """Build the docs for this library."""
301343
@@ -330,7 +372,7 @@ def docs(session):
330372 )
331373
332374
333- @nox .session (python = DEFAULT_PYTHON_VERSION )
375+ @nox .session (python = "3.10" )
334376def docfx (session ):
335377 """Build the docfx yaml files for this library."""
336378
@@ -376,7 +418,7 @@ def docfx(session):
376418 )
377419
378420
379- @nox .session (python = "3.13" )
421+ @nox .session (python = DEFAULT_PYTHON_VERSION )
380422@nox .parametrize (
381423 "protobuf_implementation" ,
382424 ["python" , "upb" , "cpp" ],
@@ -411,9 +453,7 @@ def prerelease_deps(session, protobuf_implementation):
411453 # version, the first version we test with in the unit tests sessions has a
412454 # constraints file containing all dependencies and extras.
413455 with open (
414- CURRENT_DIRECTORY
415- / "testing"
416- / f"constraints-{ UNIT_TEST_PYTHON_VERSIONS [0 ]} .txt" ,
456+ CURRENT_DIRECTORY / "testing" / f"constraints-{ ALL_PYTHON [0 ]} .txt" ,
417457 encoding = "utf-8" ,
418458 ) as constraints_file :
419459 constraints_text = constraints_file .read ()
@@ -477,7 +517,7 @@ def prerelease_deps(session, protobuf_implementation):
477517 )
478518
479519
480- @nox .session (python = "3.13" )
520+ @nox .session (python = DEFAULT_PYTHON_VERSION )
481521@nox .parametrize (
482522 "protobuf_implementation" ,
483523 ["python" , "upb" ],
@@ -506,9 +546,7 @@ def core_deps_from_source(session, protobuf_implementation):
506546 # version, the first version we test with in the unit tests sessions has a
507547 # constraints file containing all dependencies and extras.
508548 with open (
509- CURRENT_DIRECTORY
510- / "testing"
511- / f"constraints-{ UNIT_TEST_PYTHON_VERSIONS [0 ]} .txt" ,
549+ CURRENT_DIRECTORY / "testing" / f"constraints-{ ALL_PYTHON [0 ]} .txt" ,
512550 encoding = "utf-8" ,
513551 ) as constraints_file :
514552 constraints_text = constraints_file .read ()
@@ -532,10 +570,10 @@ def core_deps_from_source(session, protobuf_implementation):
532570 # Note: If a dependency is added to the `core_dependencies_from_source` list,
533571 # the `prerel_deps` list in the `prerelease_deps` nox session should also be updated.
534572 core_dependencies_from_source = [
535- f" { CURRENT_DIRECTORY } /.. /googleapis-common-protos" ,
573+ "googleapis-common-protos @ git+https://github.com/googleapis/google-cloud-python#egg=googleapis-common-protos&subdirectory=packages /googleapis-common-protos" ,
536574 "google-api-core @ git+https://github.com/googleapis/python-api-core.git" ,
537575 "google-auth @ git+https://github.com/googleapis/google-auth-library-python.git" ,
538- f" { CURRENT_DIRECTORY } /.. /grpc-google-iam-v1" ,
576+ "grpc-google-iam-v1 @ git+https://github.com/googleapis/google-cloud-python#egg=grpc-google-iam-v1&subdirectory=packages /grpc-google-iam-v1" ,
539577 "proto-plus @ git+https://github.com/googleapis/proto-plus-python.git" ,
540578 ]
541579
0 commit comments