Skip to content

Commit 6a1bb24

Browse files
committed
ENH: integrate with bazel
1 parent fd04ea0 commit 6a1bb24

File tree

7 files changed

+53
-13
lines changed

7 files changed

+53
-13
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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Description:
2+
# Doc generator
3+
4+
licenses(["notice"]) # Apache 2.0
5+
6+
exports_files(["LICENSE"])
7+
8+
package(
9+
default_visibility = ["//tensorflow_addons:__subpackages__"],
10+
)
11+
12+
py_binary(
13+
name = "build_docs",
14+
srcs = ["build_docs.py"],
15+
srcs_version = "PY2AND3",
16+
deps = [
17+
"//tensorflow_addons",
18+
],
19+
)

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

0 commit comments

Comments
 (0)