Add some example notebooks and a notebook related files sidebar item #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #105.
To start this PR I copied a couple of notebooks from Cloud ML Examples so I had some pages to work with. I think a good structure for storing notebooks in this repo is to create a new directory for each notebook in the
examples
section containing the notebook and all the supporting files.I've also updated the site index to link to this new examples section instead of the Cloud ML Examples repo and I've manually created an index page with a card grid for the examples in the same way we have done with other index pages. In the future, this index should be replaced with an autogenerated one in #106.
We need to migrate all of the other useful notebooks from Cloud ML Examples but that can be done separately once this PR has been merged. I opened rapidsai/cloud-ml-examples#203 to track this.
This PR then adds a custom extension and sidebar template to list the related files that exist in the notebook's directory in the sidebar. Each item in the list is linked to the GitHub URL of the file so users can easily browse the code without us having to render it in Sphinx. This does mean the links will be broken until the PR has been merged.
This extension has two parts, a Python script which hooks into the Sphinx
html-page-context
event and if the page is a notebook in the/examples
section it generates the list of files and adds them to the page context. The second part is a custom template which is included in the right-hand sidebar and displays the list of items.Note that the sidebar is on the right rather than the left as shown in #105 because it felt more natural for resources related to the page to be linked below the page title nav, rather than the whole example nav.