|
326 | 326 | if count < 1:
|
327 | 327 | raise Exception(".coveragerc replacement failed.")
|
328 | 328 |
|
329 |
| - s.move([library], excludes=["**/gapic_version.py", "README.rst", "docs/**/*", "setup.py", "testing/constraints-3.7.txt", "testing/constraints-3.8.txt"]) |
| 329 | + s.move([library], excludes=["**/gapic_version.py", "noxfile.py", "README.rst", "docs/**/*", "setup.py", "testing/constraints-3.7.txt", "testing/constraints-3.8.txt"]) |
330 | 330 | s.remove_staging_dirs()
|
331 | 331 |
|
332 | 332 | # ----------------------------------------------------------------------------
|
|
345 | 345 | )
|
346 | 346 | s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml", "README.rst", "docs/index.rst"])
|
347 | 347 |
|
348 |
| -# ---------------------------------------------------------------------------- |
349 |
| -# Add mypy nox session. |
350 |
| -# ---------------------------------------------------------------------------- |
351 |
| -s.replace( |
352 |
| - "noxfile.py", |
353 |
| - r"LINT_PATHS = \[.*?\]", |
354 |
| - '\g<0>\n\nMYPY_VERSION = "mypy==1.10.0"', |
355 |
| -) |
356 |
| -s.replace( |
357 |
| - "noxfile.py", r'"blacken",', '\g<0>\n "mypy",', |
358 |
| -) |
359 |
| -s.replace( |
360 |
| - "noxfile.py", |
361 |
| - r"nox\.options\.error_on_missing_interpreters = True", |
362 |
| - textwrap.dedent( |
363 |
| - ''' \g<0> |
364 |
| -
|
365 |
| -
|
366 |
| - @nox.session(python=DEFAULT_PYTHON_VERSION) |
367 |
| - def mypy(session): |
368 |
| - """Run type checks with mypy.""" |
369 |
| - session.install("-e", ".[all]") |
370 |
| - session.install(MYPY_VERSION) |
371 |
| -
|
372 |
| - # Version 2.1.1 of google-api-core version is the first type-checked release. |
373 |
| - # Version 2.2.0 of google-cloud-core version is the first type-checked release. |
374 |
| - session.install( |
375 |
| - "google-api-core[grpc]>=2.1.1", |
376 |
| - "google-cloud-core>=2.2.0", |
377 |
| - ) |
378 |
| -
|
379 |
| - # Just install the type info directly, since "mypy --install-types" might |
380 |
| - # require an additional pass. |
381 |
| - # Exclude types-protobuf==4.24.0.20240106 |
382 |
| - # See https://github.com/python/typeshed/issues/11254 |
383 |
| - session.install("types-protobuf!=4.24.0.20240106", "types-setuptools") |
384 |
| -
|
385 |
| - # TODO: Only check the hand-written layer, the generated code does not pass |
386 |
| - # mypy checks yet. |
387 |
| - # https://github.com/googleapis/gapic-generator-python/issues/1092 |
388 |
| - session.run("mypy", "-p", "google.cloud")''' |
389 |
| - ), |
390 |
| -) |
391 |
| - |
392 |
| - |
393 |
| -# ---------------------------------------------------------------------------- |
394 |
| -# Add mypy_samples nox session. |
395 |
| -# ---------------------------------------------------------------------------- |
396 |
| -s.replace( |
397 |
| - "noxfile.py", |
398 |
| - r' "mypy",', |
399 |
| - '\g<0>\n # https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936' |
400 |
| - '\n # "mypy_samples", # TODO: uncomment when the check passes', |
401 |
| -) |
402 |
| -s.replace( |
403 |
| - "noxfile.py", |
404 |
| - r'session\.run\("mypy", "-p", "google.cloud"\)', |
405 |
| - textwrap.dedent( |
406 |
| - ''' \g<0> |
407 |
| -
|
408 |
| -
|
409 |
| - @nox.session(python=DEFAULT_PYTHON_VERSION) |
410 |
| - def mypy_samples(session): |
411 |
| - """Run type checks with mypy.""" |
412 |
| -
|
413 |
| - session.install("-e", ".[all]") |
414 |
| -
|
415 |
| - session.install("pytest") |
416 |
| - session.install(MYPY_VERSION) |
417 |
| -
|
418 |
| - # Just install the type info directly, since "mypy --install-types" might |
419 |
| - # require an additional pass. |
420 |
| - session.install("types-mock", "types-protobuf", "types-setuptools") |
421 |
| -
|
422 |
| - session.run( |
423 |
| - "mypy", |
424 |
| - "--config-file", |
425 |
| - str(CURRENT_DIRECTORY / "samples" / "snippets" / "mypy.ini"), |
426 |
| - "--no-incremental", # Required by warn-unused-configs from mypy.ini to work |
427 |
| - "samples/", |
428 |
| - )''' |
429 |
| - ), |
430 |
| -) |
431 |
| - |
432 |
| - |
433 |
| -# Only consider the hand-written layer when assessing the test coverage. |
434 |
| -s.replace( |
435 |
| - "noxfile.py", "--cov=google", "--cov=google/cloud", |
436 |
| -) |
437 |
| - |
438 | 348 | s.replace(".github/blunderbuss.yml", "googleapis/api-pubsub", "mukund-ananthu")
|
439 | 349 |
|
440 | 350 | python.py_samples(skip_readmes=True)
|
|
0 commit comments