-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Add download option button to tutorials in docs #1619
Comments
I'd like to work on this issue. The myST docs themselves show these options on the top right part of the page: Note that, nicely, it changes the output format to just md and pdf if there is no code, It seems to me that this part of the conf.py file may configure it
|
Bummer... it seems that this configuration is not supported by the pydata theme. I found a hack around this by surfing projects using the theme, in the NetworkX docs, where a button on the top of examples allows one to export the .pynb file. |
Hi, I am interested on working this issue but I need to understand this point more clearly: "So, ideally, somehow the Jupyter notebooks should be created somehow (at documentation build or with another script), but still appear in the version of the docs that is hosted on readthedocs. It's a tricky issue :).". Can you explain this point? |
Hi @devilkiller-ag, we currently use So, the optimal solution would be to convert the We don't have a clear solution in mind. In fact, the most difficult part of this issue is exploring and proposing a solution, if it exists :-) |
Hi, Can we use Jupytext to convert our .md to .ipynb?
We can create a script that utilizes jupytext to convert the .md files to .ipynb notebooks. And call it in sphinx conf.py file before build. |
I don't want to admit how much time I spent on this without non-hacky success, but here is what I learned. I hope it can be useful to others. ThemesAs Nate mentioned, the download button is not an option in the pydata theme that Mitiq currently uses. However, the button is a part of the
After making those changes, I recommend the following html_theme_options = {
"announcement": '<a href="https://unitaryhack.dev/">unitaryHACK</a> is \
coming <b>May 26-Jun 13</b>! Get rewarded for contributing to open source \
quantum software!',
"repository_url": "https://github.com/unitaryfund/mitiq",
"repository_branch": "master",
"use_source_button": False,
"use_repository_button": True,
"use_issues_button": True,
"use_download_button": True,
"use_fullscreen_button": False,
"path_to_docs": "docs/source",
} Those options do a few things, including adding the download button. Unfortunately, the download only includes the Using the Converting NotebooksIf you convert notebooks from WorkflowIt's hard to know how changes are being implemented without rerunning the books from a clean state, but that takes forever. Therefore, the best luck I've found for a fast pipeline is to delete all but one or two books while iterating, and then rollback the deletions once you think you have a solution worth testing full-on. This makes Next StepsMy next two approaches that I am considering trying are:
Closing ThoughtsI don't really care about a bounty, and now I just want this solved. I hope someone else benefits from what I learned and gets this done in an elegant way. Happy hacking |
Thanks @andre-a-alves, I am going to give this a try. |
@devilkiller-ag Take a look at my branch It copies the source directory to _source, and then it converts
I still see the following issues that need to be dealt with:
What I don't like is that it does not give the option to download either .md or .ipynb, and it also can't launch MyBinder, because MyBinder has the .md files and the docs have the .ipynb files. I am sure there has to be a way to get both files into the download button like MyST-NB does, but I am at a loss as to what that is. All that being said, I'm going to enjoy the next couple of days of a three-day weekend. Feel free to take my branch and work on the remaining issues if it helps |
Thanks @andre-a-alves I will look into your branch and understand the issue. |
Excellent writeup @andre-a-alves and hopefully this is helpful for a solution. |
Hi @nathanshammah I would also like to work on this issue. @devilkiller-ag can we team up ? |
@aryanguptaaa Yeah, that would be great 👍🏻 |
@nathanshammah Can we team up? |
Yes, you can! There was a similar question on Discord and so I copy and paste the answer: If you do work on a team, ensure you make it clear when opening a PR. You can do this by either ensuring all authors have commits on the branch, or adding a description to the PR with all the authors github handles. Moreover, of course, you would get a single bounty which must be shared with the team. |
Thanks you @andreamari , I will add @aryanguptaaa as a collaborator in the forked repo I am working on and mention it in the draft PR I have made. I will also contact @aryanguptaaa to share the bounty when we get that. |
@devilkiller-ag let's talk and coordinate on discord ? |
Thank you @andreamari |
Here is my Discord ID: AshmitJaiSaritaGupta#5291 |
Issue Description
Add download option button to tutorials in docs, including
.ipynb
option. However, we would like to have the source code as it is, in terms of.md
files, without adding .ipynb files inmitiq/docs/source/examples/
, as Jupyter notebooks are hard to track in version control on Github. So, ideally, somehow the Jupyter notebooks should be created somehow (at documentation build or with another script), but still appear in the version of the docs that is hosted on readthedocs. It's a tricky issue :).Proposed Solution
Find solution in other sphinx documentations.
Additional References
See the top right button in this QuTiP notebook: https://nbviewer.org/urls/qutip.org/qutip-tutorials/tutorials-v4/time-evolution/003_qubit-dynamics.ipynb
The text was updated successfully, but these errors were encountered: