Skip to content

Commit

Permalink
update to ruff 1.5, add notebook settings (#763)
Browse files Browse the repository at this point in the history
This follows the suggestions from https://astral.sh/blog/ruff-v0.1.5

Also moves `settings_template.json` to `settings.json` as suggested by
@deltamarnix. The only part I'm not sure about if it is wise to remove
the file from `.gitignore`. If local changes keep appearing there, we
can revert that part.
  • Loading branch information
visr committed Nov 13, 2023
1 parent 8366c28 commit 0828b17
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ dmypy.json
# Pyre type checker
.pyre/

# vscode
.vscode/settings.json

/.luarc.json
build/ribasim_cli/tests/temp/
python/ribasim_api/tests/temp/
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings_template.json → .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"editor.formatOnSave": true
},
"notebook.formatOnSave.enabled": true,
"notebook.codeActionsOnSave": {
"source.fixAll.ruff": true,
"source.organizeImports.ruff": true
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
Expand Down
4 changes: 1 addition & 3 deletions docs/contribute/python.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ If the example models change, re-run this script.

## Setup Visual Studio Code (optional) {#sec-vscode}

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`
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.

## Linting

Expand Down
48 changes: 24 additions & 24 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ignore = [
"PD901",
]
fixable = ["I"]
extend-include = ["*.ipynb"]

[pydocstyle]
convention = "numpy"

0 comments on commit 0828b17

Please sign in to comment.