Skip to content

Commit

Permalink
Merge branch 'main' into numerics
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Sep 27, 2023
2 parents a3d5bf5 + 43de951 commit 474ba2c
Show file tree
Hide file tree
Showing 143 changed files with 29,427 additions and 2,137 deletions.
6 changes: 1 addition & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
* text=auto

**/Project.toml eol=lf
**/Manifest.toml eol=lf
**/*.json eol=lf
* text=auto eol=lf
35 changes: 0 additions & 35 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,36 +1 @@
Fixes #

# Description




---
text below is for instruction and can be removed

# New node types
Typically new node types require an update of:

- `core/src/create.jl`
- `core/src/validation.jl`
- `core/src/solve.jl`

Updating other julia files may be required.


## ribasim_python
- `new_node_type.py` with associated implementation in `python/ribasim/ribasim`.
- add/update nodetype to `python/ribasim/ribasim/model.py`
- add/update nodetype to `python/ribasim/tests/conftest.py`
- add/update nodetype to `python/ribasim_api/tests/conftest.py`

## documentation

- update `docs/core/equations.qmd`
- update `docs/core/usage.qmd`
- update `docs/python/examples.ipynb` # or start a new example model
- update `docs/schema*.json` by running `julia --project=docs docs/gen_schema.jl` and `datamodel-codegen --use-title-as-name --input docs/schema/root.schema.json --output python/ribasim/ribasim/models.py`
- update the instructions in `docs/contribute/*.qmd` if something changes there, e.g. something changes in how a new node type must be defined.

## QGIS
- update `qgis/core/nodes.py`
22 changes: 8 additions & 14 deletions .github/workflows/core_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
test:
name: Julia ${{ matrix.julia_version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
Expand All @@ -28,19 +25,16 @@ jobs:
arch:
- x64
steps:
- uses: actions/checkout@v3
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
cache-downloads: true
cache-environment: true
environment-file: ./environment.yml
- name: Install ribasim
run: pip install --editable python/ribasim
- name: Install ribasim_testmodels
run: pip install --editable python/ribasim_testmodels
pixi-version: "v0.3.0"
cache: true
- name: Prepare pixi
run: pixi run post-install-without-pre-commit
- name: Prepare model input
run: python python/ribasim/tests/conftest.py
run: |
pixi run generate-testmodels
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia_version }}
Expand Down
39 changes: 11 additions & 28 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
julia_version:
- "1.9"
arch:
- x64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: julia-actions/setup-julia@v1
with:
Expand All @@ -40,38 +37,24 @@ jobs:
cache-compiled: "true"
cache-registries: "true"

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: prefix-dev/[email protected]
with:
cache-downloads: true
cache-environment: true
environment-file: ./environment.yml

- name: Install ribasim-python
run: pip install --editable python/ribasim

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
pixi-version: "v0.3.0"
cache: true
- name: Prepare pixi
run: pixi run post-install-without-pre-commit

- name: Check Quarto installation and all engines
run: quarto check all

- name: Generate API pages
working-directory: docs
# objects.json: https://github.com/machow/quartodoc/issues/63
run: |
quartodoc build
rm objects.json
run: pixi run quarto-check

- name: Generate Julia docs
working-directory: docs
run: |
julia --project -e "using Pkg; Pkg.instantiate()"
julia --project make.jl
run: pixi run build-julia-docs

- name: Render Quarto Project
run: "quarto render docs --to html --execute"
run: pixi run quarto-render

- name: Set up Quarto for publish
uses: quarto-dev/quarto-actions/setup@v2
- name: Publish Quarto Project
if: github.ref == 'refs/heads/main'
uses: quarto-dev/quarto-actions/publish@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit_auto_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand Down
26 changes: 9 additions & 17 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,20 @@ jobs:
name: Mypy
runs-on: ubuntu-latest
continue-on-error: true
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
cache-downloads: true
cache-environment: true
environment-file: ./environment.yml
- name: Install python packages
run: |
pip install python/ribasim
pip install python/ribasim_testmodels
pip install python/ribasim_api
pixi-version: "latest"
cache: true
- name: Prepare pixi
run: pixi run post-install-without-pre-commit
- name: Run mypy on python/ribasim
run: |
mypy --ignore-missing-imports python/ribasim/ribasim
pixi run mypy-ribasim-python
- name: Run mypy on python/ribasim_testmodels
run: |
mypy --ignore-missing-imports python/ribasim_testmodels/ribasim_testmodels
pixi run mypy-ribasim-testmodels
- name: Run mypy on python/ribasim_api
run: |
mypy --ignore-missing-imports python/ribasim_api/ribasim_api
pixi run mypy-ribasim-api
25 changes: 7 additions & 18 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
test:
name: Python ${{ matrix.python_version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
Expand All @@ -30,25 +27,17 @@ jobs:
arch:
- x86
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: prefix-dev/[email protected]
with:
cache-downloads: true
cache-environment: true
environment-file: ./environment.yml
create-args: >-
python=${{ matrix.python_version }}
- name: Install ribasim
run: pip install --editable python/ribasim

- name: Install ribasim_testmodels
run: pip install --editable python/ribasim_testmodels
pixi-version: "v0.3.0"
cache: true
- name: Prepare pixi
run: pixi run post-install-without-pre-commit

- name: Run tests
run: pytest --cov=ribasim --cov-report=xml python/ribasim/tests
run: pixi run test-ribasim-python-cov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
2 changes: 1 addition & 1 deletion .github/workflows/qgis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Launching docker compose
run: ./start.sh
- name: Running tests
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docs/site/
# environment.
/core/Manifest.toml

/data/
/generated_testmodels
build/create_binaries/ribasim_cli/
build/create_binaries/libribasim/

Expand Down Expand Up @@ -155,3 +155,5 @@ dmypy.json
.vscode/settings.json

/.luarc.json
build/ribasim_cli/tests/temp/
report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<option name="publishArtifactCondition" value="SUCCESSFUL" />
</options>
<parameters>
<param name="conda_env_path" value="%system.teamcity.build.checkoutDir%/env" />
<param name="conda_env_path" value="%system.teamcity.build.checkoutDir%/env_build_ribasim_cli" />
<param name="julia" value="%env.JULIA_1_9%" />
</parameters>
<build-runners>
Expand All @@ -33,7 +33,7 @@ call pip install --editable "python/ribasim_testmodels"]]></param>
<runner id="RUNNER_1992" name="Prepare model input" type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[call conda activate "%conda_env_path%"
call python python/ribasim/tests/conftest.py]]></param>
call python utils/generate-testmodels.py]]></param>
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
Expand Down Expand Up @@ -113,4 +113,3 @@ call python python/ribasim/tests/conftest.py]]></param>
<cleanup />
</settings>
</build-type>

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<setting-ref ref="RQ_271" />
</disabled-settings>
<parameters>
<param name="conda_env_path" value="%system.teamcity.build.checkoutDir%/env" />
<param name="conda_env_path" value="%system.teamcity.build.checkoutDir%/env_build_libribasim" />
<param name="julia" value="%env.JULIA_1_9%" />
</parameters>
<build-runners>
Expand All @@ -36,7 +36,7 @@ call pip install --editable "python/ribasim_testmodels"]]></param>
<runner id="RUNNER_1967" name="Prepare model input" type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[call conda activate "%conda_env_path%"
call python python/ribasim/tests/conftest.py]]></param>
call python utils/generate-testmodels.py]]></param>
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
Expand Down Expand Up @@ -103,4 +103,3 @@ call python python/ribasim/tests/conftest.py]]></param>
<cleanup />
</settings>
</build-type>

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set -euxo pipefail
. /usr/share/Modules/init/bash
ls /opt/apps/modules/anaconda3
module load anaconda3/miniconda
rm --force ribasim-*.whl
pip wheel python/ribasim --no-deps]]></param>
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<build-runners>
<runner id="RUNNER_2193" name="" type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[cp -r qgis ribasim_qgis
zip ribasim_qgis.zip -r ribasim_qgis]]></param>
<param name="script.content"><![CDATA[rsync --verbose --recursive --delete qgis/ ribasim_qgis
rm --force ribasim_qgis.zip
zip -r ribasim_qgis.zip ribasim_qgis]]></param>
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,32 @@
<options>
<option name="artifactRules" value="python\ribasim_api\tests\temp =&gt; test_output.zip" />
</options>
<disabled-settings>
<setting-ref ref="RQ_436" />
</disabled-settings>
<parameters>
<param name="conda_env_path" value="%system.teamcity.build.checkoutDir%/libribasim_test_env" />
</parameters>
<build-runners>
<runner id="RUNNER_1501" name="Set up virtual environment" type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[if exist "%conda_env_path%" rd /q /s "%conda_env_path%"
call conda create --prefix "%conda_env_path%" python=3.10]]></param>
<param name="teamcity.build.workingDir" value="imod_coupler" />
call conda env create --file environment.yml -p "%conda_env_path%"]]></param>
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
</runner>
<runner id="RUNNER_1502" name="Install Python packages" type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[call conda activate "%conda_env_path%"
call pip install --editable "python/ribasim"
call pip install --editable "python/ribasim_testmodels"
call pip install --editable "python/ribasim_api[tests]"]]></param>
pip install "python/ribasim"
pip install "python/ribasim_testmodels"
pip install "python/ribasim_api"]]></param>
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
</runner>
<runner id="RUNNER_1503" name="Run tests" type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[call conda activate "%conda_env_path%"
call pytest tests --basetemp=tests/temp --junitxml="report.xml"]]></param>
pytest tests --basetemp=tests/temp --junitxml="report.xml"]]></param>
<param name="teamcity.build.workingDir" value="python/ribasim_api" />
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
Expand All @@ -46,8 +42,7 @@ call pytest tests --basetemp=tests/temp --junitxml="report.xml"]]></param>
<vcs-entry-ref root-id="Ribasim_Ribasim_Ribasim" />
</vcs-settings>
<requirements>
<equals id="RQ_436" name="teamcity.agent.jvm.os.name" value="Windows 10" />
<does-not-equal id="RQ_96" name="system.agent.name" value="c-teamcity0358" />
<equals id="RQ_315" name="env.OS" value="Windows_NT" />
</requirements>
<build-triggers>
<build-trigger id="TRIGGER_64" type="buildDependencyTrigger">
Expand Down Expand Up @@ -78,7 +73,7 @@ call pytest tests --basetemp=tests/temp --junitxml="report.xml"]]></param>
</build-extensions>
<artifact-dependencies>
<dependency id="ARTIFACT_DEPENDENCY_570" sourceBuildTypeId="Ribasim_RibasimJl_BuildLibribasimWindows" cleanDestination="true">
<revisionRule name="lastSuccessful" revision="latest.lastSuccessful" />
<revisionRule name="lastSuccessful" revision="latest.lastSuccessful" branch="+:&lt;default&gt;&#xD;&#xA;+:ref" />
<artifact sourcePath="libribasim.zip!** =&gt; build/create_binaries/libribasim&#xD;&#xA;" />
</dependency>
</artifact-dependencies>
Expand Down
Loading

0 comments on commit 474ba2c

Please sign in to comment.