Skip to content

Commit 4e6feb5

Browse files
yoshi-automationbusunkim96
authored andcommitted
Data Labeling: Add nox session docs, reorder methods (via synth). (googleapis#7767)
1 parent db583fc commit 4e6feb5

6 files changed

Lines changed: 99 additions & 35 deletions

File tree

datalabeling/docs/README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.rst

datalabeling/docs/conf.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# -- General configuration ------------------------------------------------
2626

2727
# If your documentation needs a minimal Sphinx version, state it here.
28-
# needs_sphinx = '1.0'
28+
needs_sphinx = "1.6.3"
2929

3030
# Add any Sphinx extension module names here, as strings. They can be
3131
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -36,6 +36,7 @@
3636
"sphinx.ext.intersphinx",
3737
"sphinx.ext.coverage",
3838
"sphinx.ext.napoleon",
39+
"sphinx.ext.todo",
3940
"sphinx.ext.viewcode",
4041
]
4142

@@ -47,10 +48,14 @@
4748
# Add any paths that contain templates here, relative to this directory.
4849
templates_path = ["_templates"]
4950

51+
# Allow markdown includes (so releases.md can include CHANGLEOG.md)
52+
# http://www.sphinx-doc.org/en/master/markdown.html
53+
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
54+
5055
# The suffix(es) of source filenames.
5156
# You can specify multiple suffix as a list of string:
5257
# source_suffix = ['.rst', '.md']
53-
source_suffix = ".rst"
58+
source_suffix = [".rst", ".md"]
5459

5560
# The encoding of source files.
5661
# source_encoding = 'utf-8-sig'
@@ -120,12 +125,20 @@
120125

121126
# The theme to use for HTML and HTML Help pages. See the documentation for
122127
# a list of builtin themes.
123-
html_theme = "sphinx_rtd_theme"
128+
html_theme = "alabaster"
124129

125130
# Theme options are theme-specific and customize the look and feel of a theme
126131
# further. For a list of options available for each theme, see the
127132
# documentation.
128-
# html_theme_options = {}
133+
html_theme_options = {
134+
"description": "Google Cloud Client Libraries for Python",
135+
"github_user": "googleapis",
136+
"github_repo": "google-cloud-python",
137+
"github_banner": True,
138+
"font_family": "'Roboto', Georgia, sans",
139+
"head_font_family": "'Roboto', Georgia, serif",
140+
"code_font_family": "'Roboto Mono', 'Consolas', monospace",
141+
}
129142

130143
# Add any paths that contain custom themes here, relative to this directory.
131144
# html_theme_path = []
@@ -214,6 +227,17 @@
214227
# Output file base name for HTML help builder.
215228
htmlhelp_basename = "google-cloud-datalabeling-doc"
216229

230+
# -- Options for warnings ------------------------------------------------------
231+
232+
suppress_warnings = [
233+
# Temporarily suppress this to avoid "more than one target found for
234+
# cross-reference" warning, which are intractable for us to avoid while in
235+
# a mono-repo.
236+
# See https://github.com/sphinx-doc/sphinx/blob
237+
# /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843
238+
"ref.python"
239+
]
240+
217241
# -- Options for LaTeX output ---------------------------------------------
218242

219243
latex_elements = {
@@ -310,6 +334,16 @@
310334
intersphinx_mapping = {
311335
"python": ("http://python.readthedocs.org/en/latest/", None),
312336
"gax": ("https://gax-python.readthedocs.org/en/latest/", None),
337+
"google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
338+
"google-gax": ("https://gax-python.readthedocs.io/en/latest/", None),
339+
"google.api_core": (
340+
"https://googleapis.github.io/google-cloud-python/latest",
341+
None,
342+
),
343+
"grpc": ("https://grpc.io/grpc/python/", None),
344+
"requests": ("http://docs.python-requests.org/en/master/", None),
345+
"fastavro": ("https://fastavro.readthedocs.io/en/stable/", None),
346+
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
313347
}
314348

315349
# Napoleon settings

datalabeling/docs/index.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. include:: /../datalabeling/README.rst
1+
.. include:: README.rst
22

33
Api Reference
44
-------------
@@ -7,4 +7,13 @@ Api Reference
77

88
gapic/v1beta1/api
99
gapic/v1beta1/types
10-
changelog
10+
11+
Changelog
12+
---------
13+
14+
For a list of all ``google-cloud-datalabeling`` releases:
15+
16+
.. toctree::
17+
:maxdepth: 2
18+
19+
changelog

datalabeling/google/cloud/datalabeling_v1beta1/gapic/data_labeling_service_client.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@ def from_service_account_file(cls, filename, *args, **kwargs):
8383
from_service_account_json = from_service_account_file
8484

8585
@classmethod
86-
def project_path(cls, project):
87-
"""Return a fully-qualified project string."""
86+
def annotated_dataset_path(cls, project, dataset, annotated_dataset):
87+
"""Return a fully-qualified annotated_dataset string."""
8888
return google.api_core.path_template.expand(
89-
"projects/{project}", project=project
89+
"projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}",
90+
project=project,
91+
dataset=dataset,
92+
annotated_dataset=annotated_dataset,
9093
)
9194

9295
@classmethod
@@ -99,20 +102,20 @@ def annotation_spec_set_path(cls, project, annotation_spec_set):
99102
)
100103

