googleapis / googleapis/python-aiplatform

docs: enable warning as errors

Ouverte
#2,395 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
api: vertex-ai
Langage dominant
Python
Étoiles
905
Forks
465
Merge moyen
1 j 13 h
PR mergées (30 j)
44

Description

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

https://github.com/googleapis/python-aiplatform/blob/cb904d772abd0836f67b1034074395ce7a032d66/noxfile.py#L279-L280

https://github.com/googleapis/python-aiplatform/blob/cb904d772abd0836f67b1034074395ce7a032d66/noxfile.py#L291-L301

```
-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.

https://github.com/googleapis/python-aiplatform/blob/cb904d772abd0836f67b1034074395ce7a032d66/owlbot.py#L148-L149

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 https://github.com/googleapis/python-aiplatform/pull/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
```

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans noxfile.py, au niveau de la session docs, et comparez les invocations de sphinx-build aux lignes indiquées par les liens ; l'issue identifie l'option -W manquante. Exécutez la session docs de nox et examinez la description d'objet en double signalée dans la documentation générée. Le travail est terminé lorsque le build de docs traite les avertissements comme des erreurs et que l'avertissement signalé est corrigé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
build-system, documentation
Type d'issue
Documentation
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
58/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.