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

Jupyter notebooks #294

Open
wants to merge 78 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
a16f0f6
Adding the first introduction notebook
ta440 Jul 19, 2022
24255cb
Jupyter notebook 2
ta440 Jul 19, 2022
3b53efa
Books 1 and 2 and sk_non-linear results
ta440 Jul 21, 2022
dc95a0b
Notebook 3
ta440 Jul 21, 2022
ecb4967
Added book 4
ta440 Jul 22, 2022
0f39691
updated otebooks 1-3
ta440 Aug 23, 2022
da57029
Added Paraview pictures
ta440 Aug 23, 2022
a08efda
Remove old notebooks
ta440 Aug 23, 2022
f0cfd3a
Delete unwanted results
ta440 Aug 23, 2022
dcc66f3
Updated book 4
ta440 Aug 23, 2022
60f8942
Merge branch 'main' into tim_FML_notebooks
ta440 Aug 23, 2022
d7726d5
Notebook updates 23_8_22
ta440 Aug 23, 2022
c14f0f0
Remove extra output files
ta440 Aug 23, 2022
d1a01a7
Deleted extra results
ta440 Aug 23, 2022
31d249b
Added a notebook test script
ta440 Aug 23, 2022
726f372
update github action to test the jupyter notebooks
ta440 Aug 24, 2022
269f540
Fixed failing notebook tests, updated CI, made tests DRYer
JDBetteridge Aug 26, 2022
4639883
Merge pull request #297 from firedrakeproject/JDBetteridge/various_ci…
ta440 Aug 29, 2022
a626263
Adding the notebooks to the lint checker
ta440 Aug 30, 2022
cc62fbf
Made changes to notebook 1 and the names
ta440 Aug 30, 2022
700f7ca
updating from main
ta440 Aug 30, 2022
e87a8af
Fix output filename error in Book1
ta440 Sep 1, 2022
b0ff73f
Update Makefile
ta440 Sep 2, 2022
d150855
Update setup.cfg
ta440 Sep 2, 2022
be90e9b
Lint changes in notebooks
ta440 Sep 5, 2022
6c0b561
Remove lint notebooks for now
ta440 Sep 5, 2022
794591b
remove notebook flake stuff for now
ta440 Sep 5, 2022
615b3ad
Merge branch 'main' of https://github.com/firedrakeproject/gusto into…
ta440 Sep 5, 2022
561d368
Merge branch 'tim_FML_notebooks' of https://github.com/firedrakeproje…
ta440 Sep 6, 2022
694b8fa
Merge branch 'main' of https://github.com/firedrakeproject/gusto into…
ta440 Sep 29, 2022
416dfac
Tom comment changes
ta440 Sep 29, 2022
9e1dc6e
Book 4 name change
ta440 Oct 7, 2022
4ae08f9
Merge branch 'main' of https://github.com/firedrakeproject/gusto into…
jshipton Nov 11, 2022
0c94cb4
can import pi from Firedrake
jshipton Nov 11, 2022
9a36c95
some clarifications to the first notebook
jshipton Nov 12, 2022
45f6fe5
Merge branch 'main' of https://github.com/firedrakeproject/gusto into…
jshipton Nov 12, 2022
909ec2f
fix interface to SemiImplicitQuasiNewton
jshipton Nov 12, 2022
e059f82
some changes to the second notebook
jshipton Nov 12, 2022
dbb266f
some changes to the second notebook
jshipton Nov 12, 2022
de47bd5
some changes to notebook 3
jshipton Nov 12, 2022
c2839e9
fix book 3 since changes to recovery options
jshipton Nov 12, 2022
f1e33c9
remove old recovery code from notebook 3
jshipton Nov 12, 2022
5ebb86c
changes to notebook 4
jshipton Nov 12, 2022
3624a06
demonstrate how to use RK4 for shallow water
jshipton Nov 16, 2022
7c19db4
demonstrate how to use RK4 for shallow water
jshipton Nov 16, 2022
73053f1
more changes
jshipton Dec 2, 2022
c39b0ba
Merge branch 'main' of https://github.com/firedrakeproject/gusto into…
jshipton Jan 23, 2023
eb49c9f
purge state from first notebook
jshipton Jan 23, 2023
b68b7b8
missed parameters
jshipton Jan 23, 2023
571023b
urgh I hate version control with notebooks
jshipton Jan 23, 2023
25a0412
add reference profiles
jshipton Jan 24, 2023
252751d
Merge branch 'main' into tim_FML_notebooks and fix conflicts
JDBetteridge Dec 16, 2024
60c2c1c
Add reset recipe
JDBetteridge Dec 17, 2024
1b3411c
Silence commands
JDBetteridge Dec 17, 2024
0987a78
Enable notebook linting
JDBetteridge Dec 17, 2024
e8bfd9c
begin upadting notebooks...
jshipton Dec 17, 2024
1bb41df
Merge branch 'tim_FML_notebooks' of https://github.com/firedrakeproje…
jshipton Dec 17, 2024
462a83f
Merge branch 'main' into tim_FML_notebooks
jshipton Dec 17, 2024
740362d
Merge branch 'main' of https://github.com/firedrakeproject/gusto into…
jshipton Dec 18, 2024
5ea3780
working jupyter notebooks for shallow water and vertical slice gravit…
jshipton Dec 18, 2024
b2ca915
these two notebooks should now pass lint
jshipton Dec 18, 2024
3ec956d
third noteboko
jshipton Dec 18, 2024
4505adb
updates to notebooks
jshipton Dec 18, 2024
f3e5e4a
Enable nbval-lax for pytesting notebooks
JDBetteridge Dec 18, 2024
5f92dae
Re-run notebooks
JDBetteridge Dec 18, 2024
9247bc0
loadscope is important
JDBetteridge Dec 18, 2024
768f959
Lint
JDBetteridge Dec 18, 2024
e1d5271
Cancels jobs running if new commits are pushed
JDBetteridge Dec 18, 2024
2c50f78
more notebook updates
jshipton Dec 18, 2024
9e46f8f
I think the first two notebooks are ok now
jshipton Dec 18, 2024
e821829
Add additional packages to testing
JDBetteridge Dec 19, 2024
f90be28
tiny changes to first 2 notebooks and bigger changes to the third
jshipton Dec 19, 2024
34bc22c
Merge branch 'main' into tim_FML_notebooks
tommbendall Dec 19, 2024
38941fa
more improvements to notebooks
jshipton Dec 19, 2024
07d9f60
Merge branch 'tim_FML_notebooks' of https://github.com/firedrakeproje…
jshipton Dec 19, 2024
eb32240
Merge branch 'main' into tim_FML_notebooks
jshipton Dec 19, 2024
64309db
We don't really care about the logs generated by running the notebooks
JDBetteridge Dec 20, 2024
ca1111e
Increase timeout for cells
JDBetteridge Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
python -m pip install -r requirements.txt
python -m pip install -e .
python -m pip install \
pytest-timeout pytest-xdist
pytest-timeout pytest-xdist nbval ipympl
- name: Gusto tests
run: |
. /home/firedrake/firedrake/bin/activate
Expand All @@ -58,8 +58,20 @@ jobs:
if: always()
run: |
mkdir logs
cd /tmp/pytest-of-firedrake/pytest-0/
cd /tmp/pytest-of-firedrake/pytest-*/
find . -name "*.log" -exec cp --parents {} /__w/gusto/gusto/logs/ \;
- name: Gusto jupyter_notebooks
run: |
. /home/firedrake/firedrake/bin/activate
export GUSTO_PARALLEL_LOG=FILE
python -m pytest \
-n 4 --dist loadscope \
--timeout=1200 \
--timeout-method=thread \
-o faulthandler_timeout=1260 \
--nbval-lax \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--nbval-lax \
--nbval \