101104
@classmethod
102-
def dataset_path(cls, project, dataset):
103-
"""Return a fully-qualified dataset string."""
105+
def data_item_path(cls, project, dataset, data_item):
106+
"""Return a fully-qualified data_item string."""
104107
return google.api_core.path_template.expand(
105-
"projects/{project}/datasets/{dataset}", project=project, dataset=dataset
108+
"projects/{project}/datasets/{dataset}/dataItems/{data_item}",
109+
project=project,
110+
dataset=dataset,
111+
data_item=data_item,
106112
)
107113

108114
@classmethod
109-
def annotated_dataset_path(cls, project, dataset, annotated_dataset):
110-
"""Return a fully-qualified annotated_dataset string."""
115+
def dataset_path(cls, project, dataset):
116+
"""Return a fully-qualified dataset string."""
111117
return google.api_core.path_template.expand(
112-
"projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}",
113-
project=project,
114-
dataset=dataset,
115-
annotated_dataset=annotated_dataset,
118+
"projects/{project}/datasets/{dataset}", project=project, dataset=dataset
116119
)
117120

118121
@classmethod
@@ -126,16 +129,6 @@ def example_path(cls, project, dataset, annotated_dataset, example):
126129
example=example,
127130
)
128131

129-
@classmethod
130-
def data_item_path(cls, project, dataset, data_item):
131-
"""Return a fully-qualified data_item string."""
132-
return google.api_core.path_template.expand(
133-
"projects/{project}/datasets/{dataset}/dataItems/{data_item}",
134-
project=project,
135-
dataset=dataset,
136-
data_item=data_item,
137-
)
138-
139132
@classmethod
140133
def instruction_path(cls, project, instruction):
141134
"""Return a fully-qualified instruction string."""
@@ -145,6 +138,13 @@ def instruction_path(cls, project, instruction):
145138
instruction=instruction,
146139
)
147140

141+
@classmethod
142+
def project_path(cls, project):
143+
"""Return a fully-qualified project string."""
144+
return google.api_core.path_template.expand(
145+
"projects/{project}", project=project
146+
)
147+
148148
def __init__(
149149
self,
150150
transport=None,

datalabeling/noxfile.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from __future__ import absolute_import
1818
import os
19+
import shutil
1920

2021
import nox
2122

@@ -138,3 +139,22 @@ def cover(session):
138139
session.run("coverage", "report", "--show-missing", "--fail-under=80")
139140

140141
session.run("coverage", "erase")
142+
143+
@nox.session(python="3.7")
144+
def docs(session):
145+
"""Build the docs for this library."""
146+
147+
session.install('-e', '.')
148+
session.install('sphinx', 'alabaster', 'recommonmark')
149+
150+
shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
151+
session.run(
152+
'sphinx-build',
153+
'-W', # warnings as errors
154+
'-T', # show full traceback on exception
155+
'-N', # no colors
156+
'-b', 'html',
157+
'-d', os.path.join('docs', '_build', 'doctrees', ''),
158+
os.path.join('docs', ''),
159+
os.path.join('docs', '_build', 'html', ''),
160+
)

datalabeling/synth.metadata

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"updateTime": "2019-04-01T20:28:56.710893Z",
2+
"updateTime": "2019-05-02T16:41:45.804157Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.16.22",
8-
"dockerImage": "googleapis/artman@sha256:e7f9554322a8aa1416c122c918fdc4cdec8cfe816f027fc948dec0be7edef320"
7+
"version": "0.17.1",
8+
"dockerImage": "googleapis/artman@sha256:a40ca4dd4ef031c0ded4df4909ffdf7b3f20d29b23e682ef991eb60ba0ca6025"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
14-
"remote": "git@github.com:googleapis/googleapis.git",
15-
"sha": "62baea94d3760d9a58064a6e6ee9b99eff2a608e",
16-
"internalRef": "241370948"
14+
"remote": "https://github.com/googleapis/googleapis.git",
15+
"sha": "dd42335a9a8613072bef9cbda2725e84631d7043",
16+
"internalRef": "246232940"
1717
}
1818
},
1919
{
2020
"template": {
2121
"name": "python_library",
2222
"origin": "synthtool.gcp",
23-
"version": "2019.2.26"
23+
"version": "2019.4.10"
2424
}
2525
}
2626
],

0 commit comments

Comments
 (0)