diff --git a/docs/conf.py b/docs/conf.py index b507b408e..1815da57a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -347,10 +347,7 @@ intersphinx_mapping = { "python": ("http://python.readthedocs.org/en/latest/", None), "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google.api_core": ( - "https://googleapis.dev/python/google-api-core/latest/", - None, - ), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), "grpc": ("https://grpc.io/grpc/python/", None), } diff --git a/google/cloud/logging_v2/gapic/config_service_v2_client.py b/google/cloud/logging_v2/gapic/config_service_v2_client.py index d3d08370e..37dafa34a 100644 --- a/google/cloud/logging_v2/gapic/config_service_v2_client.py +++ b/google/cloud/logging_v2/gapic/config_service_v2_client.py @@ -40,9 +40,7 @@ from google.protobuf import field_mask_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( - "google-cloud-logging", -).version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-logging",).version class ConfigServiceV2Client(object): @@ -79,8 +77,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): def billing_path(cls, billing_account): """Return a fully-qualified billing string.""" return google.api_core.path_template.expand( - "billingAccounts/{billing_account}", - billing_account=billing_account, + "billingAccounts/{billing_account}", billing_account=billing_account, ) @classmethod @@ -113,10 +110,7 @@ def exclusion_path(cls, project, exclusion): @classmethod def folder_path(cls, folder): """Return a fully-qualified folder string.""" - return google.api_core.path_template.expand( - "folders/{folder}", - folder=folder, - ) + return google.api_core.path_template.expand("folders/{folder}", folder=folder,) @classmethod def folder_exclusion_path(cls, folder, exclusion): @@ -131,17 +125,14 @@ def folder_exclusion_path(cls, folder, exclusion): def folder_sink_path(cls, folder, sink): """Return a fully-qualified folder_sink string.""" return google.api_core.path_template.expand( - "folders/{folder}/sinks/{sink}", - folder=folder, - sink=sink, + "folders/{folder}/sinks/{sink}", folder=folder, sink=sink, ) @classmethod def organization_path(cls, organization): """Return a fully-qualified organization string.""" return google.api_core.path_template.expand( - "organizations/{organization}", - organization=organization, + "organizations/{organization}", organization=organization, ) @classmethod @@ -166,17 +157,14 @@ def organization_sink_path(cls, organization, sink): def project_path(cls, project): """Return a fully-qualified project string.""" return google.api_core.path_template.expand( - "projects/{project}", - project=project, + "projects/{project}", project=project, ) @classmethod def sink_path(cls, project, sink): """Return a fully-qualified sink string.""" return google.api_core.path_template.expand( - "projects/{project}/sinks/{sink}", - project=project, - sink=sink, + "projects/{project}/sinks/{sink}", project=project, sink=sink, ) def __init__( @@ -265,12 +253,8 @@ def __init__( ) self.transport = transport else: - self.transport = ( - config_service_v2_grpc_transport.ConfigServiceV2GrpcTransport( - address=api_endpoint, - channel=channel, - credentials=credentials, - ) + self.transport = config_service_v2_grpc_transport.ConfigServiceV2GrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: @@ -376,8 +360,7 @@ def list_sinks( ) request = logging_config_pb2.ListSinksRequest( - parent=parent, - page_size=page_size, + parent=parent, page_size=page_size, ) if metadata is None: metadata = [] @@ -467,9 +450,7 @@ def get_sink( client_info=self._client_info, ) - request = logging_config_pb2.GetSinkRequest( - sink_name=sink_name, - ) + request = logging_config_pb2.GetSinkRequest(sink_name=sink_name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -573,9 +554,7 @@ def create_sink( ) request = logging_config_pb2.CreateSinkRequest( - parent=parent, - sink=sink, - unique_writer_identity=unique_writer_identity, + parent=parent, sink=sink, unique_writer_identity=unique_writer_identity, ) if metadata is None: metadata = [] @@ -780,9 +759,7 @@ def delete_sink( client_info=self._client_info, ) - request = logging_config_pb2.DeleteSinkRequest( - sink_name=sink_name, - ) + request = logging_config_pb2.DeleteSinkRequest(sink_name=sink_name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -880,8 +857,7 @@ def list_exclusions( ) request = logging_config_pb2.ListExclusionsRequest( - parent=parent, - page_size=page_size, + parent=parent, page_size=page_size, ) if metadata is None: metadata = [] @@ -971,9 +947,7 @@ def get_exclusion( client_info=self._client_info, ) - request = logging_config_pb2.GetExclusionRequest( - name=name, - ) + request = logging_config_pb2.GetExclusionRequest(name=name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1064,8 +1038,7 @@ def create_exclusion( ) request = logging_config_pb2.CreateExclusionRequest( - parent=parent, - exclusion=exclusion, + parent=parent, exclusion=exclusion, ) if metadata is None: metadata = [] @@ -1169,9 +1142,7 @@ def update_exclusion( ) request = logging_config_pb2.UpdateExclusionRequest( - name=name, - exclusion=exclusion, - update_mask=update_mask, + name=name, exclusion=exclusion, update_mask=update_mask, ) if metadata is None: metadata = [] @@ -1247,9 +1218,7 @@ def delete_exclusion( client_info=self._client_info, ) - request = logging_config_pb2.DeleteExclusionRequest( - name=name, - ) + request = logging_config_pb2.DeleteExclusionRequest(name=name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1337,9 +1306,7 @@ def get_cmek_settings( client_info=self._client_info, ) - request = logging_config_pb2.GetCmekSettingsRequest( - name=name, - ) + request = logging_config_pb2.GetCmekSettingsRequest(name=name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1455,9 +1422,7 @@ def update_cmek_settings( ) request = logging_config_pb2.UpdateCmekSettingsRequest( - name=name, - cmek_settings=cmek_settings, - update_mask=update_mask, + name=name, cmek_settings=cmek_settings, update_mask=update_mask, ) if metadata is None: metadata = [] diff --git a/google/cloud/logging_v2/gapic/logging_service_v2_client.py b/google/cloud/logging_v2/gapic/logging_service_v2_client.py index c823deacb..c43506d1b 100644 --- a/google/cloud/logging_v2/gapic/logging_service_v2_client.py +++ b/google/cloud/logging_v2/gapic/logging_service_v2_client.py @@ -44,9 +44,7 @@ from google.protobuf import field_mask_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( - "google-cloud-logging", -).version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-logging",).version class LoggingServiceV2Client(object): @@ -83,8 +81,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): def billing_path(cls, billing_account): """Return a fully-qualified billing string.""" return google.api_core.path_template.expand( - "billingAccounts/{billing_account}", - billing_account=billing_account, + "billingAccounts/{billing_account}", billing_account=billing_account, ) @classmethod @@ -99,35 +96,27 @@ def billing_log_path(cls, billing_account, log): @classmethod def folder_path(cls, folder): """Return a fully-qualified folder string.""" - return google.api_core.path_template.expand( - "folders/{folder}", - folder=folder, - ) + return google.api_core.path_template.expand("folders/{folder}", folder=folder,) @classmethod def folder_log_path(cls, folder, log): """Return a fully-qualified folder_log string.""" return google.api_core.path_template.expand( - "folders/{folder}/logs/{log}", - folder=folder, - log=log, + "folders/{folder}/logs/{log}", folder=folder, log=log, ) @classmethod def log_path(cls, project, log): """Return a fully-qualified log string.""" return google.api_core.path_template.expand( - "projects/{project}/logs/{log}", - project=project, - log=log, + "projects/{project}/logs/{log}", project=project, log=log, ) @classmethod def organization_path(cls, organization): """Return a fully-qualified organization string.""" return google.api_core.path_template.expand( - "organizations/{organization}", - organization=organization, + "organizations/{organization}", organization=organization, ) @classmethod @@ -143,8 +132,7 @@ def organization_log_path(cls, organization, log): def project_path(cls, project): """Return a fully-qualified project string.""" return google.api_core.path_template.expand( - "projects/{project}", - project=project, + "projects/{project}", project=project, ) def __init__( @@ -233,12 +221,8 @@ def __init__( ) self.transport = transport else: - self.transport = ( - logging_service_v2_grpc_transport.LoggingServiceV2GrpcTransport( - address=api_endpoint, - channel=channel, - credentials=credentials, - ) + self.transport = logging_service_v2_grpc_transport.LoggingServiceV2GrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: @@ -327,9 +311,7 @@ def delete_log( client_info=self._client_info, ) - request = logging_pb2.DeleteLogRequest( - log_name=log_name, - ) + request = logging_pb2.DeleteLogRequest(log_name=log_name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -794,10 +776,7 @@ def list_logs( client_info=self._client_info, ) - request = logging_pb2.ListLogsRequest( - parent=parent, - page_size=page_size, - ) + request = logging_pb2.ListLogsRequest(parent=parent, page_size=page_size,) if metadata is None: metadata = [] metadata = list(metadata) diff --git a/google/cloud/logging_v2/gapic/metrics_service_v2_client.py b/google/cloud/logging_v2/gapic/metrics_service_v2_client.py index 87cf5b89d..0c80a5d43 100644 --- a/google/cloud/logging_v2/gapic/metrics_service_v2_client.py +++ b/google/cloud/logging_v2/gapic/metrics_service_v2_client.py @@ -46,9 +46,7 @@ from google.protobuf import field_mask_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( - "google-cloud-logging", -).version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-logging",).version class MetricsServiceV2Client(object): @@ -85,41 +83,33 @@ def from_service_account_file(cls, filename, *args, **kwargs): def billing_path(cls, billing_account): """Return a fully-qualified billing string.""" return google.api_core.path_template.expand( - "billingAccounts/{billing_account}", - billing_account=billing_account, + "billingAccounts/{billing_account}", billing_account=billing_account, ) @classmethod def folder_path(cls, folder): """Return a fully-qualified folder string.""" - return google.api_core.path_template.expand( - "folders/{folder}", - folder=folder, - ) + return google.api_core.path_template.expand("folders/{folder}", folder=folder,) @classmethod def metric_path(cls, project, metric): """Return a fully-qualified metric string.""" return google.api_core.path_template.expand( - "projects/{project}/metrics/{metric}", - project=project, - metric=metric, + "projects/{project}/metrics/{metric}", project=project, metric=metric, ) @classmethod def organization_path(cls, organization): """Return a fully-qualified organization string.""" return google.api_core.path_template.expand( - "organizations/{organization}", - organization=organization, + "organizations/{organization}", organization=organization, ) @classmethod def project_path(cls, project): """Return a fully-qualified project string.""" return google.api_core.path_template.expand( - "projects/{project}", - project=project, + "projects/{project}", project=project, ) def __init__( @@ -208,12 +198,8 @@ def __init__( ) self.transport = transport else: - self.transport = ( - metrics_service_v2_grpc_transport.MetricsServiceV2GrpcTransport( - address=api_endpoint, - channel=channel, - credentials=credentials, - ) + self.transport = metrics_service_v2_grpc_transport.MetricsServiceV2GrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: @@ -316,8 +302,7 @@ def list_log_metrics( ) request = logging_metrics_pb2.ListLogMetricsRequest( - parent=parent, - page_size=page_size, + parent=parent, page_size=page_size, ) if metadata is None: metadata = [] @@ -402,9 +387,7 @@ def get_log_metric( client_info=self._client_info, ) - request = logging_metrics_pb2.GetLogMetricRequest( - metric_name=metric_name, - ) + request = logging_metrics_pb2.GetLogMetricRequest(metric_name=metric_name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -490,8 +473,7 @@ def create_log_metric( ) request = logging_metrics_pb2.CreateLogMetricRequest( - parent=parent, - metric=metric, + parent=parent, metric=metric, ) if metadata is None: metadata = [] @@ -578,8 +560,7 @@ def update_log_metric( ) request = logging_metrics_pb2.UpdateLogMetricRequest( - metric_name=metric_name, - metric=metric, + metric_name=metric_name, metric=metric, ) if metadata is None: metadata = [] @@ -650,9 +631,7 @@ def delete_log_metric( client_info=self._client_info, ) - request = logging_metrics_pb2.DeleteLogMetricRequest( - metric_name=metric_name, - ) + request = logging_metrics_pb2.DeleteLogMetricRequest(metric_name=metric_name,) if metadata is None: metadata = [] metadata = list(metadata) diff --git a/google/cloud/logging_v2/proto/log_entry_pb2.py b/google/cloud/logging_v2/proto/log_entry_pb2.py index 9b0ef2205..f4805192b 100644 --- a/google/cloud/logging_v2/proto/log_entry_pb2.py +++ b/google/cloud/logging_v2/proto/log_entry_pb2.py @@ -427,9 +427,7 @@ ), ], extensions=[], - nested_types=[ - _LOGENTRY_LABELSENTRY, - ], + nested_types=[_LOGENTRY_LABELSENTRY,], enum_types=[], serialized_options=_b( "\352A\271\001\n\032logging.googleapis.com/Log\022\035projects/{project}/logs/{log}\022'organizations/{organization}/logs/{log}\022\033folders/{folder}/logs/{log}\022,billingAccounts/{billing_account}/logs/{log}\032\010log_name" diff --git a/google/cloud/logging_v2/proto/logging_config_pb2.py b/google/cloud/logging_v2/proto/logging_config_pb2.py index 7e4ae83dd..65fd2cff6 100644 --- a/google/cloud/logging_v2/proto/logging_config_pb2.py +++ b/google/cloud/logging_v2/proto/logging_config_pb2.py @@ -320,9 +320,7 @@ ], extensions=[], nested_types=[], - enum_types=[ - _LOGSINK_VERSIONFORMAT, - ], + enum_types=[_LOGSINK_VERSIONFORMAT,], serialized_options=_b( "\352A\270\001\n\033logging.googleapis.com/Sink\022\037projects/{project}/sinks/{sink}\022)organizations/{organization}/sinks/{sink}\022\035folders/{folder}/sinks/{sink}\022.billingAccounts/{billing_account}/sinks/{sink}" ), diff --git a/google/cloud/logging_v2/proto/logging_metrics_pb2.py b/google/cloud/logging_v2/proto/logging_metrics_pb2.py index 08eaf8099..01e308fb7 100644 --- a/google/cloud/logging_v2/proto/logging_metrics_pb2.py +++ b/google/cloud/logging_v2/proto/logging_metrics_pb2.py @@ -318,12 +318,8 @@ ), ], extensions=[], - nested_types=[ - _LOGMETRIC_LABELEXTRACTORSENTRY, - ], - enum_types=[ - _LOGMETRIC_APIVERSION, - ], + nested_types=[_LOGMETRIC_LABELEXTRACTORSENTRY,], + enum_types=[_LOGMETRIC_APIVERSION,], serialized_options=_b( "\352AD\n\035logging.googleapis.com/Metric\022#projects/{project}/metrics/{metric}" ), diff --git a/google/cloud/logging_v2/proto/logging_pb2.py b/google/cloud/logging_v2/proto/logging_pb2.py index 08cc2b49e..35c9b9c52 100644 --- a/google/cloud/logging_v2/proto/logging_pb2.py +++ b/google/cloud/logging_v2/proto/logging_pb2.py @@ -274,9 +274,7 @@ ), ], extensions=[], - nested_types=[ - _WRITELOGENTRIESREQUEST_LABELSENTRY, - ], + nested_types=[_WRITELOGENTRIESREQUEST_LABELSENTRY,], enum_types=[], serialized_options=None, is_extendable=False, @@ -391,9 +389,7 @@ ), ], extensions=[], - nested_types=[ - _WRITELOGENTRIESPARTIALERRORS_LOGENTRYERRORSENTRY, - ], + nested_types=[_WRITELOGENTRIESPARTIALERRORS_LOGENTRYERRORSENTRY,], enum_types=[], serialized_options=None, is_extendable=False, diff --git a/noxfile.py b/noxfile.py index c55ecf874..11fc0bf28 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,10 +1,12 @@ -# Copyright 2016 Google LLC +# -*- coding: utf-8 -*- +# +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -12,39 +14,33 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import absolute_import +# Generated by synthtool. DO NOT EDIT! +from __future__ import absolute_import import os import shutil -import sys import nox -UNIT_TEST_DEPS = ( - 'mock', - 'pytest', - 'pytest-cov', - 'flask', - 'webob', - 'django' -) +BLACK_VERSION = "black==19.10b0" +BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.8" +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +UNIT_TEST_PYTHON_VERSIONS = ["3.5", "3.6", "3.7", "3.8"] -@nox.session(python="3.7") + +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): """Run linters. Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ - session.install("flake8", "black") + session.install("flake8", BLACK_VERSION) session.run( - "black", - "--check", - "google", - "tests", - "docs", + "black", "--check", *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -54,17 +50,18 @@ def blacken(session): """Run black. Format code to uniform standard. + + This currently uses Python 3.6 due to the automated Kokoro run of synthtool. + That run uses an image that doesn't have 3.6 installed. Before updating this + check the state of the `gcp_ubuntu_config` we use for that Kokoro run. """ - session.install("black") + session.install(BLACK_VERSION) session.run( - "black", - "google", - "tests", - "docs", + "black", *BLACK_PATHS, ) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" session.install("docutils", "pygments") @@ -72,71 +69,75 @@ def lint_setup_py(session): def default(session): - """Default unit test session. - """ - # Install all test dependencies, then install this package in-place. - deps = UNIT_TEST_DEPS - - session.install(*deps) - session.install('-e', '.') + session.install("mock", "pytest", "pytest-cov", "flask", "webob", "django") + session.install("-e", ".") # Run py.test against the unit tests. session.run( - 'py.test', - '--quiet', - '--cov=google.cloud.logging', - '--cov=tests.unit', - '--cov-append', - '--cov-config=.coveragerc', - '--cov-report=', - '--cov-fail-under=0', - 'tests/unit', - *session.posargs + "py.test", + "--quiet", + "--cov=google.cloud.logging", + "--cov=google.cloud", + "--cov=tests.unit", + "--cov-append", + "--cov-config=.coveragerc", + "--cov-report=", + "--cov-fail-under=0", + os.path.join("tests", "unit"), + *session.posargs, ) -@nox.session(python=['3.5', '3.6', '3.7']) +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" default(session) -@nox.session(python=['3.6']) +@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" - - # Sanity check: Only run system tests if the environment variable is set. - if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''): - session.skip('Credentials must be set via environment variable.') + system_test_path = os.path.join("tests", "system.py") + system_test_folder_path = os.path.join("tests", "system") + + # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true. + if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": + session.skip("RUN_SYSTEM_TESTS is set to false, skipping") + # Sanity check: Only run tests if the environment variable is set. + if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): + session.skip("Credentials must be set via environment variable") + + system_test_exists = os.path.exists(system_test_path) + system_test_folder_exists = os.path.exists(system_test_folder_path) + # Sanity check: only run tests if found. + if not system_test_exists and not system_test_folder_exists: + session.skip("System tests were not found") # Use pre-release gRPC for system tests. - session.install('--pre', 'grpcio') + session.install("--pre", "grpcio") # Install all test dependencies, then install this package into the # virtualenv's dist-packages. - session.install('mock', 'pytest') - systest_deps = [ - 'google-cloud-bigquery', - 'google-cloud-pubsub', - 'google-cloud-storage', - 'google-cloud-testutils', - ] - for systest_dep in systest_deps: - session.install(systest_dep) - - session.install('-e', '.') + session.install( + "mock", + "pytest", + "google-cloud-testutils", + "google-cloud-bigquery", + "google-cloud-pubsub", + "google-cloud-storage", + "google-cloud-testutils", + ) + session.install("-e", ".") # Run py.test against the system tests. - session.run( - 'py.test', - '-vvv', - '-s', - 'tests/system', - *session.posargs) + if system_test_exists: + session.run("py.test", "--quiet", system_test_path, *session.posargs) + if system_test_folder_exists: + session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def cover(session): """Run the final coverage report. @@ -148,23 +149,26 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.7") + +@nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): """Build the docs for this library.""" - session.install('-e', '.') - session.install('sphinx', 'alabaster', 'recommonmark') + session.install("-e", ".") + session.install("sphinx", "alabaster", "recommonmark") - shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True) + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( - 'sphinx-build', - '-W', # warnings as errors - '-T', # show full traceback on exception - '-N', # no colors - '-b', 'html', - '-d', os.path.join('docs', '_build', 'doctrees', ''), - os.path.join('docs', ''), - os.path.join('docs', '_build', 'html', ''), + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), ) @@ -172,6 +176,39 @@ def docs(session): def docfx(session): """Build the docfx yaml files for this library.""" + session.install("-e", ".") + session.install("sphinx", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-T", # show full traceback on exception + "-N", # no colors + "-D", + ( + "extensions=sphinx.ext.autodoc," + "sphinx.ext.autosummary," + "docfx_yaml.extension," + "sphinx.ext.intersphinx," + "sphinx.ext.coverage," + "sphinx.ext.napoleon," + "sphinx.ext.todo," + "sphinx.ext.viewcode," + "recommonmark" + ), + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docfx(session): + """Build the docfx yaml files for this library.""" + session.install("-e", ".") # sphinx-docfx-yaml supports up to sphinx version 1.5.5. # https://github.com/docascode/sphinx-docfx-yaml/issues/97 diff --git a/setup.py b/setup.py index cf56847ba..ebd73c131 100644 --- a/setup.py +++ b/setup.py @@ -20,40 +20,39 @@ # Package metadata. -name = 'google-cloud-logging' -description = 'Stackdriver Logging API client library' +name = "google-cloud-logging" +description = "Stackdriver Logging API client library" version = "1.15.1" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' # 'Development Status :: 5 - Production/Stable' -release_status = 'Development Status :: 5 - Production/Stable' +release_status = "Development Status :: 5 - Production/Stable" dependencies = [ "google-api-core[grpc] >= 1.15.0, < 2.0.0dev", "google-cloud-core >= 1.4.1, < 2.0dev", ] -extras = { -} +extras = {} # Setup boilerplate below this line. package_root = os.path.abspath(os.path.dirname(__file__)) -readme_filename = os.path.join(package_root, 'README.rst') -with io.open(readme_filename, encoding='utf-8') as readme_file: +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() # Only include packages under the 'google' namespace. Do not include tests, # benchmarks, etc. packages = [ - package for package in setuptools.find_packages() - if package.startswith('google')] + package for package in setuptools.find_packages() if package.startswith("google") +] # Determine which namespaces are needed. -namespaces = ['google'] -if 'google.cloud' in packages: - namespaces.append('google.cloud') +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") setuptools.setup( @@ -61,28 +60,29 @@ version=version, description=description, long_description=readme, - author='Google LLC', - author_email='googleapis-packages@google.com', - license='Apache 2.0', - url='https://github.com/googleapis/python-logging', + author="Google LLC", + author_email="googleapis-packages@google.com", + license="Apache 2.0", + url="https://github.com/googleapis/python-logging", classifiers=[ release_status, - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Operating System :: OS Independent', - 'Topic :: Internet', + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Operating System :: OS Independent", + "Topic :: Internet", ], - platforms='Posix; MacOS X; Windows', + platforms="Posix; MacOS X; Windows", packages=packages, namespace_packages=namespaces, install_requires=dependencies, extras_require=extras, - python_requires='>=3.5', + python_requires=">=3.5", include_package_data=True, zip_safe=False, ) diff --git a/synth.py b/synth.py index 9504c980b..45a49f131 100644 --- a/synth.py +++ b/synth.py @@ -40,8 +40,23 @@ # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library(unit_cov_level=95, cov_level=100) -# Don't move noxfile. logging has special testing setups for django, etc -s.move(templated_files, excludes="noxfile.py") +templated_files = common.py_library( + unit_cov_level=95, + cov_level=99, + system_test_python_versions = ['3.8'], + unit_test_python_versions = ['3.5', '3.6', '3.7', '3.8'], + system_test_external_dependencies = [ + 'google-cloud-bigquery', + 'google-cloud-pubsub', + 'google-cloud-storage', + 'google-cloud-testutils' + ], + unit_test_external_dependencies = [ + 'flask', + 'webob', + 'django' + ], +) +s.move(templated_files, excludes=[".coveragerc"]) s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 101baf63b..9e2a15bb4 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -293,10 +293,7 @@ def test_list_entries_defaults(self): { "path": "/entries:list", "method": "POST", - "data": { - "filter": "removed", - "projectIds": [self.PROJECT], - }, + "data": {"filter": "removed", "projectIds": [self.PROJECT]}, }, ) # verify that default filter is 24 hours diff --git a/tests/unit/test_logger.py b/tests/unit/test_logger.py index 7cc870e3a..966a515e0 100644 --- a/tests/unit/test_logger.py +++ b/tests/unit/test_logger.py @@ -514,10 +514,7 @@ def test_list_entries_defaults(self): { "path": "/entries:list", "method": "POST", - "data": { - "filter": "removed", - "projectIds": [self.PROJECT], - }, + "data": {"filter": "removed", "projectIds": [self.PROJECT]}, }, ) # verify that default filter is 24 hours @@ -573,10 +570,7 @@ def test_list_entries_explicit(self): }, ) # verify that default filter is 24 hours - LOG_FILTER = "logName=projects/%s/logs/%s" % ( - self.PROJECT, - self.LOGGER_NAME, - ) + LOG_FILTER = "logName=projects/%s/logs/%s" % (self.PROJECT, self.LOGGER_NAME,) combined_filter = ( INPUT_FILTER + " AND " @@ -619,10 +613,7 @@ def test_list_entries_explicit_timestamp(self): self.assertIsNone(token) # self.assertEqual(client._listed, LISTED) # check call payload - LOG_FILTER = "logName=projects/%s/logs/%s" % ( - self.PROJECT, - self.LOGGER_NAME, - ) + LOG_FILTER = "logName=projects/%s/logs/%s" % (self.PROJECT, self.LOGGER_NAME,) combined_filter = INPUT_FILTER + " AND " + LOG_FILTER self.assertEqual( client._connection._called_with,