Skip to content

add toggle for prompts in example code in docs #1095

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

Closed
jurasofish opened this issue Nov 24, 2020 · 8 comments · Fixed by #1096
Closed

add toggle for prompts in example code in docs #1095

jurasofish opened this issue Nov 24, 2020 · 8 comments · Fixed by #1096

Comments

@jurasofish
Copy link
Contributor

jurasofish commented Nov 24, 2020

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)

@kandersolar
Copy link
Member

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

@cwhanse
Copy link
Member

cwhanse commented Nov 24, 2020

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

@jurasofish
Copy link
Contributor Author

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)
scipy/scipy-sphinx-theme#3

@cwhanse
Copy link
Member

cwhanse commented Nov 25, 2020

@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.

@kandersolar
Copy link
Member

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.

@wholmgren
Copy link
Member

@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.

@kandersolar
Copy link
Member

@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.

@jurasofish
Copy link
Contributor Author

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.

@wholmgren wholmgren added this to the 0.8.1 milestone Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants