Skip to content

Commit 3e25627

Browse files
authored
document class methods using sphinx3 recursive doc (pvlib#1075)
* Recursive class methods * Clean up docstring * Bump sphinx version * Update what's new * Add brackets to reference numbers * Fix bulleted list in docstring. Pin sphinx and rtd_theme versions. * Fix lint error
1 parent e2b7f19 commit 3e25627

File tree

8 files changed

+32
-42
lines changed

8 files changed

+32
-42
lines changed

docs/sphinx/source/_static/no_reference_superscript.css

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* no reference superscript */
2+
.footnote-reference {
3+
font-size: 100% !important; /* default is 90% */
4+
top: 0.0em !important; /* default is -0.4em */
5+
}
6+
7+
/* reference number in brackets */
8+
.footnote-reference::before {
9+
content: '[';
10+
}
11+
.footnote-reference::after {
12+
content: ']';
13+
}

docs/sphinx/source/_templates/autosummary/class.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
.. autoclass:: {{ objname }}
66

77
{% block methods %}
8-
.. automethod:: __init__
9-
108
{% if methods %}
119
.. rubric:: Methods
1210

1311
.. autosummary::
12+
:toctree:
13+
:recursive:
1414
{% for item in methods %}
1515
~{{ name }}.{{ item }}
1616
{%- endfor %}

docs/sphinx/source/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,10 @@
218218
# custom CSS workarounds
219219
def setup(app):
220220
# A workaround for the responsive tables always having annoying scrollbars.
221-
app.add_stylesheet("no_scrollbars.css")
221+
app.add_css_file("no_scrollbars.css")
222222
# Override footnote callout CSS to be normal text instead of superscript
223-
app.add_stylesheet("no_reference_superscript.css")
223+
# In-line links to references as numbers in brackets.
224+
app.add_css_file("reference_format.css")
224225

225226
# -- Options for LaTeX output ---------------------------------------------
226227

docs/sphinx/source/whatsnew/v0.8.1.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Testing
3131

3232
Documentation
3333
~~~~~~~~~~~~~
34+
* Update sphinx to 3.1.2 and use the ``recursive`` option in ``autosummary`` class template.
35+
(:issue:`1055`, :pull:`1075`)
3436
* Add gallery example about backtracking on sloped terrain. (:pull:`1077`)
3537

3638
Requirements
@@ -40,5 +42,6 @@ Requirements
4042
Contributors
4143
~~~~~~~~~~~~
4244
* Kevin Anderson (:ghuser:`kanderso-nrel`)
45+
* Siyan (Veronica) Guo (:ghuser:`veronicaguo`)
4346
* Will Holmgren (:ghuser:`wholmgren`)
4447
* Cliff Hansen (:ghuser:`cwhanse`)

pvlib/pvsystem.py

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,12 @@ def first_solar_spectral_loss(self, pw, airmass_absolute):
656656
calculate the spectral loss modifier. The model coefficients are
657657
specific to the module's cell type, and are determined by searching
658658
for one of the following keys in self.module_parameters (in order):
659-
'first_solar_spectral_coefficients' (user-supplied coefficients)
660-
'Technology' - a string describing the cell type, can be read from
661-
the CEC module parameter database
662-
'Material' - a string describing the cell type, can be read from
663-
the Sandia module database.
659+
660+
- 'first_solar_spectral_coefficients' (user-supplied coefficients)
661+
- 'Technology' - a string describing the cell type, can be read from
662+
the CEC module parameter database
663+
- 'Material' - a string describing the cell type, can be read from
664+
the Sandia module database.
664665
665666
Parameters
666667
----------
@@ -741,12 +742,6 @@ def singlediode(self, photocurrent, saturation_current,
741742
ivcurve_pnts=None):
742743
"""Wrapper around the :py:func:`pvlib.pvsystem.singlediode` function.
743744
744-
Parameters
745-
----------
746-
See :py:func:`pvsystem.singlediode` for details
747-
748-
Returns
749-
-------
750745
See :py:func:`pvsystem.singlediode` for details
751746
"""
752747
return singlediode(photocurrent, saturation_current,
@@ -757,12 +752,6 @@ def i_from_v(self, resistance_shunt, resistance_series, nNsVth, voltage,
757752
saturation_current, photocurrent):
758753
"""Wrapper around the :py:func:`pvlib.pvsystem.i_from_v` function.
759754
760-
Parameters
761-
----------
762-
See :py:func:`pvsystem.i_from_v` for details
763-
764-
Returns
765-
-------
766755
See :py:func:`pvsystem.i_from_v` for details
767756
"""
768757
return i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
@@ -773,12 +762,6 @@ def snlinverter(self, v_dc, p_dc):
773762
"""Uses :py:func:`pvlib.inverter.sandia` to calculate AC power based on
774763
``self.inverter_parameters`` and the input voltage and power.
775764
776-
Parameters
777-
----------
778-
See :py:func:`pvlib.inverter.sandia` for details
779-
780-
Returns
781-
-------
782765
See :py:func:`pvlib.inverter.sandia` for details
783766
"""
784767
return inverter.sandia(v_dc, p_dc, self.inverter_parameters)
@@ -787,12 +770,6 @@ def adrinverter(self, v_dc, p_dc):
787770
"""Uses :py:func:`pvlib.inverter.adr` to calculate AC power based on
788771
``self.inverter_parameters`` and the input voltage and power.
789772
790-
Parameters
791-
----------
792-
See :py:func:`pvlib.inverter.adr` for details
793-
794-
Returns
795-
-------
796773
See :py:func:`pvlib.inverter.adr` for details
797774
"""
798775
return inverter.adr(v_dc, p_dc, self.inverter_parameters)

pvlib/tracking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ def get_aoi(self, surface_tilt, surface_azimuth, solar_zenith,
149149
150150
For a given set of solar zenith and azimuth angles, the
151151
surface tilt and azimuth parameters are typically determined
152-
by :py:method:`~SingleAxisTracker.singleaxis`. The
153-
:py:method:`~SingleAxisTracker.singleaxis` method also returns
152+
by :py:meth:`~SingleAxisTracker.singleaxis`. The
153+
:py:meth:`~SingleAxisTracker.singleaxis` method also returns
154154
the angle of incidence, so this method is only needed
155155
if using a different tracking algorithm.
156156

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
'optional': ['cython', 'ephem', 'netcdf4', 'nrel-pysam', 'numba',
4949
'pvfactors', 'siphon', 'statsmodels', 'tables',
5050
'cftime >= 1.1.1'],
51-
'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme',
52-
'sphinx-gallery', 'docutils == 0.15.2', 'pillow',
53-
'netcdf4', 'siphon', 'tables'],
51+
'doc': ['ipython', 'matplotlib', 'sphinx == 3.1.2',
52+
'sphinx_rtd_theme==0.5.0', 'sphinx-gallery', 'docutils == 0.15.2',
53+
'pillow', 'netcdf4', 'siphon', 'tables'],
5454
'test': TESTS_REQUIRE
5555
}
5656
EXTRAS_REQUIRE['all'] = sorted(set(sum(EXTRAS_REQUIRE.values(), [])))

0 commit comments

Comments
 (0)