|
26 | 26 |
|
27 | 27 | LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] |
28 | 28 |
|
29 | | -MYPY_VERSION = "mypy==1.10.0" |
30 | 29 | # Add samples to the list of directories to format if the directory exists. |
31 | 30 | if os.path.isdir("samples"): |
32 | 31 | LINT_PATHS.append("samples") |
|
105 | 104 | nox.options.error_on_missing_interpreters = True |
106 | 105 |
|
107 | 106 |
|
| 107 | +MYPY_VERSION = "mypy==1.10.0" |
| 108 | + |
108 | 109 | @nox.session(python=DEFAULT_PYTHON_VERSION) |
109 | 110 | def mypy(session): |
110 | 111 | """Run type checks with mypy.""" |
@@ -152,6 +153,36 @@ def mypy_samples(session): |
152 | 153 | "--no-incremental", # Required by warn-unused-configs from mypy.ini to work |
153 | 154 | "samples/", |
154 | 155 | ) |
| 156 | +@nox.session |
| 157 | +def update_lower_bounds(session): |
| 158 | + """Update lower bounds in constraints.txt to match setup.py""" |
| 159 | + session.install("google-cloud-testutils") |
| 160 | + session.install(".") |
| 161 | + |
| 162 | + session.run( |
| 163 | + "lower-bound-checker", |
| 164 | + "update", |
| 165 | + "--package-name", |
| 166 | + PACKAGE_NAME, |
| 167 | + "--constraints-file", |
| 168 | + str(LOWER_BOUND_CONSTRAINTS_FILE), |
| 169 | + ) |
| 170 | + |
| 171 | + |
| 172 | +@nox.session |
| 173 | +def check_lower_bounds(session): |
| 174 | + """Check lower bounds in setup.py are reflected in constraints file""" |
| 175 | + session.install("google-cloud-testutils") |
| 176 | + session.install(".") |
| 177 | + |
| 178 | + session.run( |
| 179 | + "lower-bound-checker", |
| 180 | + "check", |
| 181 | + "--package-name", |
| 182 | + PACKAGE_NAME, |
| 183 | + "--constraints-file", |
| 184 | + str(LOWER_BOUND_CONSTRAINTS_FILE), |
| 185 | + ) |
155 | 186 |
|
156 | 187 |
|
157 | 188 | @nox.session(python=DEFAULT_PYTHON_VERSION) |
@@ -272,6 +303,8 @@ def unit(session, protobuf_implementation): |
272 | 303 | if session.python in ["3.7", "3.8"]: |
273 | 304 | session.skip(f"Python {session.python} is no longer supported.") |
274 | 305 |
|
| 306 | + # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): |
| 307 | + # Remove this check once support for Protobuf 3.x is dropped. |
275 | 308 | if protobuf_implementation == "cpp" and session.python in ( |
276 | 309 | "3.11", |
277 | 310 | "3.12", |
@@ -520,18 +553,20 @@ def prerelease_deps(session, protobuf_implementation): |
520 | 553 | ) |
521 | 554 | ] |
522 | 555 |
|
| 556 | + # Install dependencies specified in `testing/constraints-X.txt`. |
523 | 557 | session.install(*constraints_deps) |
524 | 558 |
|
| 559 | + # Note: If a dependency is added to the `prerel_deps` list, |
| 560 | + # the `core_dependencies_from_source` list in the `core_deps_from_source` |
| 561 | + # nox session should also be updated. |
525 | 562 | prerel_deps = [ |
526 | | - "protobuf", |
527 | | - # dependency of grpc |
528 | | - "six", |
529 | | - "grpc-google-iam-v1", |
530 | 563 | "googleapis-common-protos", |
531 | | - "grpcio", |
532 | | - "grpcio-status", |
533 | 564 | "google-api-core", |
534 | 565 | "google-auth", |
| 566 | + "grpc-google-iam-v1", |
| 567 | + "grpcio", |
| 568 | + "grpcio-status", |
| 569 | + "protobuf", |
535 | 570 | "proto-plus", |
536 | 571 | "google-cloud-testutils", |
537 | 572 | # dependencies of google-cloud-testutils" |
|
0 commit comments