Skip to content

Commit

Permalink
Run quick start in docs (#1811)
Browse files Browse the repository at this point in the history
Fixes #1807.

Rather than having docs with code that doesn't run and output in static
images, this intends to run the notebook as part of the docs generation
just like example.ipynb.

I am also making more edits which I'll describe later.

---------

Co-authored-by: Bart de Koning <[email protected]>
  • Loading branch information
visr and SouthEndMusic authored Sep 19, 2024
1 parent a7b417a commit cae6838
Show file tree
Hide file tree
Showing 11 changed files with 1,340 additions and 789 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ repos:
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
},
"notebook.formatOnSave.enabled": false,
"notebook.codeActionsOnSave": {
"source.fixAll.ruff": true,
"source.organizeImports.ruff": true
// https://github.com/astral-sh/ruff-vscode/issues/593
"source.fixAll.ruff": "never",
"source.organizeImports.ruff": "never"
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/_site/
/site_libs/
/reference/python/
/tutorial/crystal-basin/
guide/data/
*.html
objects.json
11 changes: 9 additions & 2 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ website:
left:
- text: "Overview"
file: index.qmd
- text: "Tutorials"
file: tutorial/natural-flow.ipynb
- text: "How-to guides"
file: guide/quickstart.qmd
file: guide/examples.ipynb
- text: "Concepts"
file: concept/concept.qmd
- text: "Reference"
Expand All @@ -31,9 +33,14 @@ website:
- changelog.qmd
- known_issues.qmd

- title: "Tutorials"
contents:
- tutorial/natural-flow.ipynb
- tutorial/irrigation-demand.ipynb
- tutorial/reservoir.ipynb

- title: "How-to guides"
contents:
- guide/quickstart.qmd
- guide/examples.ipynb
- guide/qgis.qmd
- guide/coupling.qmd
Expand Down
13 changes: 0 additions & 13 deletions docs/guide/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,6 @@
"ribasim basic/ribasim.toml\n",
"```\n",
"\n",
"From Python you can run it with:\n",
"\n",
"```python\n",
"import subprocess\n",
"result = subprocess.run([cli_path, toml_path], capture_output=True, encoding=\"utf-8\")\n",
"print(result.stderr)\n",
"result.check_returncode()\n",
"```\n",
"\n",
"Where `cli_path` is a string with either the full path to the Ribasim executable, like `r\"c:\\ribasim_windows\\ribasim\"`, or just `\"ribasim\"` in case you added the `ribasim_windows` folder to your PATH.\n",
"\n",
"The `print(result.stderr)` ensures you see the same logging and error messages that you would see in the terminal. And `result.check_returncode()` will throw an error when the simulation was not successful.\n",
"\n",
"After running the model, read back the results:"
]
},
Expand Down
Loading

0 comments on commit cae6838

Please sign in to comment.