Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pixi, linting, pytest and run it on CI #17

Merged
merged 10 commits into from
Oct 9, 2023
Merged

add pixi, linting, pytest and run it on CI #17

merged 10 commits into from
Oct 9, 2023

Conversation

visr
Copy link
Member

@visr visr commented Oct 6, 2023

There are no docs set up yet, but these developer docs largely apply since most things in this PR are based on the Ribasim repository, a large part of which was set up by @Hofer-Julian.

I added a first test for the hydamo package such that this works:
pixi run test-hydamo

If you wonder where pixi run commands are defined, have a look at pixi.toml.

  • ruff linting
  • black formatting
  • typos spell checker
  • pre-commit automatically checking / fixing issues right before committing, ruff/black/typos and more gets run by this. Can manually be triggered by pixi run pre-commit
  • mypy static type checker, gets run on CI and pixi run lint
  • pytest test framework, gets run on CI and pixi run test-hydamo
  • pixi for package management, configured in pixi.toml. pixi.lock is a huge file that is also checked in that decides the version of every direct and indirect dependency. This save us from having a broken system if one of our dependencies releases a breaking change. And all developers get exactly the same packages.

This seems like a lot, but it's mostly set up in a way that you usually don't have to worry about it too much. For VS Code users, it also helps to follow the recommendations here: https://deltares.github.io/Ribasim/contribute/python.html#sec-vscode.

Most of the changes to the hydamo package are done to make ruff and mypy happy, such that CI passes.

This also already sets up some things we don't use yet but will soon, like Quarto documentation and it installs ribasim-python.

Copy link
Contributor

@d2hydro d2hydro left a comment

Choose a reason for hiding this comment

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

Some things noticed:

  • Win-users (expect the majority in our community) need to use powershell in the pixi install instructions: https://deltares.github.io/Ribasim/contribute/python.html#setting-up-pixi. Something Google tells you immediately, but nevertheless most will default try in command prompt and fail.
  • pixi run install is something we need to add in the docs
  • pixi run python is something we need to add in the docs as well

Other than that, works like a charm!

@visr visr mentioned this pull request Oct 9, 2023
@visr visr merged commit 5372ca1 into main Oct 9, 2023
5 checks passed
@visr visr mentioned this pull request Oct 10, 2023
3 tasks
@d2hydro d2hydro deleted the pixi branch October 23, 2023 11:27
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.

2 participants