Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: enable warning as errors #2395

Open
parthea opened this issue Aug 1, 2023 · 0 comments
Open

docs: enable warning as errors #2395

parthea opened this issue Aug 1, 2023 · 0 comments
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.

Comments

@parthea
Copy link
Contributor

parthea commented Aug 1, 2023

I noticed in the docs build in noxfile.py, warnings are not treated as errors because the -W option is missing here:

def docs(session):
"""Build the docs for this library."""

session.run(
"sphinx-build",
"-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", ""),
)

-W
Turn warnings into errors. This means that the build stops at the first warning and sphinx-build exits with exit status 1.

https://www.sphinx-doc.org/en/master/man/sphinx-build.html#cmdoption-sphinx-build-W

There is a workaround in owlbot.py to only fail the docs build if there are errors.

python-aiplatform/owlbot.py

Lines 148 to 149 in cb904d7

# Don't treat docs warnings as errors
s.replace("noxfile.py", """ ["']-W["'], # warnings as errors\n""", "")

The docs build is a form of static analysis and can catch docs issues which are not caught upstream. These issues may be reported via warnings. I checked the history and it looks like warnings as errors was disabled in #22.

To enable warnings locally, make the following change

(py39) partheniou@partheniou-vm-3:~/git/python-aiplatform$ git diff
diff --git a/noxfile.py b/noxfile.py
index f90f5cad8..f134192e8 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -290,6 +290,7 @@ def docs(session):
     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
     session.run(
         "sphinx-build",
+        "-W",
         "-T",  # show full traceback on exception
         "-N",  # no colors
         "-b",

The first warning which appeared is

Warning, treated as error:
/usr/local/google/home/partheniou/git/python-aiplatform/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/automl_image_classification.py:docstring of google.cloud.aiplatform.v1.schema.trainingjob.definition_v1.types.AutoMlImageClassification.inputs:1:duplicate object description of google.cloud.aiplatform.v1.schema.trainingjob.definition_v1.types.AutoMlImageClassification.inputs, other instance in aiplatform/definition_v1, use :noindex: for one of them
@product-auto-label product-auto-label bot added the api: vertex-ai Issues related to the googleapis/python-aiplatform API. label Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.
Projects
None yet
Development

No branches or pull requests

1 participant