From 7177ed58040e8b7837a2300d785427a7c6a38d11 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Wed, 9 Oct 2024 11:25:28 +0200 Subject: [PATCH 1/6] Remove heavy R pre-commit hook --- .pre-commit-config.yaml | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6139aa01..4e5dbb98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,47 +72,6 @@ repos: rev: v2.3.0 hooks: - id: codespell - - # R specific hooks: https://github.com/lorenzwalthert/precommit - - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.3.9001 - hooks: - - id: style-files - args: [--style_pkg=styler, --style_fun=tidyverse_style] - - id: spell-check - exclude: > - (?x)^( - .*\.[rR]| - .*\.feather| - .*\.jpeg| - .*\.pdf| - .*\.png| - .*\.py| - .*\.RData| - .*\.rds| - .*\.Rds| - .*\.Rproj| - .*\.sh| - (.*/|)\.gitignore| - (.*/|)\.gitlab-ci\.yml| - (.*/|)\.lintr| - (.*/|)\.pre-commit-.*| - (.*/|)\.Rbuildignore| - (.*/|)\.Renviron| - (.*/|)\.Rprofile| - (.*/|)\.travis\.yml| - (.*/|)appveyor\.yml| - (.*/|)NAMESPACE| - (.*/|)renv/settings\.dcf| - (.*/|)renv\.lock| - (.*/|)WORDLIST| - \.github/workflows/.*| - data/.*| - )$ - - id: readme-rmd-rendered - - id: parsable-R - - id: no-browser-statement - - id: no-debug-statement - repo: local hooks: - id: forbid-to-commit From 64c5f3e94745329fbb58df0d2a3ab25bf414d11c Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Wed, 9 Oct 2024 11:26:15 +0200 Subject: [PATCH 2/6] Replace conda by mamba where appropriate. --- docs_template/source/development/how-to-contribute.md | 4 ++-- .../source/getting_started/customising_the_template.md | 2 +- docs_template/source/getting_started/second_machine.md | 2 +- docs_template/source/getting_started/template_setup.md | 2 +- docs_template/source/guides_explanations/environments.md | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs_template/source/development/how-to-contribute.md b/docs_template/source/development/how-to-contribute.md index c9d0df46..bc41cb75 100644 --- a/docs_template/source/development/how-to-contribute.md +++ b/docs_template/source/development/how-to-contribute.md @@ -22,7 +22,7 @@ for some immediate and clearly defined tasks. repo): ```console - $ conda env create -f environment.yml + $ mamba env create -f environment.yml $ conda activate template_project ``` @@ -30,7 +30,7 @@ for some immediate and clearly defined tasks. documentation environment: ```console -$ conda env create -f docs_template/rtd_environment.yml +$ mamba env create -f docs_template/rtd_environment.yml $ conda activate ept-docs ``` diff --git a/docs_template/source/getting_started/customising_the_template.md b/docs_template/source/getting_started/customising_the_template.md index 36cf0222..820d5138 100644 --- a/docs_template/source/getting_started/customising_the_template.md +++ b/docs_template/source/getting_started/customising_the_template.md @@ -25,7 +25,7 @@ attributed to changes you make rather than the original template. ```console $ cd /to/root/of/template_project - $ conda env create + $ mamba env create ``` 1. Activate the installed environment diff --git a/docs_template/source/getting_started/second_machine.md b/docs_template/source/getting_started/second_machine.md index 18d90f92..149eb326 100644 --- a/docs_template/source/getting_started/second_machine.md +++ b/docs_template/source/getting_started/second_machine.md @@ -8,7 +8,7 @@ Powershell on Windows. Then type ```console $ git clone $ cd -$ conda env create -f environment.yml +$ mamba env create -f environment.yml $ conda activate $ pre-commit install ``` diff --git a/docs_template/source/getting_started/template_setup.md b/docs_template/source/getting_started/template_setup.md index f02912c5..f9e76363 100644 --- a/docs_template/source/getting_started/template_setup.md +++ b/docs_template/source/getting_started/template_setup.md @@ -25,7 +25,7 @@ changes you make rather than the original template. ```console $ cd /to/root/of/template - $ conda env create -f environment.yml + $ mamba env create -f environment.yml ``` 1. Activate the installed environment diff --git a/docs_template/source/guides_explanations/environments.md b/docs_template/source/guides_explanations/environments.md index 2310cb15..6f488e0b 100644 --- a/docs_template/source/guides_explanations/environments.md +++ b/docs_template/source/guides_explanations/environments.md @@ -79,7 +79,7 @@ If you want to add a package to your environment, add it to the environment.yml Once you have edited the environment.yml file, run ```console -$ conda env update -f environment.yml +$ mamba env update -f environment.yml ``` **Choosing between conda and pip** From 97fdc688d99a591f981f6c6b38f32c2e5fa644d4 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Wed, 9 Oct 2024 11:26:51 +0200 Subject: [PATCH 3/6] Make ruff list more lenient / useful. --- pyproject.toml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 279c70e7..4354e878 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,15 +84,14 @@ fix = true [tool.ruff.lint] select = ["ALL"] extend-ignore = [ - "S101", # Use of `assert` detected. "ANN", # Missing type annotations - "D100", # Missing docstring in public module - "D104", # Missing docstring in public package (__init__.py files) - "S301", # pickle module is unsafe + "COM812", # Conflict with ruff-format + "D10", # Missing docstrings + "ISC001", # Conflict with ruff-format + "PD901", # df is a great name with functional data management "PLR0913", # Too many arguments in function definition - # ignore because conflict with ruff-format - "COM812", - "ISC001", + "S101", # Use of `assert` detected. + "S301", # pickle module is unsafe ] [tool.ruff.lint.per-file-ignores] From d1b232ce6867dc227b0dbede0f3f4cfb892dbeff Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:28:42 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs_template/scripts/task_create_visualization_for_docs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs_template/scripts/task_create_visualization_for_docs.py b/docs_template/scripts/task_create_visualization_for_docs.py index b5848f09..1cdf4339 100644 --- a/docs_template/scripts/task_create_visualization_for_docs.py +++ b/docs_template/scripts/task_create_visualization_for_docs.py @@ -14,7 +14,7 @@ for case in ("model_steps_full", "model_steps_select", "steps_only_full"): @pytask.task(id=case) - def task_visualize_organisational_steps( # noqa: D103 + def task_visualize_organisational_steps( case=case, produces=FIGURES / f"{case}.png", ): @@ -25,7 +25,7 @@ def task_visualize_organisational_steps( # noqa: D103 for tex_file in ("root_bld_src", "src"): @pytask.task(id=tex_file) - def task_compile_latex( # noqa: D103 + def task_compile_latex( depends_on=DOCS_SCRIPTS / "latex" / f"{tex_file}.tex", produces=DOCS_SCRIPTS / "latex" / f"{tex_file}.png", ): @@ -43,7 +43,7 @@ def task_compile_latex( # noqa: D103 time.sleep(1) @pytask.task(id=tex_file) - def task_copy_png_to_figures( # noqa: D103 + def task_copy_png_to_figures( depends_on=DOCS_SCRIPTS / "latex" / f"{tex_file}.png", produces=FIGURES / f"{tex_file}.png", ): From 5ee41622a3638b3c20c7058588761a43746dfa5b Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Wed, 9 Oct 2024 11:30:01 +0200 Subject: [PATCH 5/6] How could I forget about that one? :innocent: --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4354e878..3e0e5f1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,6 +90,7 @@ extend-ignore = [ "ISC001", # Conflict with ruff-format "PD901", # df is a great name with functional data management "PLR0913", # Too many arguments in function definition + "RET504", # Don't force to calculate upon return "S101", # Use of `assert` detected. "S301", # pickle module is unsafe ] From 7500c8d3664c7daee8e3c6fe739ba1a8e4ba5437 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:21:10 +0200 Subject: [PATCH 6/6] [pre-commit.ci] pre-commit autoupdate (#165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.8 → v0.6.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.8...v0.6.9) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e5dbb98..c1fb113e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: hooks: - id: yamlfix - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files args: [--maxkb=25] @@ -37,7 +37,7 @@ repos: hooks: - id: yamllint - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.8 + rev: v0.6.9 hooks: # Run the linter. - id: ruff