-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python: - Added CI - Added dev docs - Extended README - Fixed ruff lints - Removed tox - Extended environment.yml Rest: - Renamed CI workflows - Limited cases where certain workflows are run
- Loading branch information
1 parent
1d25e8c
commit 5ba08a6
Showing
19 changed files
with
248 additions
and
95 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/workflows/CompatHelper.yml → .github/workflows/core_compat_helper.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: CompatHelper | ||
name: Julia CompatHelper | ||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Python Lint | ||
on: | ||
push: | ||
branches: [main] | ||
tags: ["*"] | ||
paths: [".github", "python"] | ||
pull_request: | ||
jobs: | ||
lint: | ||
name: Python ${{ matrix.python_version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
continue-on-error: true | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
python_version: | ||
- "3.11" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Micromamba | ||
uses: mamba-org/provision-with-micromamba@main | ||
with: | ||
python_version: ${{ matrix.python_version }} | ||
cache-downloads: true | ||
cache-env: true | ||
environment-file: ./python/environment.yml | ||
|
||
- name: Run black | ||
working-directory: python | ||
run: black --check . | ||
|
||
# Include `--format=github` to enable automatic inline annotations. | ||
- name: Run ruff | ||
working-directory: python | ||
run: ruff check --format=github . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Python Tests | ||
on: | ||
push: | ||
branches: [main] | ||
tags: ["*"] | ||
paths: [".github", "python"] | ||
pull_request: | ||
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: | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
- windows-latest | ||
python_version: | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Micromamba | ||
uses: mamba-org/provision-with-micromamba@main | ||
with: | ||
python_version: ${{ matrix.python_version }} | ||
cache-downloads: true | ||
cache-env: true | ||
environment-file: ./python/environment.yml | ||
|
||
- name: Install ribasim | ||
working-directory: python | ||
run: pip install -e . | ||
|
||
- name: Run tests | ||
working-directory: python | ||
run: pytest tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: typos | ||
name: Typos | ||
on: | ||
push: | ||
branches: [main] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
"julialang.language-julia", | ||
"ms-python.python", | ||
"charliermarsh.ruff", | ||
"njpwerner.autodocstring" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"[julia]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"julia.environmentPath": "core", | ||
"[python]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true | ||
} | ||
}, | ||
"python.formatting.provider": "black", | ||
"python.linting.mypyEnabled": true, | ||
"python.linting.enabled": true, | ||
"cSpell.enabled": false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
title: "For developers" | ||
--- | ||
|
||
# Set up the developer environment | ||
|
||
## Setting up conda | ||
|
||
In order to develop on `ribasim` locally, please follow the following steps: | ||
|
||
- Download and install [miniconda](https://docs.conda.io/en/latest/miniconda.html). | ||
|
||
- Initialize `conda` by running the following in the `Miniconda prompt`: | ||
|
||
``` | ||
conda init | ||
``` | ||
|
||
- Depending on your company settings, you might also have to run the following in a Powershell terminal as administrator: | ||
|
||
``` | ||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned | ||
``` | ||
|
||
## Creating (or updating) the environment | ||
|
||
- Create (or update) the environment by executing the following in your terminal: | ||
|
||
``` | ||
conda env create --file=environment.yml --force | ||
``` | ||
|
||
## Installing Ribasim Python | ||
|
||
- Activate the environment | ||
|
||
``` | ||
conda activate ribasim | ||
``` | ||
|
||
In order to develop on `ribasim` locally, execute the following line inside your virtual environment | ||
|
||
```bash | ||
pip install -e . | ||
``` | ||
|
||
## Running the tests | ||
|
||
|
||
If no already done, activate the environment | ||
|
||
``` | ||
conda activate ribasim | ||
``` | ||
|
||
|
||
To run the tests execute: | ||
|
||
```bash | ||
pytest tests | ||
``` | ||
|
||
## Setup Visual Studio Code (optional) | ||
|
||
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Ribasim Python | ||
|
||
The Ribasim Python package (named `ribasim`) aims to make it easy to build, update and analyze Ribasim models | ||
programmatically. | ||
|
||
The Ribasim QGIS plugin allows users to construct a model from scratch without programming. | ||
For specific tasks, like adding observed rainfall timeseries, it can be faster to use | ||
Python instead. | ||
|
||
One can also use Ribasim Python to build entire models from base data, such that your model | ||
setup is fully reproducible. | ||
|
||
The package is [registered in PyPI](https://pypi.org/project/ribasim/) and can therefore | ||
be installed with `pip install ribasim`. | ||
|
||
For documentation please see the [examples](https://deltares.github.io/Ribasim/python/examples.html) and [API reference](https://deltares.github.io/Ribasim/python/reference/). | ||
|
||
# Contributing | ||
|
||
For the developer docs please have a look at https://deltares.github.io/Ribasim/python/developer.html |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.