Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Sep 18, 2023
1 parent 60b2697 commit 1e21905
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 192 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1563874e
3d3a2e08
166 changes: 83 additions & 83 deletions build/index.html

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions contribute/addnode.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ <h1 data-number="4"><span class="header-section-number">4</span> Validation</h1>
</section>
<section id="tests" class="level1" data-number="5">
<h1 data-number="5"><span class="header-section-number">5</span> Tests</h1>
<p>Models for the julia tests are generated by running <code>python/ribasim/tests/conftest.py</code>, which uses model definitions from the <code>ribasim_testmodels</code> package, see <a href="../contribute/python.html#installing-python-packages">here</a>. These models should also be updated to contain the new node type. Note that certain tests must be updated accordingly when the models used for certain tests are updated, e.g.&nbsp;the final state of the models in <code>core/test/basin.jl</code>. The following function is used to format the array of this final state.</p>
<p>Models for the julia tests are generated by running <code>pixi run generate-testmodels</code>, which uses model definitions from the <code>ribasim_testmodels</code> package, see <a href="../contribute/python.html#installing-python-packages">here</a>. These models should also be updated to contain the new node type. Note that certain tests must be updated accordingly when the models used for certain tests are updated, e.g.&nbsp;the final state of the models in <code>core/test/basin.jl</code>. The following function is used to format the array of this final state.</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">reprf</span>(x) <span class="op">=</span> <span class="fu">repr</span>(<span class="fu">convert</span>(<span class="dt">Vector</span>{<span class="dt">Float32</span>}, x))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>See <a href="../contribute/python.html#sec-codecov">here</a> for monitoring of Python test coverage.</p>
<p>If the new node type introduces new (somewhat) complex behaviour, a good test is to construct a minimal model containing the new node type in <code>python/ribasim_testmodels/ribasim_testmodels/equations.py</code> and compare the simulation result to the analytical solution (if possible) in <code>core/test/equations.jl</code>.</p>
Expand Down Expand Up @@ -456,8 +456,7 @@ <h1 data-number="7"><span class="header-section-number">7</span> Finishing up</h
</div>
</div>
<p>To generate the Python module <code>models.py</code> and <code>config.py</code> from the JSON Schemas, run:</p>
<pre><code>datamodel-codegen --use-title-as-name --use-double-quotes --disable-timestamp --use-default --strict-nullable --input docs/schema/root.schema.json --output python/ribasim/ribasim/models.py
datamodel-codegen --use-title-as-name --use-double-quotes --disable-timestamp --use-default --strict-nullable --input docs/schema/Config.schema.json --output python/ribasim/ribasim/config.py</code></pre>
<pre><code>pixi run codegen</code></pre>
<p>Since adding a node type touches both the Python and Julia code, it is a good idea to run both the <a href="../contribute/python.html#test">Python test suite</a> and <a href="../contribute/core.html#test">Julia test suite</a> locally before creating a pull request.</p>


