From 36984972fcb843bf1fa6aea956a1451b053574d1 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 27 Nov 2025 15:30:50 +0000 Subject: [PATCH 1/3] chore: remove code formatting for noxfile.py --- gapic/templates/noxfile.py.j2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gapic/templates/noxfile.py.j2 b/gapic/templates/noxfile.py.j2 index 274ca368e0..d6065e4a7b 100644 --- a/gapic/templates/noxfile.py.j2 +++ b/gapic/templates/noxfile.py.j2 @@ -16,14 +16,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" {% if api.naming.module_namespace %} +FORMAT_PATHS = ["docs", "{{ api.naming.module_namespace[0] }}", "tests", "setup.py"] LINT_PATHS = ["docs", "{{ api.naming.module_namespace[0] }}", "tests", "noxfile.py", "setup.py"] {% else %} +FORMAT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests", "setup.py"] LINT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests", "noxfile.py", "setup.py"] {% endif %} # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -167,7 +170,7 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, ) @@ -183,11 +186,11 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, ) From 12878e4d5ec36bd7ec4e215af8fefcdaa8f70c7e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 27 Nov 2025 20:26:46 +0000 Subject: [PATCH 2/3] fix formatting/update goldens --- gapic/templates/noxfile.py.j2 | 68 ++++++++--------- tests/integration/goldens/asset/noxfile.py | 76 +++++++++---------- .../goldens/credentials/noxfile.py | 76 +++++++++---------- tests/integration/goldens/eventarc/noxfile.py | 76 +++++++++---------- tests/integration/goldens/logging/noxfile.py | 76 +++++++++---------- .../goldens/logging_internal/noxfile.py | 76 +++++++++---------- tests/integration/goldens/redis/noxfile.py | 76 +++++++++---------- .../goldens/redis_selective/noxfile.py | 76 +++++++++---------- 8 files changed, 291 insertions(+), 309 deletions(-) diff --git a/gapic/templates/noxfile.py.j2 b/gapic/templates/noxfile.py.j2 index d6065e4a7b..e11bf34bcf 100644 --- a/gapic/templates/noxfile.py.j2 +++ b/gapic/templates/noxfile.py.j2 @@ -23,6 +23,10 @@ FORMAT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests", "setu LINT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests", "noxfile.py", "setup.py"] {% endif %} +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") @@ -155,6 +159,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) {% if api.naming.module_namespace %} @@ -171,6 +176,7 @@ def blacken(session): session.run( "black", *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -191,6 +197,7 @@ def format(session): session.run( "black", *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -207,8 +214,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -239,12 +245,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -307,9 +316,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -386,8 +393,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -455,7 +464,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -466,11 +480,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -482,13 +492,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -559,11 +564,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -575,13 +576,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) diff --git a/tests/integration/goldens/asset/noxfile.py b/tests/integration/goldens/asset/noxfile.py index 487acba725..c0c32cce8d 100755 --- a/tests/integration/goldens/asset/noxfile.py +++ b/tests/integration/goldens/asset/noxfile.py @@ -26,11 +26,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" +FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -155,6 +161,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) session.run("flake8", "google", "tests") @@ -166,7 +173,8 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -182,11 +190,12 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -203,8 +212,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -235,12 +243,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -298,9 +309,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -377,8 +386,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -446,7 +457,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -457,11 +473,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -473,13 +485,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -550,11 +557,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -566,13 +569,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) diff --git a/tests/integration/goldens/credentials/noxfile.py b/tests/integration/goldens/credentials/noxfile.py index af4ba3e285..488c013ac7 100755 --- a/tests/integration/goldens/credentials/noxfile.py +++ b/tests/integration/goldens/credentials/noxfile.py @@ -26,11 +26,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" +FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -155,6 +161,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) session.run("flake8", "google", "tests") @@ -166,7 +173,8 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -182,11 +190,12 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -203,8 +212,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -235,12 +243,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -298,9 +309,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -377,8 +386,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -446,7 +457,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -457,11 +473,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -473,13 +485,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -550,11 +557,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -566,13 +569,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) diff --git a/tests/integration/goldens/eventarc/noxfile.py b/tests/integration/goldens/eventarc/noxfile.py index c718640903..228dccbbed 100755 --- a/tests/integration/goldens/eventarc/noxfile.py +++ b/tests/integration/goldens/eventarc/noxfile.py @@ -26,11 +26,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" +FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -155,6 +161,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) session.run("flake8", "google", "tests") @@ -166,7 +173,8 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -182,11 +190,12 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -203,8 +212,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -235,12 +243,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -298,9 +309,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -377,8 +386,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -446,7 +457,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -457,11 +473,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -473,13 +485,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -550,11 +557,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -566,13 +569,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) diff --git a/tests/integration/goldens/logging/noxfile.py b/tests/integration/goldens/logging/noxfile.py index 8bf90a69f4..106be18e72 100755 --- a/tests/integration/goldens/logging/noxfile.py +++ b/tests/integration/goldens/logging/noxfile.py @@ -26,11 +26,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" +FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -155,6 +161,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) session.run("flake8", "google", "tests") @@ -166,7 +173,8 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -182,11 +190,12 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -203,8 +212,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -235,12 +243,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -298,9 +309,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -377,8 +386,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -446,7 +457,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -457,11 +473,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -473,13 +485,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -550,11 +557,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -566,13 +569,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) diff --git a/tests/integration/goldens/logging_internal/noxfile.py b/tests/integration/goldens/logging_internal/noxfile.py index 8bf90a69f4..106be18e72 100755 --- a/tests/integration/goldens/logging_internal/noxfile.py +++ b/tests/integration/goldens/logging_internal/noxfile.py @@ -26,11 +26,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" +FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -155,6 +161,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) session.run("flake8", "google", "tests") @@ -166,7 +173,8 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -182,11 +190,12 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -203,8 +212,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -235,12 +243,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -298,9 +309,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -377,8 +386,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -446,7 +457,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -457,11 +473,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -473,13 +485,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -550,11 +557,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -566,13 +569,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) diff --git a/tests/integration/goldens/redis/noxfile.py b/tests/integration/goldens/redis/noxfile.py index 4349f5147d..490680cd3d 100755 --- a/tests/integration/goldens/redis/noxfile.py +++ b/tests/integration/goldens/redis/noxfile.py @@ -26,11 +26,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" +FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -155,6 +161,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) session.run("flake8", "google", "tests") @@ -166,7 +173,8 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -182,11 +190,12 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -203,8 +212,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -235,12 +243,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -298,9 +309,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -377,8 +386,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -446,7 +457,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -457,11 +473,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -473,13 +485,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -550,11 +557,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -566,13 +569,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) diff --git a/tests/integration/goldens/redis_selective/noxfile.py b/tests/integration/goldens/redis_selective/noxfile.py index 4349f5147d..490680cd3d 100755 --- a/tests/integration/goldens/redis_selective/noxfile.py +++ b/tests/integration/goldens/redis_selective/noxfile.py @@ -26,11 +26,17 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" +FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +# We're most interested in ensuring that code is formatted properly +# and less concerned about the line length. +LINT_LINE_LENGTH = 150 + # Add samples to the list of directories to format if the directory exists. if os.path.isdir("samples"): LINT_PATHS.append("samples") + FORMAT_PATHS.append("samples") ALL_PYTHON = [ "3.7", @@ -155,6 +161,7 @@ def lint(session): "black", "--check", *LINT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) session.run("flake8", "google", "tests") @@ -166,7 +173,8 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -182,11 +190,12 @@ def format(session): session.run( "isort", "--fss", - *LINT_PATHS, + *FORMAT_PATHS, ) session.run( "black", - *LINT_PATHS, + *FORMAT_PATHS, + f"--line-length={LINT_LINE_LENGTH}", ) @@ -203,8 +212,7 @@ def install_unittest_dependencies(session, *constraints): if UNIT_TEST_EXTERNAL_DEPENDENCIES: warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + "'unit_test_external_dependencies' is deprecated. Instead, please use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", DeprecationWarning, ) session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -235,12 +243,15 @@ def unit(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") install_unittest_dependencies(session, "-c", constraints_path) # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): @@ -298,9 +309,7 @@ def install_systemtest_dependencies(session, *constraints): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + constraints_path = str(CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt") system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -377,8 +386,10 @@ def docs(session): "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors - "-b", "html", # builder - "-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory + "-b", # builder + "html", + "-d", # cache directory + os.path.join("docs", "_build", "doctrees", ""), # paths to build: os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), @@ -446,7 +457,12 @@ def prerelease_deps(session, protobuf_implementation): # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove this check once support for Protobuf 3.x is dropped. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13", "3.14"): + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies @@ -457,11 +473,7 @@ def prerelease_deps(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -473,13 +485,8 @@ def prerelease_deps(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) @@ -550,11 +557,7 @@ def core_deps_from_source(session, protobuf_implementation): session.install(*unit_deps_all) # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) + system_deps_all = SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + SYSTEM_TEST_EXTRAS session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python @@ -566,13 +569,8 @@ def core_deps_from_source(session, protobuf_implementation): ) as constraints_file: constraints_text = constraints_file.read() - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] + # Ignore leading spaces and comment lines. + constraints_deps = [match.group(1) for match in re.finditer(r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE)] # Install dependencies specified in `testing/constraints-X.txt`. session.install(*constraints_deps) From 01d10b8b65001ac9151a2e79cee394a1b3594479 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 27 Nov 2025 16:52:30 +0000 Subject: [PATCH 3/3] chore: remove code formatting for setup.py --- gapic/templates/noxfile.py.j2 | 4 ++-- gapic/templates/setup.py.j2 | 22 +++++++++---------- tests/integration/goldens/asset/noxfile.py | 2 +- tests/integration/goldens/asset/setup.py | 17 +++++--------- .../goldens/credentials/noxfile.py | 2 +- .../integration/goldens/credentials/setup.py | 17 +++++--------- tests/integration/goldens/eventarc/noxfile.py | 2 +- tests/integration/goldens/eventarc/setup.py | 17 +++++--------- tests/integration/goldens/logging/noxfile.py | 2 +- tests/integration/goldens/logging/setup.py | 17 +++++--------- .../goldens/logging_internal/noxfile.py | 2 +- .../goldens/logging_internal/setup.py | 17 +++++--------- tests/integration/goldens/redis/noxfile.py | 2 +- tests/integration/goldens/redis/setup.py | 16 +++++--------- .../goldens/redis_selective/noxfile.py | 2 +- .../goldens/redis_selective/setup.py | 16 +++++--------- 16 files changed, 61 insertions(+), 96 deletions(-) diff --git a/gapic/templates/noxfile.py.j2 b/gapic/templates/noxfile.py.j2 index e11bf34bcf..05c63514fc 100644 --- a/gapic/templates/noxfile.py.j2 +++ b/gapic/templates/noxfile.py.j2 @@ -16,10 +16,10 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" {% if api.naming.module_namespace %} -FORMAT_PATHS = ["docs", "{{ api.naming.module_namespace[0] }}", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "{{ api.naming.module_namespace[0] }}", "tests"] LINT_PATHS = ["docs", "{{ api.naming.module_namespace[0] }}", "tests", "noxfile.py", "setup.py"] {% else %} -FORMAT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests"] LINT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests", "noxfile.py", "setup.py"] {% endif %} diff --git a/gapic/templates/setup.py.j2 b/gapic/templates/setup.py.j2 index 6573b942db..83d5beb5fc 100644 --- a/gapic/templates/setup.py.j2 +++ b/gapic/templates/setup.py.j2 @@ -9,11 +9,11 @@ import io import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = '{{ api.naming.warehouse_package_name }}' +name = "{{ api.naming.warehouse_package_name }}" {% set warehouse_description = api.naming.warehouse_package_name.replace('-',' ')|title %} @@ -22,9 +22,9 @@ description = "{{ warehouse_description }} API client library" version = None -with open(os.path.join(package_root, '{{ package_path }}/gapic_version.py')) as fp: +with open(os.path.join(package_root, "{{ package_path }}/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -52,14 +52,16 @@ dependencies = [ {% endif %} {% endfor %} ] -extras = { {% if rest_async_io_enabled %} +extras = { "async_rest": [ "google-api-core[grpc] >= 2.21.0, < 3.0.0", - "google-auth[aiohttp] >= 2.35.0, <3.0.0" + "google-auth[aiohttp] >= 2.35.0, <3.0.0", ], -{% endif %} } +{% else %} +extras = {} +{% endif %} url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/{{ api.naming.warehouse_package_name }}" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -68,11 +70,7 @@ readme_filename = os.path.join(package_root, "README.rst") with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("{{ api.naming.namespace_packages|first }}") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("{{ api.naming.namespace_packages|first }}")] setuptools.setup( name=name, diff --git a/tests/integration/goldens/asset/noxfile.py b/tests/integration/goldens/asset/noxfile.py index c0c32cce8d..7d7bf9dd01 100755 --- a/tests/integration/goldens/asset/noxfile.py +++ b/tests/integration/goldens/asset/noxfile.py @@ -26,7 +26,7 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" -FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "google", "tests"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] # We're most interested in ensuring that code is formatted properly diff --git a/tests/integration/goldens/asset/setup.py b/tests/integration/goldens/asset/setup.py index db0a03c590..abb89ed57d 100755 --- a/tests/integration/goldens/asset/setup.py +++ b/tests/integration/goldens/asset/setup.py @@ -17,20 +17,20 @@ import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = 'google-cloud-asset' +name = "google-cloud-asset" description = "Google Cloud Asset API client library" version = None -with open(os.path.join(package_root, 'google/cloud/asset/gapic_version.py')) as fp: +with open(os.path.join(package_root, "google/cloud/asset/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -52,8 +52,7 @@ "google-cloud-os-config >= 1.0.0, <2.0.0", "grpc-google-iam-v1 >= 0.14.0, <1.0.0", ] -extras = { -} +extras = {} url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-asset" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -62,11 +61,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("google")] setuptools.setup( name=name, diff --git a/tests/integration/goldens/credentials/noxfile.py b/tests/integration/goldens/credentials/noxfile.py index 488c013ac7..0bdd1e0e2d 100755 --- a/tests/integration/goldens/credentials/noxfile.py +++ b/tests/integration/goldens/credentials/noxfile.py @@ -26,7 +26,7 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" -FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "google", "tests"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] # We're most interested in ensuring that code is formatted properly diff --git a/tests/integration/goldens/credentials/setup.py b/tests/integration/goldens/credentials/setup.py index eaba6dcd0c..1d0595cceb 100755 --- a/tests/integration/goldens/credentials/setup.py +++ b/tests/integration/goldens/credentials/setup.py @@ -17,20 +17,20 @@ import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = 'google-iam-credentials' +name = "google-iam-credentials" description = "Google Iam Credentials API client library" version = None -with open(os.path.join(package_root, 'google/iam/credentials/gapic_version.py')) as fp: +with open(os.path.join(package_root, "google/iam/credentials/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -49,8 +49,7 @@ "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] -extras = { -} +extras = {} url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-iam-credentials" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -59,11 +58,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("google")] setuptools.setup( name=name, diff --git a/tests/integration/goldens/eventarc/noxfile.py b/tests/integration/goldens/eventarc/noxfile.py index 228dccbbed..378ae33db2 100755 --- a/tests/integration/goldens/eventarc/noxfile.py +++ b/tests/integration/goldens/eventarc/noxfile.py @@ -26,7 +26,7 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" -FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "google", "tests"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] # We're most interested in ensuring that code is formatted properly diff --git a/tests/integration/goldens/eventarc/setup.py b/tests/integration/goldens/eventarc/setup.py index 8f8887b4d5..1fbd68895b 100755 --- a/tests/integration/goldens/eventarc/setup.py +++ b/tests/integration/goldens/eventarc/setup.py @@ -17,20 +17,20 @@ import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = 'google-cloud-eventarc' +name = "google-cloud-eventarc" description = "Google Cloud Eventarc API client library" version = None -with open(os.path.join(package_root, 'google/cloud/eventarc_v1/gapic_version.py')) as fp: +with open(os.path.join(package_root, "google/cloud/eventarc_v1/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -50,8 +50,7 @@ "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.14.0, <1.0.0", ] -extras = { -} +extras = {} url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-eventarc" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -60,11 +59,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("google")] setuptools.setup( name=name, diff --git a/tests/integration/goldens/logging/noxfile.py b/tests/integration/goldens/logging/noxfile.py index 106be18e72..c259a1927b 100755 --- a/tests/integration/goldens/logging/noxfile.py +++ b/tests/integration/goldens/logging/noxfile.py @@ -26,7 +26,7 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" -FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "google", "tests"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] # We're most interested in ensuring that code is formatted properly diff --git a/tests/integration/goldens/logging/setup.py b/tests/integration/goldens/logging/setup.py index cb6015c69b..05259f6fc8 100755 --- a/tests/integration/goldens/logging/setup.py +++ b/tests/integration/goldens/logging/setup.py @@ -17,20 +17,20 @@ import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = 'google-cloud-logging' +name = "google-cloud-logging" description = "Google Cloud Logging API client library" version = None -with open(os.path.join(package_root, 'google/cloud/logging/gapic_version.py')) as fp: +with open(os.path.join(package_root, "google/cloud/logging/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -49,8 +49,7 @@ "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] -extras = { -} +extras = {} url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-logging" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -59,11 +58,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("google")] setuptools.setup( name=name, diff --git a/tests/integration/goldens/logging_internal/noxfile.py b/tests/integration/goldens/logging_internal/noxfile.py index 106be18e72..c259a1927b 100755 --- a/tests/integration/goldens/logging_internal/noxfile.py +++ b/tests/integration/goldens/logging_internal/noxfile.py @@ -26,7 +26,7 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" -FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "google", "tests"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] # We're most interested in ensuring that code is formatted properly diff --git a/tests/integration/goldens/logging_internal/setup.py b/tests/integration/goldens/logging_internal/setup.py index cb6015c69b..05259f6fc8 100755 --- a/tests/integration/goldens/logging_internal/setup.py +++ b/tests/integration/goldens/logging_internal/setup.py @@ -17,20 +17,20 @@ import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = 'google-cloud-logging' +name = "google-cloud-logging" description = "Google Cloud Logging API client library" version = None -with open(os.path.join(package_root, 'google/cloud/logging/gapic_version.py')) as fp: +with open(os.path.join(package_root, "google/cloud/logging/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -49,8 +49,7 @@ "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] -extras = { -} +extras = {} url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-logging" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -59,11 +58,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("google")] setuptools.setup( name=name, diff --git a/tests/integration/goldens/redis/noxfile.py b/tests/integration/goldens/redis/noxfile.py index 490680cd3d..f93c939a62 100755 --- a/tests/integration/goldens/redis/noxfile.py +++ b/tests/integration/goldens/redis/noxfile.py @@ -26,7 +26,7 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" -FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "google", "tests"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] # We're most interested in ensuring that code is formatted properly diff --git a/tests/integration/goldens/redis/setup.py b/tests/integration/goldens/redis/setup.py index 026674b2d3..da19ddbd0b 100755 --- a/tests/integration/goldens/redis/setup.py +++ b/tests/integration/goldens/redis/setup.py @@ -17,20 +17,20 @@ import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = 'google-cloud-redis' +name = "google-cloud-redis" description = "Google Cloud Redis API client library" version = None -with open(os.path.join(package_root, 'google/cloud/redis/gapic_version.py')) as fp: +with open(os.path.join(package_root, "google/cloud/redis/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -52,7 +52,7 @@ extras = { "async_rest": [ "google-api-core[grpc] >= 2.21.0, < 3.0.0", - "google-auth[aiohttp] >= 2.35.0, <3.0.0" + "google-auth[aiohttp] >= 2.35.0, <3.0.0", ], } url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-redis" @@ -63,11 +63,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("google")] setuptools.setup( name=name, diff --git a/tests/integration/goldens/redis_selective/noxfile.py b/tests/integration/goldens/redis_selective/noxfile.py index 490680cd3d..f93c939a62 100755 --- a/tests/integration/goldens/redis_selective/noxfile.py +++ b/tests/integration/goldens/redis_selective/noxfile.py @@ -26,7 +26,7 @@ BLACK_VERSION = "black[jupyter]==23.7.0" ISORT_VERSION = "isort==5.11.0" -FORMAT_PATHS = ["docs", "google", "tests", "setup.py"] +FORMAT_PATHS = ["docs", "google", "tests"] LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] # We're most interested in ensuring that code is formatted properly diff --git a/tests/integration/goldens/redis_selective/setup.py b/tests/integration/goldens/redis_selective/setup.py index 026674b2d3..da19ddbd0b 100755 --- a/tests/integration/goldens/redis_selective/setup.py +++ b/tests/integration/goldens/redis_selective/setup.py @@ -17,20 +17,20 @@ import os import re -import setuptools # type: ignore +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -name = 'google-cloud-redis' +name = "google-cloud-redis" description = "Google Cloud Redis API client library" version = None -with open(os.path.join(package_root, 'google/cloud/redis/gapic_version.py')) as fp: +with open(os.path.join(package_root, "google/cloud/redis/gapic_version.py")) as fp: version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) + assert len(version_candidates) == 1 version = version_candidates[0] if version[0] == "0": @@ -52,7 +52,7 @@ extras = { "async_rest": [ "google-api-core[grpc] >= 2.21.0, < 3.0.0", - "google-auth[aiohttp] >= 2.35.0, <3.0.0" + "google-auth[aiohttp] >= 2.35.0, <3.0.0", ], } url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-redis" @@ -63,11 +63,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] +packages = [package for package in setuptools.find_namespace_packages() if package.startswith("google")] setuptools.setup( name=name,