Pvlib-python: add toggle for prompts in example code in docs

Created on 24 Nov 2020  路  8Comments  路  Source: pvlib/pvlib-python

Currently copying code examples out of the docs is tricky because it's formatted as an IPython notebook.
I propose adding the sphinx-toggleprompt extension so these can be toggled.

Similar functionality exists in the offical python docs, numpy docs, and scipy docs (among others)

(nb i am the developer of this library)

documentation enhancement

Most helpful comment

Worth noting that I don't think the scipy theme will work on IPython prompts out of the box. Compare scipy and mine. Only a trivial modification though.

All 8 comments

For those who remembered talking about prompts before, here's the link: https://groups.google.com/g/pvlib-python/c/BT3Mjerp92g/m/TvuXIHwFAwAJ

This is a nice feature to add. Curious how does numpy do it?

Numpy uses the scipy sphinx theme, which has copied the functionality from the cpython docs theme (sphinx-toggleprompt also copied it from the cpython docs theme, and modified it slightly)
https://github.com/scipy/scipy-sphinx-theme/pull/3

@jurasofish the pvlib surface is certainly easier with your library.

@pvlib/pvlib-maintainer My only hesitation is the dependency on a relatively new package and how that might affect those who want to build the documents themselves. Not much of a concern, since I think those users are the exception.

Could be that a part of #329 is to switch sphinx themes, but in the meantime I think this is a good idea. Looks like it doesn't have any dependencies so as long as we pin a version I think it shouldn't be a burden for building locally.

@kanderso-nrel what is the implication for switching sphinx themes? I missed it if it was discussed in the linked google group or PR.

@cwhanse this is the group handle: @pvlib/pvlib-maintainer

I have a mild preference for the new sphinx-toggleprompt package over maintaining this non-python code ourselves.

@kanderso-nrel what is the implication for switching sphinx themes? I missed it if it was discussed in the linked google group or PR.

I only meant that apparently some sphinx themes include this functionality out of the box (e.g. the scipy theme as mentioned earlier in this thread), so sphinx-toggleprompt would become unnecessary if we eventually switch to one of those themes.

Worth noting that I don't think the scipy theme will work on IPython prompts out of the box. Compare scipy and mine. Only a trivial modification though.

Was this page helpful?
0 / 5 - 0 ratings