From 061fd0e381742899051a7acf42d0f6b4fe33c8a4 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Tue, 12 Mar 2024 22:25:53 +0100 Subject: [PATCH 1/3] Update pre-commit hooks. --- .pre-commit-config.yaml | 10 ----- pyproject.toml | 31 +++++----------- .../.pre-commit-config.yaml | 10 ----- {{cookiecutter.project_slug}}/pyproject.toml | 37 ++++++------------- 4 files changed, 20 insertions(+), 68 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0abfe95..cc64828 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,10 +34,6 @@ repos: - id: python-no-log-warn - id: python-use-type-annotations - id: text-unicode-replacement-char -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 - hooks: - - id: reorder-python-imports - repo: https://github.com/aio-libs/sort-all rev: v1.2.0 hooks: @@ -54,7 +50,6 @@ repos: rev: v1.28.0 hooks: - id: refurb - args: [--ignore, FURB126] exclude: ({{cookiecutter.project_slug}}) - repo: https://github.com/executablebooks/mdformat rev: 0.7.17 @@ -80,11 +75,6 @@ repos: ] args: [--wrap, "88"] files: (docs/.) - # Exclude files with admonitions. - # exclude: | - # (?x)^( - # path/to/file.py - # )$ - repo: https://github.com/codespell-project/codespell rev: v2.2.6 hooks: diff --git a/pyproject.toml b/pyproject.toml index 9e94d80..a450727 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,10 @@ [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"] +requires = ["setuptools", "wheel", "setuptools_scm[toml]"] build-backend = "setuptools.build_meta" - [tool.setuptools_scm] write_to = "version.py" - [project] name = "cookiecutter_pytask_project" description = "A minimal cookiecutter template for a project with pytask." @@ -53,7 +51,6 @@ platforms = [ "unix", "linux", "osx", "cygwin", "win32",] license-files = [ "LICENSE"] include-package-data = false - [tool.mypy] files = ["hooks", "tests"] exclude = "{{cookiecutter.project_slug}}" @@ -65,45 +62,35 @@ no_implicit_optional = true warn_redundant_casts = true warn_unused_ignores = true - [[tool.mypy.overrides]] module = "tests.*" disallow_untyped_defs = false ignore_errors = true - [tool.ruff] target-version = "py38" -select = ["ALL"] fix = true +unsafe-fixes = true + +[tool.ruff.lint] extend-ignore = [ - # Numpy docstyle - "D107", - "D203", - "D212", - "D213", - "D402", - "D413", - "D415", - "D416", - "D417", # Others. - "I", # ignore isort "COM812", # Comply with ruff-format. "ISC001", # Comply with ruff-format. ] +select = ["ALL"] - -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "hooks/*" = ["INP001"] "tests/*" = ["D", "ANN", "S101", "S603"] "hooks/post_gen_project.py" = ["PLR0133", "S603"] +[tool.ruff.lint.isort] +force-single-line = true -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "numpy" - [tool.pytest.ini_options] addopts = ["--doctest-modules"] testpaths = ["tests"] diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 073e902..4d2146e 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -24,11 +24,6 @@ repos: - id: python-no-log-warn - id: python-use-type-annotations - id: text-unicode-replacement-char -- repo: https://github.com/asottile/reorder_python_imports - rev: v3.9.0 - hooks: - - id: reorder-python-imports{% if cookiecutter.add_mypy == "yes" %} - args: [--py38-plus, --add-import, 'from __future__ import annotations']{% endif %} - repo: https://github.com/asottile/setup-cfg-fmt rev: v2.2.0 hooks: @@ -67,11 +62,6 @@ repos: ] args: [--wrap, "88"] files: (docs/.) - # Exclude files with admonitions. - # exclude: | - # (?x)^( - # path/to/file.py - # )$ {% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy rev: 'v1.7.0' hooks: diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 6894f22..83670b4 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -1,12 +1,10 @@ [build-system] requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"] - [tool.setuptools_scm] write_to = "src/{{ cookiecutter.project_slug }}/_version.py" -{% if cookiecutter.add_mypy == "yes" %} -[tool.mypy] +{% if cookiecutter.add_mypy == "yes" %}[tool.mypy] files = ["src", "tests"] check_untyped_defs = true disallow_any_generics = true @@ -16,49 +14,36 @@ no_implicit_optional = true warn_redundant_casts = true warn_unused_ignores = true - [[tool.mypy.overrides]] module = "tests.*" disallow_untyped_defs = false -ignore_errors = true -{% endif %} - +ignore_errors = true{% endif %} [tool.pytask.ini_options] -paths = "./src/{{ cookiecutter.project_slug }}" - +paths = ["src/{{ cookiecutter.project_slug }}"] [tool.ruff] target-version = "py{{ cookiecutter.python_version | replace('.', '') }}" -select = ["ALL"] fix = true +unsafe-fixes = true + +[tool.ruff.lint] extend-ignore = [ - # Numpy docstyle - "D107", - "D203", - "D212", - "D213", - "D402", - "D413", - "D415", - "D416", - "D417", - # Others. - "I", # ignore isort "COM812", # Comply with ruff-format. "ISC001", # Comply with ruff-format. ] +select = ["ALL"] - -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/*" = ["D", "ANN", "S101"] "docs/source/conf.py" = ["INP001"] +[tool.ruff.lint.isort] +force-single-line = true -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "numpy" - [tool.pytest.ini_options] addopts = ["--doctest-modules"] testpaths = ["tests"] From dc1f3e944c27c13a6558307dff00210b8094349f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 21:26:50 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_cookie.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_cookie.py b/tests/test_cookie.py index 28db28c..79aa5ce 100644 --- a/tests/test_cookie.py +++ b/tests/test_cookie.py @@ -4,7 +4,6 @@ import pytest - _PYTHON_VERSION = ".".join(map(str, sys.version_info[:2])) From bd144f9f60cfc116da4149426ee166a95b3a2977 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Tue, 12 Mar 2024 22:26:59 +0100 Subject: [PATCH 3/3] fix. --- docs/source/changes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/changes.md b/docs/source/changes.md index ccc10d9..e6ec852 100644 --- a/docs/source/changes.md +++ b/docs/source/changes.md @@ -3,6 +3,10 @@ This is a record of all past cookiecutter-pytask-project releases and what went into them in reverse chronological order. +## 1.7.0 - 2024-xx-xx + +- {pull}`39` updates the pre-commit hooks. + ## 1.6.0 - 2023-11-23 - {pull}`35` modernizes the template.