When you're happy with the state of the notebooks, you can drop the lax and the test will check that the output doesn't change. Use # NBVAL_IGNORE_OUTPUT for specific cells where this is undesirable, see these docs.

--nbval-cell-timeout=3000 \
-v jupyter_notebooks
- name: Upload artifact
if: always()
uses: actions/upload-pages-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: rbialon/flake8-annotations@v1
- name: Install linter
run: |
pip install flake8 pylint
pip install flake8 pylint nbqa
- name: Lint codebase
run: |
make lint GITHUB_ACTIONS_FORMATTING=1
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ docs/_build/
target/
/docs/source/teamgrid.rst
/docs/source/gusto.rst

# Gusto specific
jupyter_notebooks/results
jupyter_notebooks/.ipynb_checkpoints
33 changes: 26 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Adds file annotations to Github Actions (only useful on CI)
GITHUB_ACTIONS_FORMATTING=0
ifeq ($(GITHUB_ACTIONS_FORMATTING), 1)
FLAKE8_FORMAT=--format='::error file=%(path)s,line=%(row)d,col=%(col)d,title=%(code)s::%(path)s:%(row)d:%(col)d: %(code)s %(text)s'
FLAKE8_FORMAT=--format '::error file=%(path)s,line=%(row)d,col=%(col)d,title=%(code)s::%(path)s:%(row)d:%(col)d: %(code)s %(text)s'
else
FLAKE8_FORMAT=
endif
Expand All @@ -17,23 +17,42 @@ lint:
@python3 -m flake8 $(FLAKE8_FORMAT) integration-tests
@echo " Linting gusto plotting scripts"
@python3 -m flake8 $(FLAKE8_FORMAT) plotting
@echo " Linting gusto notebooks"
@python3 -m nbqa flake8 jupyter_notebooks/*.ipynb $(FLAKE8_FORMAT)

test:
@echo " Running all tests"
@python3 -m pytest unit-tests integration-tests examples $(PYTEST_ARGS)
test: unit_test integration_test example notebook_test

unit_test:
clean_cache:
@echo " Cleaning caches"
@firedrake-clean

unit_test: clean_cache
@echo " Running all unit-tests"
@python3 -m pytest unit-tests $(PYTEST_ARGS)

integration_test:
integration_test: clean_cache
@echo " Running all integration-tests"
@python3 -m pytest integration-tests $(PYTEST_ARGS)

example:
example: clean_cache
@echo " Running all examples"
@python3 -m pytest examples -v -m "not parallel" $(PYTEST_ARGS)

parallel_example:
@echo " Running all parallel examples"
@python3 -m pytest examples -v -m "parallel" $(PYTEST_ARGS)

notebook_test: clean_cache
@echo " Running all Jupyter notebooks"
@python3 -m pytest --nbval-lax -v jupyter_notebooks $(PYTEST_ARGS)

reset_notebooks:
@jupyter-nbconvert --clear-output ./jupyter_notebooks/*.ipynb
@rm -rf ./jupyter_notebooks/results
@env OMP_NUM_THREADS=1 jupyter-nbconvert \
--execute \
--ClearMetadataPreprocessor.enabled=True \
--allow-errors \
--to notebook \
--inplace \
./jupyter_notebooks/*.ipynb
Loading
Loading