Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/sphinx/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,39 @@ To build the docs locally, install the ``doc`` dependencies specified in the
`setup.py <https://github.com/pvlib/pvlib-python/blob/master/setup.py>`_
file. See :ref:`installation` instructions for more information.

Example Gallery
---------------

The example gallery uses `sphinx-gallery <https://sphinx-gallery.github.io/>`_
and is generated from script files in the
`docs/examples <https://github.com/pvlib/pvlib-python/tree/master/docs/examples>`_
directory. sphinx-gallery will execute example files that start with
``plot_`` and capture the output.

Here is a starter template for new examples:

.. code-block:: python

"""
Page Title
==========

A sentence describing the example.
"""

# %%
# Explanatory text about the example, what it does,
# why it does it, etc.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# why it does it, etc.
# why it does it, etc. Text before the first line of code `import pvlib` will be printed to the example's webpage.

Copy link
Member Author

Choose a reason for hiding this comment

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

Anyone know why the Edit on GitHub links don't work for the gallery examples?

I think what's happening is that sphinx-gallery generates intermediate .rst files from the example scripts and puts them in sphinx/source/auto_examples, making them look just like normal RST source files. When sphinx itself runs, it doesn't realize those files were just auto-generated a moment ago and so it creates "edit on github" links assuming that those RST files exist on GH as well.

Looks like it isn't a trivial fix to make the links point to the original .py files -- MetPy handles it with a custom template: Unidata/MetPy@8f1783a. If nobody is eager, I'll volunteer to try to get it working in a separate PR.


import pvlib
import matplotlib.pyplot as plt

plt.scatter([1, 2, 3], [4, 5, 6])
plt.show()

For more details, see the sphinx-gallery
`docs <https://sphinx-gallery.github.io/stable/syntax.html#embedding-rst>`_.

.. _testing:

Testing
Expand Down
5 changes: 3 additions & 2 deletions docs/sphinx/source/whatsnew/v0.7.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ Bug fixes

Documentation
~~~~~~~~~~~~~
* Add NumFOCUS affiliation to Sphinx documentation :pull:`862`
* Add example of IV curve generation :pull:`872`
* Add NumFOCUS affiliation to Sphinx documentation (:pull:`862`)
* Add example of IV curve generation (:pull:`872`)
* Add section about gallery examples to Contributing guide (:pull:`905`)

Requirements
~~~~~~~~~~~~
Expand Down