-
Notifications
You must be signed in to change notification settings - Fork 91
Use sphinx-autoapi to generate api reference #2458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c3e8fb4
d343ae7
f86cae6
fb8e9c1
ca826f5
674f4fc
cf5f845
5da87b8
32e597e
aef4f37
4d35a89
ff024c8
2574a78
26c1b91
acd9f03
e683164
87b6613
476df85
e2f3691
133ba1a
f21542a
51e256d
a90d2bd
372ca0f
c2be105
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ pydata-sphinx-theme>=0.3.1 | |
| Sphinx>=2.0.1,<4.0.0 | ||
| nbconvert>=5.5.0 | ||
| nbsphinx>=0.8.5 | ||
| sphinx-autoapi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| {% if obj.display %} | ||
| {% if obj.docstring|length > 0 %} | ||
| * - {{ obj.name }} | ||
| - {{ obj.docstring.replace("\n", "") }} | ||
| {% else %} | ||
| * - {{ obj.name }} | ||
| - {{ obj.value|string }} | ||
| {% endif %} | ||
| {% endif %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| {% if obj.display %} | ||
| .. py:{{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %} | ||
| {% for (args, return_annotation) in obj.overloads %} | ||
| {{ " " * (obj.type | length) }} {{ obj.short_name }}{% if args %}({{ args }}){% endif %} | ||
| {% endfor %} | ||
|
|
||
|
|
||
| {% if obj.bases %} | ||
| {% if "show-inheritance" in autoapi_options %} | ||
| Bases: {% for base in obj.bases %}{{ base|link_objs }}{% if not loop.last %}, {% endif %}{% endfor %} | ||
| {% endif %} | ||
|
|
||
|
|
||
| {% if "show-inheritance-diagram" in autoapi_options and obj.bases != ["object"] %} | ||
| .. autoapi-inheritance-diagram:: {{ obj.obj["full_name"] }} | ||
| :parts: 1 | ||
| {% if "private-members" in autoapi_options %} | ||
| :private-bases: | ||
| {% endif %} | ||
|
|
||
| {% endif %} | ||
| {% endif %} | ||
| {% if obj.docstring %} | ||
| {{ obj.docstring|prepare_docstring|indent(3) }} | ||
| {% endif %} | ||
| {% if "inherited-members" in autoapi_options %} | ||
| {% set visible_classes = obj.classes|selectattr("display")|rejectattr("name", "equalto", "args")|list %} | ||
| {% else %} | ||
| {% set visible_classes = obj.classes|rejectattr("inherited")|rejectattr("name", "equalto", "args")|selectattr("display")|list %} | ||
| {% endif %} | ||
| {% for klass in visible_classes %} | ||
| {{ klass.render()|indent(3) }} | ||
| {% endfor %} | ||
| {% if "inherited-members" in autoapi_options %} | ||
| {% set visible_attributes = obj.attributes|selectattr("display")|list %} | ||
| {% else %} | ||
| {% set visible_attributes = obj.attributes|rejectattr("inherited")|selectattr("display")|list %} | ||
| {% endif %} | ||
|
|
||
| {% if visible_attributes|length %} | ||
| **Attributes** | ||
|
|
||
| .. list-table:: | ||
| :widths: 15 85 | ||
| :header-rows: 0 | ||
|
|
||
| {% for attribute in visible_attributes|sort(attribute='name') %} | ||
| * - **{{ attribute.name }}** | ||
| {% if attribute.docstring|length > 0 %} | ||
| - {{ attribute.docstring.replace("\n", "") }} | ||
| {% else %} | ||
| - {{ attribute.value|string }} | ||
| {% endif %} | ||
| {% endfor %} | ||
| {% endif %} | ||
|
|
||
| {% if "inherited-members" in autoapi_options %} | ||
| {% set visible_methods = obj.methods|selectattr("display")|rejectattr("name", "equalto", "with_traceback")|list %} | ||
| {% else %} | ||
| {% set visible_methods = obj.methods|rejectattr("inherited")|rejectattr("name", "equalto", "with_traceback")|selectattr("display")|list %} | ||
| {% endif %} | ||
|
|
||
| {% if visible_methods|length %} | ||
| **Methods** | ||
|
|
||
| .. autoapisummary:: | ||
| :nosignatures: | ||
|
|
||
| {% for method in visible_methods|sort(attribute='name') %} | ||
| {{ obj.obj["full_name"] }}.{{ method.name }} | ||
| {% endfor %} | ||
|
|
||
| {% for method in visible_methods|sort(attribute='name') %} | ||
| {{ method.render()|indent(3) }} | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endif %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| {% if not obj.display %} | ||
| :orphan: | ||
|
|
||
| {% endif %} | ||
| {% if obj.name.split('.')[-1][0] == '_' %} | ||
| {{ obj.name }} | ||
| {% elif obj.name.split('.')|length <= 2 %} | ||
| {{ (' '.join(obj.name.split('.')[-1].split('_'))|title) }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This template is to modify the display names of the modules, e.g. |
||
| {% else %} | ||
| {{ obj.name.split('.')[-1] }} | ||
| {% endif %} | ||
| =========={{ "=" * obj.name|length }} | ||
|
|
||
| .. py:module:: {{ obj.name }} | ||
|
|
||
| {% if obj.docstring %} | ||
| .. autoapi-nested-parse:: | ||
|
|
||
| {{ obj.docstring|prepare_docstring|indent(3) }} | ||
|
|
||
| {% endif %} | ||
|
|
||
| {% block subpackages %} | ||
| {% set visible_subpackages = obj.subpackages|selectattr("display")|list %} | ||
| {% if visible_subpackages %} | ||
| Subpackages | ||
| ----------- | ||
| .. toctree:: | ||
| :titlesonly: | ||
| :maxdepth: 3 | ||
|
|
||
| {% for subpackage in visible_subpackages %} | ||
| {{ subpackage.short_name }}/index.rst | ||
| {% endfor %} | ||
|
|
||
|
|
||
| {% endif %} | ||
| {% endblock %} | ||
| {% block submodules %} | ||
| {% set visible_submodules = obj.submodules|selectattr("display")|list %} | ||
| {% if visible_submodules %} | ||
| Submodules | ||
| ---------- | ||
| .. toctree:: | ||
| :titlesonly: | ||
| :maxdepth: 1 | ||
|
|
||
| {% for submodule in visible_submodules %} | ||
| {{ submodule.short_name }}/index.rst | ||
| {% endfor %} | ||
|
|
||
|
|
||
| {% endif %} | ||
| {% endblock %} | ||
| {% block content %} | ||
| {% if obj.all is not none %} | ||
| {% set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %} | ||
| {% elif obj.type is equalto("package") %} | ||
| {% set visible_children = obj.children|selectattr("display")|list %} | ||
| {% else %} | ||
| {% set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %} | ||
| {% endif %} | ||
| {% if visible_children %} | ||
| {{ obj.type|title }} Contents | ||
| {{ "-" * obj.type|length }}--------- | ||
|
|
||
| {% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list|sort(attribute="id") %} | ||
| {% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list|sort(attribute="id") %} | ||
| {% set visible_attributes = visible_children|selectattr("type", "equalto", "data")|list|sort(attribute="id") %} | ||
| {% set visible_exceptions = visible_children|selectattr("type", "equalto", "exception")|list|sort(attribute="id") %} | ||
| {% if "show-module-summary" in autoapi_options and (visible_classes or visible_functions) %} | ||
| {% block classes scoped %} | ||
| {% if visible_classes %} | ||
| Classes Summary | ||
| ~~~~~~~~~~~~~~~ | ||
|
|
||
| .. autoapisummary:: | ||
|
|
||
| {% for klass in visible_classes %} | ||
| {{ klass.id }} | ||
| {% endfor %} | ||
|
|
||
|
|
||
| {% endif %} | ||
| {% endblock %} | ||
|
|
||
| {% block exceptions scoped %} | ||
| {% if visible_exceptions %} | ||
| Exceptions Summary | ||
| ~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| .. autoapisummary:: | ||
|
|
||
| {% for klass in visible_exceptions %} | ||
| `{{ klass.id }}` | ||
| {% endfor %} | ||
|
|
||
|
|
||
| {% endif %} | ||
| {% endblock %} | ||
|
|
||
| {% block functions scoped %} | ||
| {% if visible_functions %} | ||
| Functions | ||
| ~~~~~~~~~ | ||
|
|
||
| .. autoapisummary:: | ||
| :nosignatures: | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I legit don't know how to review this lol
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. relatable |
||
| {% for function in visible_functions %} | ||
| {{ function.id }} | ||
| {% endfor %} | ||
|
|
||
|
|
||
| {% endif %} | ||
| {% endblock %} | ||
|
|
||
| {% block attributes scoped %} | ||
| {% if visible_attributes %} | ||
| Attributes Summary | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| .. autoapisummary:: | ||
|
|
||
| {% for attribute in visible_attributes %} | ||
| {{ attribute.id }} | ||
| {% endfor %} | ||
|
|
||
|
|
||
| {% endif %} | ||
| {% endblock %} | ||
| {% endif %} | ||
| Contents | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
| {% for obj_item in visible_children|sort(attribute="id") %} | ||
| {{ obj_item.render()|indent(0) }} | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endblock %} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to get the docstrings for
hyperparameter_rangesetc to show upThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment is probably related to this :d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch with the original comment. I just pushed up a change to fix this! This is how it looks locally now:
Made the same change for the linear regressor!