Skip to content

Commit dfbdd52

Browse files
committed
ENH: integrate with bazel
1 parent 0ca5203 commit dfbdd52

File tree

9 files changed

+37
-188
lines changed

9 files changed

+37
-188
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ wheels/
3535
# Build
3636
/.bazelrc
3737
/bazel-*
38-
/artifacts
38+
/artifacts
39+
40+
# Addons
41+
.*
42+
/docs/

BUILD

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,5 @@ sh_binary(
66
"MANIFEST.in",
77
"setup.py",
88
"//tensorflow_addons",
9-
"//tensorflow_addons/activations",
10-
"//tensorflow_addons/image",
11-
"//tensorflow_addons/layers",
12-
"//tensorflow_addons/losses",
13-
"//tensorflow_addons/optimizers",
14-
"//tensorflow_addons/rnn",
15-
"//tensorflow_addons/seq2seq",
16-
"//tensorflow_addons/text",
179
],
1810
)

tensorflow_addons/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,14 @@ py_library(
88
"__init__.py",
99
"version.py",
1010
],
11+
deps = [
12+
"//tensorflow_addons/activations",
13+
"//tensorflow_addons/image",
14+
"//tensorflow_addons/layers",
15+
"//tensorflow_addons/losses",
16+
"//tensorflow_addons/optimizers",
17+
"//tensorflow_addons/rnn",
18+
"//tensorflow_addons/seq2seq",
19+
"//tensorflow_addons/text",
20+
],
1121
)

tools/docs/BUILD

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,11 @@ package(
99
default_visibility = ["//tensorflow_addons:__subpackages__"],
1010
)
1111

12-
13-
py_library(
14-
name = "generate2",
15-
srcs = ["generate2.py"],
12+
py_binary(
13+
name = "build_docs",
14+
srcs = ["build_docs.py"],
1615
srcs_version = "PY2AND3",
1716
deps = [
1817
"//tensorflow_addons",
19-
"//tensorflow_addons/activations",
20-
"//tensorflow_addons/image",
21-
"//tensorflow_addons/layers",
22-
"//tensorflow_addons/losses",
23-
"//tensorflow_addons/optimizers",
24-
"//tensorflow_addons/seq2seq",
25-
"//tensorflow_addons/text",
26-
],
27-
)
28-
29-
30-
py_test(
31-
name = "generate2_test",
32-
srcs = ["generate2_test.py"],
33-
srcs_version = "PY2AND3",
34-
tags = [
35-
"manual",
36-
# No reason to run sanitizers or fastbuild for this test.
37-
"noasan",
38-
"nomsan",
39-
"notsan",
40-
"optonly",
41-
],
42-
deps = [
43-
":generate2",
4418
],
4519
)

tools/docs/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Generate API documents:
2+
3+
```bash
4+
bazel build tools/docs:build_docs
5+
bazel-bin/tools/docs/build_docs --git_branch=master --output_dir=docs/api_docs/python/
6+
```

tools/docs/build_docs.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
# ==============================================================================
15-
""" Modified from the tfdocs example api reference docs generation script.
15+
"""Modified from the tfdocs example api reference docs generation script.
1616
1717
This script generates API reference docs.
1818
@@ -37,25 +37,33 @@
3737

3838
PROJECT_SHORT_NAME = 'tfaddons'
3939
PROJECT_FULL_NAME = 'TensorFlow Addons'
40-
CODE_URL_PREFIX = 'https://github.com/tensorflow/addons/tree/master/tensorflow_addons'
4140

4241
FLAGS = flags.FLAGS
4342

43+
flags.DEFINE_string(
44+
'git_branch',
45+
default='master',
46+
help='The name of the corresponding branch on github.')
47+
4448
flags.DEFINE_string(
4549
'output_dir',
46-
default='/addons/docs/api_docs/python/',
50+
default='docs/api_docs/python/',
4751
help='Where to write the resulting docs to.')
4852

4953

5054
def main(argv):
5155
if argv[1:]:
5256
raise ValueError('Unrecognized arguments: {}'.format(argv[1:]))
5357

58+
code_url_prefix = ('https://github.com/tensorflow/addons/tree/'
59+
'{git_branch}/tensorflow_addons'.format(
60+
git_branch=FLAGS.git_branch))
61+
5462
doc_generator = generate_lib.DocGenerator(
5563
root_title=PROJECT_FULL_NAME,
5664
# Replace `tensorflow_docs` with your module, here.
5765
py_modules=[(PROJECT_SHORT_NAME, tensorflow_addons)],
58-
code_url_prefix=CODE_URL_PREFIX,
66+
code_url_prefix=code_url_prefix,
5967
# This callback cleans up a lot of aliases caused by internal imports.
6068
callbacks=[public_api.local_definitions_filter])
6169

tools/docs/doc_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
git+https://github.com/tensorflow/docs

tools/docs/generate2.py

Lines changed: 0 additions & 106 deletions
This file was deleted.

tools/docs/generate2_test.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)