Skip to content
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 some example notebooks and a notebook related files sidebar item #108

Merged

Conversation

jacobtomlinson
Copy link
Member

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.

source/examples
├── index.md
├── rapids-sagemaker-higgs
│   ├── Dockerfile
│   ├── notebook.ipynb
│   └── rapids-higgs.py
└── xgboost-gpu-hpo-job-parallel-k8s
    └── notebook.ipynb

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.

Screenshot 2023-01-20 at 13 40 08

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.

@jacobtomlinson
Copy link
Member Author

I'm going to go ahead and merge this so that I can raise the next one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create extension to show related notebook files in sidebar
1 participant