Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Sep 14, 2021
0 parents commit 8af632b
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish

on: push

jobs:
publish:
name: Publish reveal.js slides
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: pip install -r requirements.txt
- run: sudo apt update -qy && sudo apt install ffmpeg -qy
- run: jupyter nbconvert *.ipynb --to slides --execute
- run: mkdir dist && mv *.slides.html dist/index.html
- uses: JamesIves/[email protected]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: Deploy to gh-pages
with:
branch: gh-pages
folder: dist
single-commit: true
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending

- repo: https://github.com/psf/black
rev: 21.8b0
hooks:
- id: black

- repo: https://github.com/dfm/black_nbconvert
rev: v0.3.0
hooks:
- id: black_nbconvert

- repo: https://github.com/kynan/nbstripout
rev: 0.5.0
hooks:
- id: nbstripout
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Liam Keegan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# [ssciwr.github.io/jupyter-slides-template](https://ssciwr.github.io/jupyter-slides-template)

A simple way to convert a jupyter notebook into an online web presentation.

The notebook [jupyter-slides-template.ipynb](jupyter-slides-template.ipynb) is converted into [reveal.js](https://revealjs.com/) html slides and hosted by github pages at [ssciwr.github.io/jupyter-slides-template](https://ssciwr.github.io/jupyter-slides-template)

## Quickstart

- click the 'Use this template' button to create your own repo based on this one
- enable gh-pages for your repo: Settings -> Pages -> Source branch: gh-pages
- slides will appear at `YOUR_USERNAME.github.io/YOUR_REPO_NAME`

## Optional extras

- add any additional Python libraries your notebook needs to [requirements.txt](requirements.txt)
- go to https://pre-commit.ci/ to enable automatic code formatting for your repo
- install pre-commit to also do this on your computer
- `pip install pre-commit`
- `pre-commit install`
97 changes: 97 additions & 0 deletions jupyter-slides-template.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "1e4bbd6c",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# jupyter-slides-template\n",
"\n",
"- Automatically generated from this [jupyter notebook](https://github.com/ssciwr/jupyter-slides-template/blob/master/jupyter-slides-template.ipynb)\n",
"- Press `Space` or `Right`to move to the next page\n",
"- Press `Escape` to zoom out\n",
"- Make your own at [github.com/ssciwr/jupyter-slides-template](https://github.com/ssciwr/jupyter-slides-template)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "189a6a56",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": [
"import sme\n",
"\n",
"model = sme.open_example_model()\n",
"print(model)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1ae11bfc",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"plt.title(model.name)\n",
"plt.imshow(model.compartment_image)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d9d162e3",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": [
"import sme_contrib.plot as smeplot\n",
"from IPython.display import HTML\n",
"\n",
"results = model.simulate(100, 10)\n",
"anim = smeplot.concentration_heatmap_animation(results, [\"B_cell\"])\n",
"HTML(anim.to_html5_video())"
]
}
],
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jupyter
sme
sme_contrib
matplotlib

0 comments on commit 8af632b

Please sign in to comment.