Skip to content

Commit 9fe7959

Browse files
committed
Merge branch 'main' into docstring-guidelines-units-etc
2 parents 52596a9 + d6379ef commit 9fe7959

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+36135
-35400
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- Thank you for your contribution! The following items must be addressed before the code can be merged. Please don't hesitate to ask for help if you're unsure of how to accomplish any of the items. Feel free to remove checklist items that are not relevant to your change. -->
22

33
- [ ] Closes #xxxx
4-
- [ ] I am familiar with the [contributing guidelines](https://pvlib-python.readthedocs.io/en/latest/contributing.html)
4+
- [ ] I am familiar with the [contributing guidelines](https://pvlib-python.readthedocs.io/en/latest/contributing/index.html)
55
- [ ] Tests added
66
- [ ] Updates entries in [`docs/sphinx/source/reference`](https://github.com/pvlib/pvlib-python/blob/main/docs/sphinx/source/reference) for API changes.
77
- [ ] Adds description and name entries in the appropriate "what's new" file in [`docs/sphinx/source/whatsnew`](https://github.com/pvlib/pvlib-python/tree/main/docs/sphinx/source/whatsnew) for all changes. Includes link to the GitHub Issue with `` :issue:`num` `` or this Pull Request with `` :pull:`num` ``. Includes contributor name and/or GitHub username (link with `` :ghuser:`user` ``).

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,21 @@ jobs:
3333
- name: Build packages
3434
run: python -m build
3535

36+
- name: List distribution file sizes
37+
run: du -h dist/*
38+
3639
- name: Check metadata verification
3740
run: python -m twine check --strict dist/*
3841

42+
- name: Ensure that the wheel installs successfully
43+
run: |
44+
mkdir ./tmp
45+
pip install $(find dist -type f -name "*.whl") --target=./tmp
46+
47+
- name: List installed file sizes
48+
run: du -h pvlib
49+
working-directory: ./tmp
50+
3951
# only publish distribution to PyPI for tagged commits
4052
- name: Publish distribution to PyPI
4153
if: startsWith(github.ref, 'refs/tags/v')
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update Top Ranked Issues
2+
3+
on:
4+
schedule:
5+
# Runs every day at 00:00 AM UTC
6+
- cron: '0 0 * * *'
7+
8+
jobs:
9+
run-script:
10+
runs-on: ubuntu-latest
11+
12+
# Run only if the repository is pvlib/pvlib-python
13+
if: ${{ github.repository == 'pvlib/pvlib-python' }}
14+
15+
env:
16+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
18+
steps:
19+
- name: Check out the repository
20+
uses: actions/checkout@v4 # This ensures the repository code is available
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install PyGithub
31+
32+
- name: Run update_top_ranking_issues.py
33+
run: |
34+
python ./scripts/update_top_ranking_issues.py

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Contributing
8181
============
8282

8383
We need your help to make pvlib-python a great tool!
84-
Please see the [Contributing page](http://pvlib-python.readthedocs.io/en/stable/contributing.html) for more on how you can contribute.
84+
Please see the [Contributing page](https://pvlib-python.readthedocs.io/en/stable/contributing/index.html) for more on how you can contribute.
8585
The long-term success of pvlib-python requires substantial community support.
8686

8787

203 KB
Loading

docs/sphinx/source/conf.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,28 @@
5656
'sphinx_gallery.gen_gallery',
5757
'sphinx_toggleprompt',
5858
'sphinx_favicon',
59+
'hoverxref.extension',
5960
]
6061

6162
mathjax3_config = {'chtml': {'displayAlign': 'left',
6263
'displayIndent': '2em'}}
6364

65+
# Example configuration for intersphinx: refer to the Python standard library.
66+
intersphinx_mapping = {
67+
'python': ('https://docs.python.org/3/', None),
68+
'numpy': ('https://numpy.org/doc/stable/', None),
69+
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
70+
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None),
71+
'matplotlib': ('https://matplotlib.org/stable', None),
72+
}
73+
74+
# Enable hover tooltips
75+
hoverxref_auto_ref = True
76+
hoverxref_roles = ["class", "meth", "func", "ref", "term"]
77+
hoverxref_role_types = dict.fromkeys(hoverxref_roles, "tooltip")
78+
hoverxref_domains = ["py"]
79+
hoverxref_intersphinx = list(intersphinx_mapping.keys())
80+
6481
napoleon_use_rtype = False # group rtype on same line together with return
6582

6683
# Add any paths that contain templates here, relative to this directory.
@@ -357,15 +374,6 @@ def setup(app):
357374
# If true, do not generate a @detailmenu in the "Top" node's menu.
358375
# texinfo_no_detailmenu = False
359376

360-
# Example configuration for intersphinx: refer to the Python standard library.
361-
intersphinx_mapping = {
362-
'python': ('https://docs.python.org/3/', None),
363-
'numpy': ('https://numpy.org/doc/stable/', None),
364-
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
365-
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None),
366-
'matplotlib': ('https://matplotlib.org/stable', None),
367-
}
368-
369377
ipython_warning_is_error = False
370378

371379
# suppress "WARNING: Footnote [1] is not referenced." messages

docs/sphinx/source/contributing/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _contributing:
2+
13
============
24
Contributing
35
============

docs/sphinx/source/contributing/style_guide.rst

Lines changed: 188 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pvlib python generally follows the `PEP 8 -- Style Guide for Python Code
1313
is 79 characters.
1414

1515
pvlib python uses a mix of full and abbreviated variable names. See
16-
:ref:`variables_style_rules`. We could be better about consistency.
16+
:ref:`nomenclature`.
1717
Prefer full names for new contributions. This is especially important
1818
for the API. Abbreviations can be used within a function to improve the
1919
readability of formulae.
@@ -90,6 +90,82 @@ When specifying parameters and their units, please follow these guidelines:
9090
dni : numeric
9191
Direct normal irradiance, see :term:`dni`. [Wm⁻²]
9292
93+
94+
.. _reference_style:
95+
96+
References
97+
----------
98+
pvlib-python is transitioning to the `IEEE reference style <https://journals.ieeeauthorcenter.ieee.org/wp-content/uploads/sites/7/IEEE_Reference_Guide.pdf>`_,
99+
which should be used in all new contributions. At minimum, a reference should
100+
include:
101+
102+
* Author list (for more than six authors, list only the first with et al.)
103+
* Publication title
104+
* Publisher (journal title, laboratory name, etc.)
105+
* Year of publication
106+
* DOI (if available)
107+
108+
The recommended citation style for several media types is as follows:
109+
110+
**Journal article**:
111+
112+
Author initials and surname, "Title of article," abbreviated journal
113+
title, vol. number, issue number, page numbers, Abbreviated Month Year.
114+
115+
**Book**:
116+
117+
Author initials. Author Surname, "Chapter title" in Book Title, xth ed.
118+
City of Publisher, (only U.S. State), Country: Abbrev. of Publisher, year,
119+
ch. x, sec. x, pp. xxx–xxx.
120+
121+
**Technical report**:
122+
123+
Author initials. Author Surname, "Report title" Abbrev. publisher name,
124+
City of publisher, Abbrev. State, Country, Rep. xxx, year
125+
126+
The example below shows how to cite material and generate a reference list
127+
using the IEEE style in a docstring::
128+
129+
This is the recommended citation for the pvlib-python project [1]_. There
130+
are also some conference papers linked to pvlib, for example [2]_.
131+
132+
Other types of reference you may find in the pvlib-python documentation
133+
include books [3]_, technical reports [4]_, and websites [5]_.
134+
135+
References
136+
----------
137+
.. [1] K. Anderson, C. Hansen, W. Holmgren, A. Jensen, M. Mikofski,
138+
and A Driesse. "pvlib python: 2023 project update." J. Open Source
139+
Softw. vol. 8, no. 92, pp. 5994, Dec 2023,
140+
:doi:`10.21105/joss.05994`.
141+
142+
.. [2] J. S. Stein, "The Photovoltaic Performance Modeling Collaborative
143+
(PVPMC)," In Proc. 38th IEEE Photovoltaic Specialists Conference
144+
(PVSC), Austin, TX, USA, 2012, pp. 3048-3052,
145+
:doi:`10.1109/PVSC.2012.6318225`.
146+
147+
.. [3] J. A. Duffie and W. A. Beckman, "Solar Radiation" in Solar
148+
Engineering of Thermal Processes, 3rd ed, New York, USA, J. Wiley
149+
and Sons, 2006, ch. 1, sec. 1.5, pp.9-11.
150+
151+
.. [4] R. Bird and C. Riordan, "Simple solar spectral model for direct and
152+
diffuse irradiance on horizontal and tilted planes at the earth’s
153+
surface for cloudless atmospheres", NREL, Golden, CO, USA, Technical
154+
Report TR-215-2436, 1984, :doi:`10.2172/5986936`.
155+
156+
.. [5] "PVPMC Home." Sandia National Laboratories PV Performance Modeling
157+
Collaborative. Accessed: Oct. 17, 2024. [Online.] Available:
158+
<https://pvpmc.sandia.gov/>_
159+
160+
Things to note:
161+
162+
* In-text numeric citations are a number inside square brackets, followed
163+
by an underscore, e.g. ``[1]_``.
164+
* To include a DOI, you can use pvlib's custom ``:doi:``
165+
`Sphinx role <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_,
166+
followed by the DOI inside a set of backticks.
167+
168+
93169
.. _building-the-documentation:
94170

95171
Building the documentation
@@ -108,7 +184,7 @@ An easy way to do this is with::
108184

109185
Note: Anaconda users may have trouble using the above command to update an
110186
older version of docutils. If that happens, you can update it with ``conda``
111-
(e.g. ``conda install docutils=0.15.2``) and run the above command again.
187+
(e.g. ``conda install docutils=0.21``) and run the above command again.
112188

113189
Once the ``doc`` dependencies are installed, navigate to ``/docs/sphinx`` and
114190
execute::
@@ -127,6 +203,116 @@ Note that Windows users need not have the ``make`` utility installed as pvlib
127203
includes a ``make.bat`` batch file that emulates its interface.
128204

129205

206+
.. _example-docstring:
207+
208+
Example Docstring
209+
-----------------
210+
211+
Here is a template for a function docstring that encapsulates the main
212+
features that may be used in any docstring. Note that not all sections are
213+
required for every function.
214+
215+
.. code-block:: python
216+
217+
def example_function(poa_global, exponents, degree_symbol, time_ref='UT',
218+
optional_arg=None):
219+
r"""
220+
One-sentence summary of the function (no citations).
221+
222+
A longer description of the function. This can include citations
223+
(references) to literature [1]_, websites [2]_, and other code elements
224+
such as functions (:py:func:`pvlib.location.lookup_altitude`) and
225+
classes (:py:class:`pvlib.location.Location`).
226+
227+
.. versionadded:: 0.0.1
228+
There are many more purpose-specific directives, admonitions and such
229+
available at `this link <admonitions>`_. E.g.: ``.. versionchanged::``,
230+
``.. deprecated::``, ``.. note::`` and ``.. warning::``.
231+
232+
.. _admonitions: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#admonitions-messages-and-warnings
233+
234+
Parameters
235+
----------
236+
poa_global : numeric
237+
Plane-of-array global irradiance, see :term:`poa_global`. [Wm⁻²].
238+
exponents : array-like
239+
A list of exponents. [x⁰¹²³⁴⁵⁶⁷⁸⁹⁻].
240+
degree_symbol : pandas.Series or pandas.DataFrame
241+
It's different from superscript zero. [°].
242+
time_ref : ``'UT'`` or ``'TST'``, default: ``'UT'``
243+
``'UT'`` (universal time) or ``'TST'`` (True Solar Time).
244+
optional_arg : integer, optional
245+
A description of ``optional_arg``. [Unitless].
246+
247+
Specify a suitable datatype for each parameter. Other common
248+
data types include ``str``, ``bool``, ``float``, ``numeric``
249+
and ``pandas.DatetimeIndex``.
250+
251+
Returns
252+
-------
253+
name : numeric
254+
A description of the return value.
255+
256+
Raises
257+
------
258+
ValueError
259+
If ``poa_global`` is negative.
260+
KeyError
261+
If ``time_ref`` does not exist.
262+
263+
Notes
264+
-----
265+
This section can include additional information about the function.
266+
267+
For example, an equation using LaTeX markup:
268+
269+
.. math::
270+
271+
a = \left(\frac{b}{c}\right)^2
272+
273+
where :math:`a` is the result of the equation, and :math:`b` and :math:`c`
274+
are inputs.
275+
276+
Or a figure with a caption:
277+
278+
.. figure:: ../../_images/pvlib_logo_horiz.png
279+
:scale: 10%
280+
:alt: alternate text
281+
:align: center
282+
283+
Figure caption.
284+
285+
See Also
286+
--------
287+
pvlib.location.lookup_altitude, pvlib.location.Location
288+
289+
Examples
290+
--------
291+
>>> example_function(1, 1, pd.Series([1]), "TST", 2)
292+
'Something'
293+
294+
References
295+
----------
296+
A IEEE citation to a relevant reference. You may use an automatic
297+
citation generator to format the citation correctly.
298+
299+
.. [1] Anderson, K., Hansen, C., Holmgren, W., Jensen, A., Mikofski, M.,
300+
and Driesse, A. "pvlib python: 2023 project update." Journal of Open
301+
Source Software, 8(92), 5994, (2023). :doi:`10.21105/joss.05994`.
302+
.. [2] J. Smith and J. Doe. "Obama inaugurated as President." CNN.com.
303+
Accessed: Feb. 1, 2009. [Online.]
304+
Available: http://www.cnn.com/POLITICS/01/21/obama_inaugurated/index.html
305+
"""
306+
a = "Some"
307+
b = "thing"
308+
return a + b
309+
310+
A preview of how this docstring would render in the documentation can be seen in the
311+
following file: :download:`Example docstring<../_images/example_function_screenshot.png>`.
312+
313+
Remember that to show the docstring in the documentation, you must list
314+
the function in the appropriate ``.rst`` file in the ``docs/sphinx/source/reference`` folder.
315+
130316
.. _example-gallery:
131317

132318
Example Gallery

docs/sphinx/source/contributing/testing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _testing:
22

3-
Testing
4-
=======
3+
Testing and benchmarking
4+
========================
55

66
.. _overview:
77

docs/sphinx/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pvlib python
2626
that-use-pvlib-python>`_ page for inspiration and listing of your
2727
application.
2828

29-
There is a :ref:`variable naming convention <variables_style_rules>` to
29+
There is a :ref:`variable naming convention <nomenclature>` to
3030
ensure consistency throughout the library.
3131

3232

0 commit comments

Comments
 (0)