Skip to content

Commit

Permalink
Support Ribasim checkout (#85)
Browse files Browse the repository at this point in the history
Fixes #84.

This adds a Pixi `dev` environment, which points to the Ribasim
repository, which is expected to be cloned next to this repository. To
launch VSCode in this environment, use `open-vscode-dev.bat`. I added
`open-vscode.bat` as well to open the default environment, which points
to the latest ribasim release.


https://pixi.sh/latest/reference/configuration/#the-feature-and-environments-tables
  • Loading branch information
visr authored May 16, 2024
1 parent cc2abf2 commit 1eda7f2
Show file tree
Hide file tree
Showing 7 changed files with 6,498 additions and 132 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,36 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Checkout Ribasim-NL
uses: actions/checkout@v4
with:
path: Ribasim-NL

# Ribasim needs to be checked out next to this repo even for the prod environment
- name: Checkout Ribasim
uses: actions/checkout@v4
with:
repository: Deltares/Ribasim
path: Ribasim

- uses: prefix-dev/[email protected]
with:
manifest-path: Ribasim/pixi.toml
pixi-version: "latest"

- name: Check Quarto installation and all engines
working-directory: Ribasim-NL
run: pixi run quarto-check

- name: Render Quarto Project
working-directory: Ribasim-NL
run: pixi run quarto-render

- name: Publish Quarto Project
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site
publish_dir: Ribasim-NL/docs/_site
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 16 additions & 3 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Checkout Ribasim-NL
uses: actions/checkout@v4
with:
path: Ribasim-NL

# Ribasim needs to be checked out next to this repo even for the prod environment
- name: Checkout Ribasim
uses: actions/checkout@v4
with:
repository: Deltares/Ribasim
path: Ribasim

- uses: prefix-dev/[email protected]
with:
manifest-path: Ribasim-NL/pixi.toml
pixi-version: "latest"

- name: Run mypy on hydamo
run: |
pixi run mypy-hydamo
working-directory: Ribasim-NL
run: pixi run mypy-hydamo
15 changes: 14 additions & 1 deletion .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,25 @@ jobs:
arch:
- x86
steps:
- uses: actions/checkout@v4
- name: Checkout Ribasim-NL
uses: actions/checkout@v4
with:
path: Ribasim-NL

# Ribasim needs to be checked out next to this repo even for the prod environment
- name: Checkout Ribasim
uses: actions/checkout@v4
with:
repository: Deltares/Ribasim
path: Ribasim

- uses: prefix-dev/[email protected]
with:
manifest-path: Ribasim-NL/pixi.toml
pixi-version: "latest"

- name: Run tests
working-directory: Ribasim-NL
run: pixi run test-hydamo
env:
RIBASIM_NL_CLOUD_PASS: ${{ secrets.RIBASIM_NL_CLOUD_PASS }}
Expand Down
1 change: 1 addition & 0 deletions open-vscode-dev.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pixi run --environment=dev code . | exit
1 change: 1 addition & 0 deletions open-vscode.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pixi run code . | exit
6,546 changes: 6,434 additions & 112 deletions pixi.lock

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,15 @@ docs = { depends_on = ["build-julia-docs", "quarto-preview"] }
# Lint
mypy-hydamo = "mypy --ignore-missing-imports src/hydamo"
pre-commit = "pre-commit run --all-files"
lint = { depends_on = [
"pre-commit",
"mypy-hydamo",
] }
lint = { depends_on = ["pre-commit", "mypy-hydamo"] }
# Test
test-hydamo = "pytest --numprocesses=auto --basetemp=src/hydamo/tests/temp src/hydamo/tests"
test-ribasim_nl = "pytest --numprocesses=auto --basetemp=src/ribasim_nl/tests/temp src/ribasim_nl/tests"
test-hydamo-cov = "pytest --numprocesses=auto --cov=hydamo --cov-report=xml --cov-report=term-missing src/hydamo/tests"
test-ribasim_nl-cov = "pytest --numprocesses=auto --cov=ribasim_nl --cov-report=xml --cov-report=term-missing src/ribasim_nl/tests"
tests = { depends_on = [
"lint",
"test-hydamo",
"test-ribasim_nl",
] }
tests = { depends_on = ["lint", "test-hydamo", "test-ribasim_nl"] }

[dependencies]
[feature.common.dependencies]
bokeh = ">=3.0"
fiona = "*"
geocube = "*"
Expand All @@ -65,13 +58,22 @@ quarto = "*"
quartodoc = "*"
rasterstats = "*"
requests = "*"
ribasim = "==2024.4.0"
ruff = "*"
shapely = ">=2"
tomli = "*"
tomli-w = "*"
types-requests = "*"

[pypi-dependencies]
hydamo = { path = "src/hydamo", editable = true}
ribasim_nl = { path = "src/ribasim_nl", editable = true}
[feature.common.pypi-dependencies]
hydamo = { path = "src/hydamo", editable = true }
ribasim_nl = { path = "src/ribasim_nl", editable = true }

[feature.dev.pypi-dependencies]
ribasim = { path = "../Ribasim/python/ribasim", editable = true }

[feature.prod.dependencies]
ribasim = "==2024.4.0"

[environments]
default = { features = ["common", "prod"] }
dev = { features = ["common", "dev"] }

0 comments on commit 1eda7f2

Please sign in to comment.