Skip to content

Commit

Permalink
Merge pull request #45 from jorgensd/dokken/v0.8.0
Browse files Browse the repository at this point in the history
Update for version 8.
  • Loading branch information
jorgensd authored May 22, 2024
2 parents a9d4901 + 076b217 commit 791598c
Show file tree
Hide file tree
Showing 17 changed files with 222 additions and 2,046 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
build-docs:
uses: ./.github/workflows/test-build.yml
with:
tag: "v0.7.3"
tag: "stable"

deploy:
needs: [build-docs]
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Test tutorial against DOLFINx

on:

push:
branches: [main]

Expand All @@ -13,21 +12,21 @@ on:
inputs:
tag:
description: "Tag of DOLFINx docker image"
default: "v0.7.3"
default: "stable"
required: true
type: string
workflow_dispatch:
inputs:
tag:
description: "Tag of DOLFINx docker image"
default: "v0.7.3"
default: "stable"
required: true
type: string
schedule:
- cron: "* 9 * * 1"

env:
DEFAULT_TAG: v0.7.3
DEFAULT_TAG: stable

jobs:
get_image_tag:
Expand Down Expand Up @@ -55,12 +54,10 @@ jobs:
python3 -m pip install -e .[dev] -U
- name: flake8 checks
run:
flake8-nb *.ipynb
run: flake8-nb *.ipynb

- name: Test building the book
run:
jupyter-book build . --all
run: jupyter-book build . --all

- name: Upload the book
if: always()
Expand Down
324 changes: 14 additions & 310 deletions Abs(u).html

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM dolfinx/lab:v0.7.3
FROM dolfinx/lab:stable

# create user with a home directory
ARG NB_USER
Expand All @@ -9,6 +9,8 @@ ENV HOME /home/${NB_USER}
# Copy home directory for usage in binder
WORKDIR ${HOME}
COPY . ${HOME}
RUN python3 -m pip install -U .[dev]

USER root
RUN chown -R ${NB_UID} ${HOME}

Expand Down
61 changes: 35 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ All the resources from this tutorial can be found in [this Jupyter book](https:/
## Developer notes

### Rendering the HTML presentation files directly on Github

Use [githack](https://raw.githack.com/) and add the link to the relevant presentation.

Example:

- [Example page](https://raw.githack.com/jorgensd/fenics22-tutorial/main/presentation-example.html#/)
- [Time dependent problem](https://raw.githack.com/jorgensd/fenics22-tutorial/main/presentation-heat_eq.html#/)
- [Helmholtz](https://raw.githack.com/jorgensd/fenics22-tutorial/main/presentation-helmholtz.html#/)
Expand All @@ -21,41 +23,43 @@ Add a chapter to `_toc.yml`.

Inside the Jupyter notebook, go to `Property Inspector` (the two cogwheels in the top right corner of JupyterLab)
and add the following as notebook metadata:

```yml
{
"jupytext": {
"formats": "ipynb,py:light"
},
"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.10.4"
}
}
{
"jupytext": { "formats": "ipynb,py:light" },
"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.10.4",
},
}
```

This will choose the default kernel in the `dolfinx/lab` docker image, and automatically convert the notebooks to a `.py` file at saving.

If you want to use complex numbers, change:

```bash
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
```

to

```bash
"kernelspec": {
"display_name": "Python 3 (DOLFINx complex)",
Expand All @@ -64,11 +68,11 @@ to
},
```


### Create slides from your notebook

You can use `nbconvert` (`pip3 install nbconvert`) to convert the `.ipynb` to a presentation.
The command to run is:

```bash
jupyter nbconvert example.ipynb --to html --template reveal
```
Expand All @@ -83,20 +87,25 @@ If you want a sub-slide, i.e. navigating downwards with arrows when rendering th
If a cell should be ignored in presentation mode, set it to `Notes`.

### Hiding cells/output

See https://jupyterbook.org/en/stable/interactive/hiding.htm for more details. The setting is also in advanced tools on the RHS of the Jupyterlab interface

### Automatically generate slides
By adding the following file to the (`jupyter_server_config.py`) `.jupyter` folder on your system.

By adding the following file to the (`jupyter_server_config.py`) `.jupyter` folder on your system.
You might need to rename it to `jupyter_notebook_config.py`.
To check the config paths, call:

```bash
jupyter server --show-config
jupyter notebook --show-config
jupyer lab --show-config
```

If you run the code with `dolfinx/lab:v0.7.3` using for instance:
If you run the code with `dolfinx/lab:stable` using for instance:

```bash
docker run -ti -p 8888:8888 --rm -v $(pwd):/root/shared -w /root/shared dolfinx/lab:v0.7.3
docker run -ti -p 8888:8888 --rm -v $(pwd):/root/shared -w /root/shared dolfinx/lab:stable
```

no copying is required.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ sphinx:
config:
html_extra_path:
["mesh.html", "wavenumber.html", "Abs(u).html", "beam.html", "w.html"]
html_last_updated_fmt: "%b %d, %Y"
suppress_warnings: ["mystnb.unknown_mime_type"]
Loading

0 comments on commit 791598c

Please sign in to comment.