Skip to content

Commit

Permalink
Enable automatic generated API docs.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 503531793
  • Loading branch information
daiyip authored and pyglove authors committed Jan 20, 2023
1 parent 746930c commit 590bd3a
Show file tree
Hide file tree
Showing 13 changed files with 906 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/_static/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/_static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import url("theme.css");

.wy-side-nav-search {
background-color: #000;
}

.wy-table-responsive table td,
.wy-table-responsive table th {
white-space: normal;
}
2 changes: 2 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% extends "!layout.html" %}
{% set css_files = css_files + ["_static/style.css"] %}
11 changes: 11 additions & 0 deletions docs/api/_templates/_default/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _{{cls.rst_label}}:

{{cls.canonical_path}}
================

Accessible via {{cls.rst_access_paths}}.

.. autoclass:: {{cls.rst_import_name}}
:members:
:show-inheritance:
:autosummary:
8 changes: 8 additions & 0 deletions docs/api/_templates/_default/function.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _{{func.rst_label}}:

{{func.canonical_path}}
=====================

Accessible via {{func.rst_access_paths}}.

.. autofunction:: {{func.rst_import_name}}
38 changes: 38 additions & 0 deletions docs/api/_templates/_default/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.. _{{module.rst_label}}:

{{module.canonical_path}}
=====================

.. automodule:: {{module.rst_import_name}}

{% if module.modules %}
.. toctree::
:maxdepth: 1
:caption: Modules
{% for m in module.modules %}
{{m.api.relative_handle(module.doc_dir)}}{% endfor %}
{% endif %}

{% if module.objects %}
.. toctree::
:maxdepth: 1
:caption: Objects
{% for entry in module.objects %}
{{module.canonical_path}}.{{entry.name}} <{{entry.api.relative_handle(module.doc_dir)}}>{% endfor %}
{% endif %}

{% if module.classes %}
.. toctree::
:maxdepth: 1
:caption: Classes
{% for entry in module.classes %}
{{module.canonical_path}}.{{entry.name}} <{{entry.api.relative_handle(module.doc_dir)}}>{% endfor %}
{% endif %}

{% if module.functions %}
.. toctree::
:maxdepth: 1
:caption: Functions
{% for entry in module.functions %}
{{module.canonical_path}}.{{entry.name}} <{{entry.api.relative_handle(module.doc_dir)}}>{% endfor %}
{% endif %}
6 changes: 6 additions & 0 deletions docs/api/_templates/_default/object.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _{{obj.rst_label}}:

{{obj.canonical_path}}
================

Accessible via {{obj.rst_access_paths}}.
58 changes: 58 additions & 0 deletions docs/api/_templates/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.. currentmodule:: pyglove

Public API: pyglove
===================

Modules
-----------

.. toctree::
:maxdepth: 1
:caption: core
{% for e in module.modules -%}
{%- if e.api.source_category == 'core' %}
{{e.api.relative_handle(module.doc_dir)}}
{%- endif -%}
{%- endfor %}

.. toctree::
:maxdepth: 1
:caption: ext
{% for e in module.modules -%}
{%- if e.api.source_category == 'ext' %}
{{e.api.relative_handle(module.doc_dir)}}
{%- endif -%}
{%- endfor %}

.. toctree::
:maxdepth: 1
:caption: generators
{% for e in module.modules -%}
{%- if e.api.source_category == 'generators' %}
{{e.api.relative_handle(module.doc_dir)}}
{%- endif -%}
{%- endfor %}


Top-level shortcurts
--------------------

Objects
#######

{% for e in module.objects %}
* :ref:`pg.{{e.name}}<{{e.api.rst_label}}>`
{%- endfor %}

Classes
#######

{% for e in module.classes %}
* :ref:`pg.{{e.name}}<{{e.api.rst_label}}>`
{%- endfor %}

Functions
#########
{% for e in module.functions %}
* :ref:`pg.{{e.name}}<{{e.api.rst_label}}>`
{%- endfor %}
Loading

0 comments on commit 590bd3a

Please sign in to comment.