From 9b39ea89120241cdf67e4339faa72e797153973a Mon Sep 17 00:00:00 2001 From: Enrico Guiraud Date: Mon, 12 Jun 2023 23:47:19 -0600 Subject: [PATCH 1/3] Add ruff and other simple checks to pre-commit config --- .pre-commit-config.yaml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5fddf562..5a5db71f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,20 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks repos: -- repo: https://github.com/mwouts/jupytext - rev: v1.14.1 # CURRENT_TAG/COMMIT_HASH - hooks: - - id: jupytext - args: [--sync] +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: check-yaml + - id: check-added-large-files + +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.0.272 + hooks: + - id: ruff + +- repo: https://github.com/mwouts/jupytext + rev: v1.14.6 + hooks: + - id: jupytext + args: [--sync] From c326c94ed38d9601fa84ed7f5a63fc8d30eccd0f Mon Sep 17 00:00:00 2001 From: Enrico Guiraud Date: Mon, 12 Jun 2023 23:48:09 -0600 Subject: [PATCH 2/3] Add jupytext config to pyproject.toml --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e9893a40..a2c9b7d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ [tool.ruff] # ignore too long lines and ; at the end of a line ignore = ["E501", "E703"] + +[tool.jupytext] +formats = "ipynb,py:percent" From f7730338a9cc06db8f147e4f64951613a6e2ed20 Mon Sep 17 00:00:00 2001 From: Enrico Guiraud Date: Mon, 12 Jun 2023 23:42:48 -0600 Subject: [PATCH 3/3] Run pre-commit in GitHub CI --- .github/workflows/CI.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1fc46c82..24b467b9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,10 +26,11 @@ jobs: pip install -r docs/requirements.txt sphinx-build docs docs/_build - linter: + pre-commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: jpetrucciani/ruff-check@main + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0