Skip to content

Add run_ribasim(toml_path) function - #2653

Merged
visr merged 6 commits into
mainfrom
py-cli
Oct 24, 2025
Merged

visr merged 6 commits into
mainfrom
py-cli

Conversation

@visr

@visr visr commented Oct 17, 2025 •

Copy link
Copy Markdown
Member

This adds a script entrypoint to the pyproject.toml that forwards to the ribasim.exe core, but adding automatic installation:

❯ pixi run ribasim --version
Ribasim CLI v2025.5.0 not found. Downloading...
Downloading: [=====-----------------------------------] 13.4% (44.1/327.8 MB)

It is stored in a cache dir that will be reused. It first looks on the path if it can find a compatible ribasim.exe

This feature can be used from Python as run_ribasim, like run_delwaq.

EDIT: the script entrypoint and automatic downloading is now taken out, see #2662. Now we have:

image

@visr visr changed the title Add ribasim script and run_ribasim(toml_path) function Add run_ribasim(toml_path) function Oct 21, 2025
@visr
visr marked this pull request as ready for review October 21, 2025 12:42
@visr
visr requested review from evetion and verheem and removed request for evetion October 22, 2025 19:22

@verheem verheem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature, well commented and tested so no comments 👍

@visr
visr merged commit 6f684ce into main Oct 24, 2025
17 of 19 checks passed
@visr
visr deleted the py-cli branch October 24, 2025 12:01

@evetion evetion left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the effort in getting the different shells to work, but it's a lot of untested code.

I'm sad to see the auto downloader go, do we need some documentation on how users can download Ribasim and edit their PATH?

@visr

visr commented Oct 24, 2025

Copy link
Copy Markdown
Member Author

I appreciate the effort in getting the different shells to work, but it's a lot of untested code.

True. This uses mocking to at least exercises the code paths. Other than that I manually tested this on all the shells, which comes down to running run_ribasim(toml_path) on a simulation that is long enough to show a progress bar and making sure you see similar output as ribasim.exe, with a progress bar updating in place.

Regarding the PATH documentation we already have this: https://ribasim.org/install.html#adding-ribasim-to-path-on-windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants