Repository: tensorflow/addons

Issue:
Generate API docs
As our repository matures it's important to have api docs to improve user experience. As discussed in #38 we will also be able to remove the table of contents off the main README.

Should we host on https://readthedocs.org/ or is there something else recommended @ewilderj @dynamicwebpaige @karmel ?


Discussion:
- TensorFlow API docs are here: https://www.tensorflow.org/api_docs
- Go TensorFlow API docs are here: https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go
- Haskell TensorFlow docs are here: https://github.com/tensorflow/haskell and here https://tensorflow.github.io/haskell/haddock/
- There are 4 more different links for community supported docs for Julia, Ruby, Rust, Scala

Would it be possible to host the docs in tensorflow.org in someway, so that a reader can seamlessly flow between Core TensorFlow docs and Addons docs ?


Agree with @armando-fandango, I prefer to host it on tensorflow.org as well. 

cc @martinwicke 
@markdaoust and @lamberta - is this feasible? Having these in the community docs on TF.org would be nice.
Yes, it would be desirable to figure out a way to do this on the main site, as there are ever more satellite repos // cc Billy @lamberta 
@markdaoust knows more about API doc gen, but our doc gen tools are here: https://github.com/tensorflow/docs/tree/master/tools/tensorflow_docs

As far as publishing guides and tutorials on tensorflow.org, yes, this is possible from a technical standpoint and we're already set up for it :)
We use "subsites" for some projects not in *TensorFlow core*, for example, here's the [subsite directory](https://github.com/tensorflow/probability/tree/master/tensorflow_probability/g3doc) for [TensorFlow Probability](https://www.tensorflow.org/probability/). Here's the [subsite template](https://github.com/tensorflow/docs/tree/master/tools/templates/subsite).

But there are organization issues to figure out for how we present these. We'll probably need to label them as "non-official". And if anything is hosted on tensorflow.org then the review requirements increase since we open ourselves to potential abuse, etc. But it's worth exploring and I think it would be helpful.
For `api_docs` this is simplest if these projects generate api docs into their `docs/` directory here on github. 

And we can pull the docs/ into the site.

The best example of how to use the doc generator is here:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docs/generate2.py#L88+

For most packages the script can be simplified somewhat (delete most flags, delete TfExportAwareDocGeneratorVisitor).

To install the docs-generator, there's no pip package. just use:

```
pip install git+https://github.com/tensorflow/docs
```
Summary of above discussion:
- In principle it would be a better user-experience to keep the docs in a way that it is easier for engineer/reader/user to navigate between core TensorFlow and 'satellite site' docs easily.
- Label the docs not part of core as "Contributed" or "Community Docs"
- Generate the docs in /docs folder, example: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docs/generate2.py#L88+
- TensorFlow core team will then figure out a way to reduce risk with extra messages like "Community Docs" etc., and pull them into the TensorFlow.org where other docs reside.

If we agree on this, then let us create an issue to generate docs as per the example.
That matches my understanding; @lamberta / @MarkDaoust can you confirm?

Thanks, Addons team, for making sure this is done thoroughly and correctly for the users.
👍 The more I think about it the more I like it, especially as a blueprint for other SIGs :)

Feel free to post to this the [docs list](https://groups.google.com/a/tensorflow.org/forum/#!forum/docs) and maybe we can get some more input.
We'll also want to make sure to include this as part of the TensorFlow Contributor Guide. Thank you for formalizing this process and for creating standards! We appreciate it. :slightly_smiling_face: 

Resolving patch:
diff --git a/tools/docs/build_docs.py b/tools/docs/build_docs.py
--- a/tools/docs/build_docs.py
+++ b/tools/docs/build_docs.py
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # ==============================================================================
-""" Modified from the tfdocs example api reference docs generation script.
+"""Modified from the tfdocs example api reference docs generation script.
 
 This script generates API reference docs.
 
@@ -31,19 +31,30 @@
 from absl import app
 from absl import flags
 
-import tensorflow_addons
+import tensorflow_addons as tfa
+
 from tensorflow_docs.api_generator import generate_lib
+from tensorflow_docs.api_generator import parser
 from tensorflow_docs.api_generator import public_api
 
-PROJECT_SHORT_NAME = 'tfaddons'
+from tensorflow.python.util import tf_inspect
+
+# Use tensorflow's `tf_inspect`, which is aware of `tf_decorator`.
+parser.tf_inspect = tf_inspect
+
+PROJECT_SHORT_NAME = 'tfa'
 PROJECT_FULL_NAME = 'TensorFlow Addons'
-CODE_URL_PREFIX = 'https://github.com/tensorflow/addons/tree/master/tensorflow_addons'
 
 FLAGS = flags.FLAGS
 
+flags.DEFINE_string(
+    'git_branch',
+    default='master',
+    help='The name of the corresponding branch on github.')
+
 flags.DEFINE_string(
     'output_dir',
-    default='/addons/docs/api_docs/python/',
+    default='docs/api_docs/python/',
     help='Where to write the resulting docs to.')
 
 
@@ -51,11 +62,16 @@ def main(argv):
     if argv[1:]:
         raise ValueError('Unrecognized arguments: {}'.format(argv[1:]))
 
+    code_url_prefix = ('https://github.com/tensorflow/addons/tree/'
+                       '{git_branch}/tensorflow_addons'.format(
+                           git_branch=FLAGS.git_branch))
+
     doc_generator = generate_lib.DocGenerator(
         root_title=PROJECT_FULL_NAME,
         # Replace `tensorflow_docs` with your module, here.
-        py_modules=[(PROJECT_SHORT_NAME, tensorflow_addons)],
-        code_url_prefix=CODE_URL_PREFIX,
+        py_modules=[(PROJECT_SHORT_NAME, tfa)],
+        code_url_prefix=code_url_prefix,
+        private_map={'tfa': ['__version__', 'utils', 'version']},
         # This callback cleans up a lot of aliases caused by internal imports.
         callbacks=[public_api.local_definitions_filter])
 


Test patch: