-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Ruff as linter and formatter and introduce git pre-commit hook (#759
- Loading branch information
Showing
29 changed files
with
200 additions
and
135 deletions.
There are no files selected for viewing
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,49 @@ | ||
name: CI RUFF | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- master | ||
- dev | ||
|
||
jobs: | ||
test: | ||
name: ${{ matrix.name }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: Formatting and linting with ruff | ||
python: "3.10" | ||
toxenv: ruff | ||
env: | ||
# Color Output | ||
# Rich (pip) | ||
FORCE_COLOR: 1 | ||
# Tox | ||
PY_COLORS: 1 | ||
# Pytest | ||
PYTEST_ADDOPTS: "--color=yes" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
check-latest: true | ||
cache: "pip" | ||
cache-dependency-path: pyproject.toml | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox | ||
- name: Setup tox environment | ||
run: tox -e ${{ matrix.toxenv }} --notest | ||
|
||
- name: Test | ||
run: tox -e ${{ matrix.toxenv }} --skip-pkg-install |
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,12 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.4.4 | ||
hooks: | ||
# Run the linter. | ||
- id: ruff | ||
types_or: [python, pyi, jupyter] | ||
args: ["--extend-select", "I", "--fix"] | ||
# Run the formatter. | ||
- id: ruff-format | ||
types_or: [python, pyi, jupyter] |
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
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 |
---|---|---|
@@ -1,19 +1,21 @@ | ||
import logging | ||
|
||
from pastas.extensions.accessor import register_model_accessor | ||
from pastas.extensions.accessor import ( | ||
register_model_accessor as register_model_accessor, | ||
) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def register_plotly(): | ||
"""Register Plotly extension for pastas.Model class for interactive plotting.""" | ||
from pastas.plotting.plotly import Plotly | ||
from pastas.plotting.plotly import Plotly as Plotly | ||
|
||
logger.info("Registered plotly extension in Model class, e.g. `ml.plotly.plot()`.") | ||
|
||
|
||
def register_bokeh(): | ||
"""Register Bokeh extension for pastas.Model class for interactive plotting.""" | ||
from pastas.plotting.bokeh import Bokeh | ||
from pastas.plotting.bokeh import Bokeh as Bokeh | ||
|
||
logger.info("Registered bokeh extension in Model class, e.g. `ml.bokeh.plot()`.") |
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
from os import path | ||
|
||
from packaging import version | ||
from pandas import to_numeric | ||
|
||
import pastas as ps | ||
|
||
|
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
Oops, something went wrong.