Skip to content

Commit

Permalink
docs: remove ipynb files from version control (#128)
Browse files Browse the repository at this point in the history
* only version jupytext-managed scripts, not notebooks
* add jupytext section to developer documentation
* use flopy CLI to regenerate classes in CI
  • Loading branch information
wpbonelli committed Dec 22, 2023
1 parent 50bddbc commit 4a69e69
Show file tree
Hide file tree
Showing 63 changed files with 20 additions and 63,324 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ex-rtd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ jobs:
working-directory: ${{env.etc-directory}}

- name: Update flopy MODFLOW 6 classes
run: |
import flopy
flopy.mf6.utils.generate_classes(branch="develop", backup=False)
shell: python
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Install MODFLOW executables release
uses: modflowpy/install-modflow-action@v1
Expand Down
28 changes: 7 additions & 21 deletions .github/workflows/ex-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,16 @@ jobs:
with:
python-version: 3.8

- name: Print python version
run: |
python --version
- name: Install Python packages
run: |
python --version
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.pip.txt
pip install -r requirements.usgs.txt
working-directory: ${{env.etc-directory}}

- name: Update flopy MODFLOW 6 classes
run: |
import flopy
flopy.mf6.utils.generate_classes(branch="develop", backup=False)
shell: python
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Install MODFLOW executables release
uses: modflowpy/install-modflow-action@v1
Expand All @@ -63,8 +57,7 @@ jobs:
repo: modflow6-nightly-build

- name: Run scripts without model runs
run: |
pytest -v -n=auto --durations=0 ci_build_files.py
run: pytest -v -n=auto --durations=0 ci_build_files.py
working-directory: ${{env.etc-directory}}

- name: zip input files
Expand All @@ -77,8 +70,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: zip_files
path: |
./modflow6-examples.zip
path: ./modflow6-examples.zip

build:
name: current-build
Expand Down Expand Up @@ -126,10 +118,7 @@ jobs:
working-directory: ${{env.etc-directory}}

- name: Update flopy MODFLOW 6 classes
run: |
import flopy
flopy.mf6.utils.generate_classes(branch="develop", backup=False)
shell: python
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Install MODFLOW executables release
uses: modflowpy/install-modflow-action@v1
Expand All @@ -140,8 +129,7 @@ jobs:
repo: modflow6-nightly-build

- name: Run scripts
run: |
pytest -v -n=auto --durations=0 --run=True ci_build_files.py
run: pytest -v -n=auto --durations=0 --run=True ci_build_files.py
working-directory: ${{env.etc-directory}}

- name: Run processing script
Expand Down Expand Up @@ -237,9 +225,7 @@ jobs:
path: ./current/

- name: List files in the artifact directory
run: |
pwd
ls -R ./current/
run: ls -R ./current/

- name: create bodyFile
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,6 @@ temp
.doc/_images/
.notebooks/
.nb/

# only version control jupytext-managed python scripts/*.py
notebooks/
9 changes: 9 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This document describes how to set up an environment to use or develop the MODFL
- [Running the examples](#running-the-examples)
- [Using `jupyter`](#using-jupyter)
- [Using `pytest`](#using-pytest)
- [Using `jupytext`](#using-jupytext)
- [Contributing examples](#contributing-examples)
- [Releasing the examples](#releasing-the-examples)
- [Generate notebooks and tables](#generate-notebooks-and-tables)
Expand Down Expand Up @@ -83,6 +84,14 @@ To run models, use `--run True`.

To run in serial instead of parallel, omit `-n auto`.

### Using `jupytext`

The example scripts can be converted to notebooks with `jupytext`. For instance, from the project root, to generate and execute a notebook in `notebooks/`:

```shell
jupytext --from py --to ipynb scripts/ex-gwf-twri.py -o notebooks/ex-gwf-twri.ipynb --execute
```

## Contributing examples

Adding a new example requires adding a new example script in the `scripts/` folder and adding a new LaTeX problem description in the `doc/sections/` folder. Then open a pull request from your fork of the repository.
Expand Down
Loading

0 comments on commit 4a69e69

Please sign in to comment.