-
Notifications
You must be signed in to change notification settings - Fork 27
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
Documentation set up with Sphinx #200
Conversation
docs/index.md
Outdated
@@ -0,0 +1,135 @@ | |||
# napari-animation documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like that this docs/index.md
file is an almost-identical copy of the README.md
. This is a recipe for updates/changes being made in one place but not the other, and eventually ending up with users/developers having only partial information (depending on whether they mostly look at the built docs website, or mostly look at the github repo home page).
Can we change this, either to point sphinx directly to the main README.md in the repository, or somehow have the contents actually copied across during the build process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I didn't know what to write here so just copied the README as a placeholder. I can do an include, but there are some sections that won't work, for example the admonitions (since github markdown and myst markdown don't agree on that syntax)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so we can choose between:
- Use the include directive in index.md, keep README.md and choose whether to have
1A) Have bad admonition formatting on the website, or...
1B) Have bad admonition formatting on the github page. Personally, I'd prioritize making the official website look good. - Use the include directive in index.md, and convert the README to ReStructured text. Then the formatting could look good both on the website and on the github page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1B) Have bad admonition formatting on the github page. Personally, I'd prioritize making the official website look good.
This would be my choice also.
https://sphinx-gallery.github.io/stable/advanced.html#example-2-detecting-image-files-on-disk | ||
""" | ||
# Find all video files in the directory of this example. | ||
video_file_extensions = [".mp4", ".mov"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked this works for .mp4 and .mov filetypes. We could add more, so long as someone checks they work well in the built docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although for some reason, when I build the documentation with make docs
there are warnings output about the .mov file format.
I'm not sure why, because the HTML website works as expected, regardless of whether we have .mov or .mp4 videos embedded. Regardless, I've changed the output files from our example scripts to use .mp4, just to avoid the warnings in the docs build.
rst = f""".. video:: {video_filepath} | ||
:autoplay: | ||
:loop: | ||
:width: 600 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this part.
Currently it sets the width of the embedded video to 500 pixels. I'd prefer it was a percentage of the page width instead (i.e. more responsive to different screen sizes). I don't think you can do that easily with sphinxcontrib-video as it currently exists, so maybe we should replace this dependency with a template docstring of the HTML we need to embed in the RST document, so we can have more control over the output result.
Docs: https://github.com/sphinx-contrib/video
I don't see the ipython notebook example int he built html docs. I had expected to see it appear as a page in the examples gallery. @melissawm is this part working for you? EDIT: Ah, I see now. Any jupyter notebook files are being deliberately skipped (see def setup(app):
"""Set up docs build.
* Ignores .ipynb files to prevent sphinx from complaining about multiple
files found for document when generating the gallery
* Rewrites github anchors to be comparable
* Adds google calendar api key to meetings schedule page
"""
app.registry.source_suffix.pop(".ipynb", None) I thought we wanted the notebooks to be executed and included? #70 I see that there is a single line of text in the gallery.rst page linking to it, but that is easy to overlook. It also leaves us vulnerable to the code in that notebook going out of date, and we won't know it produces errors. |
Summarizing the current status (Melissa, please add or correct anything I've got wrong here) Items remaining for this PR:
Nice to have, possibly in a later PR:
|
…b markdown rendering of formatting slightly, but better to prioritize the official docs website)
…if no video files found saved to disk
I don't think you actually need this to deploy to the same-repo's gh-pages. See the deploy to github pages docs (though they are not as clear as I'd like about this):
To answer your Q, the napari steering council can do that if needed. But I think it's not. 😅 |
Ok, maybe something is funky about how the napari/docs repository handles this, that's where the secret key business came from. If someone would like to edit the new |
Yeah the issue with the napari/docs repo is that it needs to deploy to a different repo. Is that the case here or are we just deploying to the gh-pages branch? |
@jni is right, this can be simplified. Unfortunately I won't have time this week to work on this PR but I can take a look next week if it's still pending. Thanks for the fixes @GenevieveBuckley ! |
…eed for separate token
I've made some progress towards getting the deployment working.
I've uploaded the most recent artifact and the CI logs here on google drive. You can open the html website locally in your browser and see that it all looks correct and the gallery videos play. If anyone can help figure out why the artifact is causing problems, that would be wonderful. Note: I'm using actions/upload-artifact instead of the suggested actions/upload-pages-artifact, mostly because I was finding it tricky to include multiple directories (we need our build, static, and gallery files). I don't think that could be causing the problem, but should mention it. Finally, I've made a copy of the repo (not a fork, it won't deploy github pages on a fork) to play with things here: https://github.com/GenevieveBuckley/napari-animation-copy/ I can add people to this repo if you like. |
I've got it working now - you can see a working test website here: In the end it was simplest to add a command in the Makefile to copy the video files across into docs/_build/gallery/images, then point the actions/upload-pages-artifact to just the docs/_build folder (which now contains everything we need). |
It works! 🎉 🚀 |
Awesome! 🎉 |
Follow up to #200 Some updates for the README, related to the new docs website.
Supersedes #173
May close #80
I haven't really looked at the scrapers, because currently the docs execute even if the images are not in the gallery. Feel free to push to this PR if you know how to build the animation scraper. I can also try to come up with a solution later.
cc @GenevieveBuckley