Skip to content

Commit

Permalink
Merge branch 'main' into autodiff_wrt_time
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Oct 25, 2023
2 parents 87e11e7 + 43c1120 commit 8fe1871
Show file tree
Hide file tree
Showing 8 changed files with 2,669 additions and 2,643 deletions.
10 changes: 4 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ repos:
exclude: '.teamcity'
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
rev: v0.1.2
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- id: black-jupyter
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<build-type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uuid="27854ba1-bb78-4d7a-b9fd-fecfb86b0393" xsi:noNamespaceSchemaLocation="https://www.jetbrains.com/teamcity/schemas/2021.1/project-config.xsd">
<name>Test libribasim - Windows</name>
<name>Test ribasim_api - Windows</name>
<description />
<settings>
<options>
<option name="artifactRules" value="python\ribasim_api\tests\temp =&gt; test_output.zip" />
<option name="artifactRules" value="ribasim\python\ribasim_api\tests\temp =&gt; test_output.zip" />
</options>
<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">
<runner id="RUNNER_1501" name="Set up pixi" type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[if exist "%conda_env_path%" rd /q /s "%conda_env_path%"
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%"
pip install "python/ribasim"
pip install "python/ribasim_testmodels"
pip install "python/ribasim_api"]]></param>
<param name="script.content" value="pixi run install" />
<param name="teamcity.build.workingDir" value="ribasim" />
<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%"
pytest tests --basetemp=tests/temp --junitxml="report.xml"]]></param>
<param name="teamcity.build.workingDir" value="python/ribasim_api" />
<param name="script.content" value="pixi run test-ribasim-api" />
<param name="teamcity.build.workingDir" value="ribasim" />
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
</runner>
</build-runners>
<vcs-settings>
<vcs-entry-ref root-id="Ribasim_Ribasim_Ribasim" />
<vcs-entry-ref root-id="Ribasim_Ribasim_Ribasim">
<checkout-rule rule=". =&gt; ribasim" />
</vcs-entry-ref>
</vcs-settings>
<requirements>
<equals id="RQ_315" name="env.OS" value="Windows_NT" />
Expand All @@ -65,7 +56,7 @@ pytest tests --basetemp=tests/temp --junitxml="report.xml"]]></param>
</extension>
<extension id="BUILD_EXT_145" type="xml-report-plugin">
<parameters>
<param name="xmlReportParsing.reportDirs" value="python/ribasim_api/report.xml" />
<param name="xmlReportParsing.reportDirs" value="ribasim/python/ribasim_api/report.xml" />
<param name="xmlReportParsing.reportType" value="junit" />
<param name="xmlReportParsing.verboseOutput" value="true" />
</parameters>
Expand All @@ -74,7 +65,7 @@ pytest tests --basetemp=tests/temp --junitxml="report.xml"]]></param>
<artifact-dependencies>
<dependency id="ARTIFACT_DEPENDENCY_570" sourceBuildTypeId="Ribasim_RibasimJl_BuildLibribasimWindows" cleanDestination="true">
<revisionRule name="lastSuccessful" revision="latest.lastSuccessful" branch="+:&lt;default&gt;&#xD;&#xA;+:ref" />
<artifact sourcePath="libribasim.zip!** =&gt; build/create_binaries/libribasim&#xD;&#xA;" />
<artifact sourcePath="libribasim.zip!** =&gt; ribasim/build/create_binaries/libribasim&#xD;&#xA;" />
</dependency>
</artifact-dependencies>
<cleanup />
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"recommendations": [
"julialang.language-julia",
"ms-python.python",
"ms-python.black-formatter",
"ms-python.mypy-type-checker",
"charliermarsh.ruff",
"njpwerner.autodocstring"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"julia.environmentPath": "core",
"notebook.formatOnSave.enabled": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
Expand Down
16 changes: 8 additions & 8 deletions docs/python/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"import geopandas as gpd\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from pathlib import Path\n",
"\n",
"import ribasim"
]
},
Expand Down Expand Up @@ -459,9 +459,8 @@
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import xarray as xr\n",
"\n",
"import ribasim"
"import ribasim\n",
"import xarray as xr"
]
},
{
Expand Down Expand Up @@ -1418,7 +1417,8 @@
"# Plot target level\n",
"target_levels = model.pid_control.time.target.to_numpy()[::2]\n",
"times = date2num(model.pid_control.time.time)[::2]\n",
"ax.plot(times, target_levels, color=\"k\", ls=\":\", label=\"target level\");"
"ax.plot(times, target_levels, color=\"k\", ls=\":\", label=\"target level\")\n",
"pass"
]
},
{
Expand All @@ -1445,7 +1445,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 8fe1871

Please sign in to comment.