Skip to content
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

Add inheritance diagram to API reference #695

Merged
merged 8 commits into from Apr 24, 2020
11 changes: 11 additions & 0 deletions docs/source/_static/style.css
@@ -0,0 +1,11 @@
div.graphviz {
overflow: auto;
max-width: 620px;
max-height: 30px;
text-align: center;
}

img.inheritance {
max-width: none;
max-height: 30px;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set specific pixel values for these things as opposed to percentages?

I mean, I guess I understand why the height is fixed at a pixel value. But I wonder if making it slightly more would be helpful. When I scroll to the right on my mac, the scroll bar covers half the image.

Screen Shot 2020-04-24 at 2 46 21 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real answer is: I couldn't get it to work with percentages lol. I wanted to use 100% of the div (max-height: 100%) but it never worked for me. Yeah I can bump the height value!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Weird! That's ok.

2 changes: 2 additions & 0 deletions docs/source/_templates/class.rst
Expand Up @@ -2,6 +2,8 @@

.. currentmodule:: {{ module }}

.. inheritance-diagram:: {{ objname }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which elements use class.rst?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm realizing I like that we have estimator.rst / transformer.rst because the names clearly indicate what those files correspond to, but not true with class.rst

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsherry its just every other class thats not pipeline/estimator/transformer. I made the other .rst files because of class properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok.


.. autoclass:: {{ objname }}
{% block methods %}
{% if methods %}
Expand Down
3 changes: 2 additions & 1 deletion docs/source/_templates/class_with_properties.rst
Expand Up @@ -2,8 +2,9 @@

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
.. inheritance-diagram:: {{ objname }}

.. autoclass:: {{ objname }}
{% block methods %}
{% if methods %}
.. rubric:: Methods
Expand Down
2 changes: 2 additions & 0 deletions docs/source/_templates/estimator_class.rst
Expand Up @@ -2,6 +2,8 @@

.. currentmodule:: {{ module }}

.. inheritance-diagram:: {{ objname }}

.. autoclass:: {{ objname }}
{% set class_attributes = ['name', 'model_family', 'hyperparameter_ranges', 'supported_problem_types'] %}

Expand Down
4 changes: 3 additions & 1 deletion docs/source/_templates/pipeline_class.rst
Expand Up @@ -2,7 +2,9 @@

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
.. inheritance-diagram:: {{ objname }}

.. autoclass:: {{ objname }}
{% set class_attributes = ['name', 'summary', 'component_graph', 'problem_type', 'model_family', 'hyperparameters', 'custom_hyperparameters'] %}

{% block attributes %}
Expand Down
3 changes: 3 additions & 0 deletions docs/source/_templates/transformer_class.rst
Expand Up @@ -2,7 +2,10 @@

.. currentmodule:: {{ module }}

.. inheritance-diagram:: {{ objname }}

.. autoclass:: {{ objname }}

{% set class_attributes = ['name', 'model_family', 'hyperparameter_ranges'] %}

{% block attributes %}
Expand Down
1 change: 1 addition & 0 deletions docs/source/changelog.rst
Expand Up @@ -55,6 +55,7 @@ Changelog
* Fixed Sphinx warnings about BalancedAccuracy objective :pr:`669`
* Updated API reference to include missing components and clean up pipeline docstrings :pr:`689`
* Reorganize API ref, and clarify pipeline sub-titles :pr:`688`
* Added inheritance diagrams to API reference :pr:`695`
* Testing Changes
* Matched install commands of `check_latest_dependencies` test and it's GitHub action :pr:`578`
* Added Github app to auto assign PR author as assignee :pr:`477`
Expand Down
4 changes: 4 additions & 0 deletions docs/source/conf.py
Expand Up @@ -53,6 +53,8 @@
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx.ext.extlinks',
'sphinx.ext.graphviz',
'sphinx.ext.inheritance_diagram'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -208,6 +210,8 @@
nbsphinx_execute = 'always'
nbsphinx_timeout = 600 # sphinx defaults each cell to 30 seconds so we need to override here

inheritance_graph_attrs = dict(rankdir="LR", size='"1000, 333"',
fontsize=30, labelfontsize=30, ratio='compress', dpi=960)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Is there doc on what parameters this module supports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! Its just the graphviz parameters. https://www.graphviz.org/doc/info/attrs.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can play with them more later to make things prettier 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice


class AccessorLevelDocumenter(Documenter):
"""
Expand Down