Expand Down
97 changes: 47 additions & 50 deletions contribute/python.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,7 @@ <h2 id="toc-title">On this page</h2>
<li><a href="#sec-test" id="toc-sec-test" class="nav-link" data-scroll-target="#sec-test"><span class="header-section-number">1.2</span> Running the tests</a></li>
<li><a href="#updating-example-notebooks" id="toc-updating-example-notebooks" class="nav-link" data-scroll-target="#updating-example-notebooks"><span class="header-section-number">1.3</span> Updating example notebooks</a></li>
<li><a href="#prepare-model-input" id="toc-prepare-model-input" class="nav-link" data-scroll-target="#prepare-model-input"><span class="header-section-number">1.4</span> Prepare model input</a></li>
<li><a href="#sec-vscode" id="toc-sec-vscode" class="nav-link" data-scroll-target="#sec-vscode"><span class="header-section-number">1.5</span> Setup Visual Studio Code (optional)</a></li>
<li><a href="#how-to-publish-to-pypi" id="toc-how-to-publish-to-pypi" class="nav-link" data-scroll-target="#how-to-publish-to-pypi"><span class="header-section-number">1.6</span> How to publish to PyPI</a></li>
<li><a href="#linting" id="toc-linting" class="nav-link" data-scroll-target="#linting"><span class="header-section-number">1.7</span> Linting</a></li>
</ul></li>
<li><a href="#sec-codecov" id="toc-sec-codecov" class="nav-link" data-scroll-target="#sec-codecov"><span class="header-section-number">2</span> Code maintenance</a></li>
</ul>
</nav>
</div>
Expand Down Expand Up @@ -258,55 +254,56 @@ <h2 data-number="1.3" class="anchored" data-anchor-id="updating-example-notebook
</section>
<section id="prepare-model-input" class="level2" data-number="1.4">
<h2 data-number="1.4" class="anchored" data-anchor-id="prepare-model-input"><span class="header-section-number">1.4</span> Prepare model input</h2>
<p>Before running the Julia tests or building binaries, example model input needs to created. This is done by running the following Python script:</p>
<pre><code>python python/ribasim/tests/conftest.py</code></pre>
<p>This places example model input files under <code>./data/</code>. If the example models change, re-run this script.</p>
</section>
<section id="sec-vscode" class="level2" data-number="1.5">
<h2 data-number="1.5" class="anchored" data-anchor-id="sec-vscode"><span class="header-section-number">1.5</span> Setup Visual Studio Code (optional)</h2>
<ol type="1">
<li><p>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python">Python</a>, <a href="https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff">ruff</a> and <a href="https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring">autoDocstring</a> extensions.</p></li>
<li><p>Copy <code>.vscode/settings_template.json</code> into <code>.vscode/settings.json</code></p></li>
</ol>
</section>
<section id="how-to-publish-to-pypi" class="level2" data-number="1.6">
<h2 data-number="1.6" class="anchored" data-anchor-id="how-to-publish-to-pypi"><span class="header-section-number">1.6</span> How to publish to PyPI</h2>
<ol type="1">
<li><p>Update <code>__version__</code> in <code>ribasim/__init__.py</code></p></li>
<li><p>Open a terminal and run <code>cd python/ribasim</code></p></li>
<li><p>Activate the ribasim environment with <code>conda activate ribasim</code></p></li>
<li><p>If present remove dist folder</p></li>
<li><p>Re-create the wheels:</p></li>
</ol>
<pre><code>python -m build</code></pre>
<ol start="6" type="1">
<li>Check the package files:</li>
</ol>
<pre><code>twine check dist/*</code></pre>
<ol start="7" type="1">
<li><p>Make a new commit with the updated version number, and push to remote</p></li>
<li><p>Re-upload the new files:</p></li>
</ol>
<pre><code>twine upload dist/*</code></pre>
</section>
<section id="linting" class="level2" data-number="1.7">
<h2 data-number="1.7" class="anchored" data-anchor-id="linting"><span class="header-section-number">1.7</span> Linting</h2>
<p>To run our linting suite locally, execute:</p>
<pre><code>pixi run lint</code></pre>
</section>
</section>
<section id="sec-codecov" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> Code maintenance</h1>
<p>For new features new tests have to be added. To monitor how much of the code is covered by the tests we use <a href="https://about.codecov.io/">Codecov</a>. For a simple overview of the local code coverage run</p>
<pre><code>pixi shell
pytest --cov=ribasim tests/</code></pre>
<p>from <code>python/ribasim</code>. For an extensive overview in <code>html</code> format use</p>
<pre><code>pixi shell
pytest --cov=ribasim --cov-report=html tests/</code></pre>
<p>which creates a folder <code>htmlcov</code> in the working directory. To see te contents open <code>htmlcov/index.html</code> in a browser.</p>
<p>Before running the Julia tests or building binaries, example model input needs to created. This is done by running the following:</p>
<pre><code>pixi run generate-testmodels```

This places example model input files under `./generated_testmodels/`.
If the example models change, re-run this script.

## Setup Visual Studio Code (optional) {#sec-vscode}

1. Install the [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python), [ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) and [autoDocstring](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring) extensions.

2. Copy `.vscode/settings_template.json` into `.vscode/settings.json`

## How to publish to PyPI

1) Update `__version__` in `ribasim/__init__.py`

2) Open a terminal and run `cd python/ribasim`

3) Activate the ribasim environment with `conda activate ribasim`

4) If present remove dist folder

5) Re-create the wheels:</code></pre>
<p>python -m build</p>
<pre><code>
6) Check the package files:</code></pre>
<p>twine check dist/*</p>
<pre><code>
7) Make a new commit with the updated version number, and push to remote

8) Re-upload the new files:</code></pre>
<p>twine upload dist/*</p>
<pre><code>
## Linting

To run our linting suite locally, execute:
</code></pre>
<p>pixi run lint</p>
<pre><code>
# Code maintenance {#sec-codecov}

For new features new tests have to be added. To monitor how much of the code is covered by the tests we use [Codecov](https://about.codecov.io/).
For a simple overview of the local code coverage run</code></pre>
<p>pixi shell pytest –cov=ribasim tests/</p>
<pre><code>from `python/ribasim`. For an extensive overview in `html` format use</code></pre>
<p>pixi shell pytest –cov=ribasim –cov-report=html tests/ ``<code>which creates a folder</code>htmlcov<code>in the working directory. To see te contents open</code>htmlcov/index.html` in a browser.</p>
<p>The code coverage of pushed branches can be seen <a href="https://app.codecov.io/gh/Deltares/Ribasim">here</a>.</p>


</section>
</section>

</main> <!-- /main -->
Expand Down
2 changes: 1 addition & 1 deletion python/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ <h1 data-number="2"><span class="header-section-number">2</span> Update the basi
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true" tabindex="-1"></a>ax <span class="op">=</span> df_flow.pivot_table(index<span class="op">=</span><span class="st">"time"</span>, columns<span class="op">=</span><span class="st">"edge"</span>, values<span class="op">=</span><span class="st">"flow_m3d"</span>).plot()</span>
<span id="cb26-5"><a href="#cb26-5" aria-hidden="true" tabindex="-1"></a>ax.legend(bbox_to_anchor<span class="op">=</span>(<span class="fl">1.3</span>, <span class="dv">1</span>), title<span class="op">=</span><span class="st">"Edge"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="26">
<pre><code>&lt;matplotlib.legend.Legend at 0x7f75574d6350&gt;</code></pre>
<pre><code>&lt;matplotlib.legend.Legend at 0x7ff8040b4f50&gt;</code></pre>
</div>
<div class="cell-output cell-output-display">
<p><img src="examples_files/figure-html/cell-27-output-2.png" width="727" height="412"></p>
Expand Down
4 changes: 2 additions & 2 deletions schema/DiscreteControlCondition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"format": "default",
"anyOf": [
{
"type": "number"
"type": "null"
},
{
"type": "null"
"type": "number"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions schema/FlowBoundaryStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions schema/LevelBoundaryStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions schema/LinearResistanceStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions schema/ManningResistanceStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand Down
16 changes: 8 additions & 8 deletions schema/OutletStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"format": "default",
"anyOf": [
{
"type": "number"
"type": "null"
},
{
"type": "null"
"type": "number"
}
]
},
Expand All @@ -22,21 +22,21 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
"min_crest_level": {
"format": "default",
"anyOf": [
{
"type": "number"
"type": "null"
},
{
"type": "null"
"type": "number"
}
]
},
Expand All @@ -63,10 +63,10 @@
"format": "default",
"anyOf": [
{
"type": "number"
"type": "null"
},
{
"type": "null"
"type": "number"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions schema/PIDControlStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand Down
12 changes: 6 additions & 6 deletions schema/PumpStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"format": "default",
"anyOf": [
{
"type": "number"
"type": "null"
},
{
"type": "null"
"type": "number"
}
]
},
Expand All @@ -22,10 +22,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand All @@ -52,10 +52,10 @@
"format": "default",
"anyOf": [
{
"type": "number"
"type": "null"
},
{
"type": "null"
"type": "number"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions schema/TabulatedRatingCurveStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions schema/UserStatic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"format": "default",
"anyOf": [
{
"type": "boolean"
"type": "null"
},
{
"type": "null"
"type": "boolean"
}
]
},
Expand Down
Loading

0 comments on commit 1e21905

Please sign in to comment.