From db25a54d2df19dc22fd8683e1e061d73f44664e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 20:31:46 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0) - [github.com/asottile/pyupgrade: v3.2.2 → v3.3.1](https://github.com/asottile/pyupgrade/compare/v3.2.2...v3.3.1) - [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0) - [github.com/PyCQA/docformatter: v1.5.0 → v1.5.1](https://github.com/PyCQA/docformatter/compare/v1.5.0...v1.5.1) - [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0) - [github.com/dosisod/refurb: v1.5.0 → v1.9.1](https://github.com/dosisod/refurb/compare/v1.5.0...v1.9.1) - [github.com/codespell-project/codespell: v2.1.0 → v2.2.2](https://github.com/codespell-project/codespell/compare/v2.1.0...v2.2.2) - [github.com/pre-commit/mirrors-mypy: v0.990 → v0.991](https://github.com/pre-commit/mirrors-mypy/compare/v0.990...v0.991) --- .pre-commit-config.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 00fa12e..adce3fd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: | repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files args: ['--maxkb=25'] @@ -35,7 +35,7 @@ repos: - id: python-use-type-annotations - id: text-unicode-replacement-char - repo: https://github.com/asottile/pyupgrade - rev: v3.2.2 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py37-plus] @@ -52,16 +52,16 @@ repos: {{cookiecutter.project_slug}}/setup.cfg )$ - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/PyCQA/docformatter - rev: v1.5.0 + rev: v1.5.1 hooks: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 additional_dependencies: [ @@ -81,7 +81,7 @@ repos: Pygments, ] - repo: https://github.com/dosisod/refurb - rev: v1.5.0 + rev: v1.9.1 hooks: - id: refurb args: [--ignore, FURB126] @@ -105,7 +105,7 @@ repos: ] pass_filenames: false - repo: https://github.com/codespell-project/codespell - rev: v2.1.0 + rev: v2.2.2 hooks: - id: codespell - repo: https://github.com/executablebooks/mdformat @@ -147,7 +147,7 @@ repos: - id: tryceratops exclude: "{{cookiecutter.project_slug}}/pyproject.toml" - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.990' + rev: 'v0.991' hooks: - id: mypy args: [ From da34063337183982232764288e8f6b0063fdf651 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 1 Jan 2023 18:33:04 +0100 Subject: [PATCH 2/5] Fix ruff. --- .pre-commit-config.yaml | 34 ++++++---------------------------- README.md | 2 +- pyproject.toml | 40 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index adce3fd..039a26a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,36 +60,18 @@ repos: hooks: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] -- repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.205 hooks: - - id: flake8 - additional_dependencies: [ - flake8-alfred, - flake8-bugbear, - flake8-builtins, - flake8-comprehensions, - flake8-docstrings, - flake8-eradicate, - flake8-print, - flake8-pytest-style, - flake8-todo, - flake8-typing-imports, - flake8-unused-arguments, - pep8-naming, - pydocstyle, - Pygments, - ] + - id: ruff + args: [hooks, tests] + pass_filenames: false - repo: https://github.com/dosisod/refurb rev: v1.9.1 hooks: - id: refurb args: [--ignore, FURB126] exclude: ({{cookiecutter.project_slug}}) -- repo: https://github.com/guilatrova/tryceratops - rev: v1.1.0 - hooks: - - id: tryceratops - repo: https://github.com/econchick/interrogate rev: 1.5.0 hooks: @@ -141,11 +123,7 @@ repos: rev: v2.2.2 hooks: - id: codespell -- repo: https://github.com/guilatrova/tryceratops - rev: v1.1.0 - hooks: - - id: tryceratops - exclude: "{{cookiecutter.project_slug}}/pyproject.toml" + additional_dependencies: [tomli] - repo: https://github.com/pre-commit/mirrors-mypy rev: 'v0.991' hooks: diff --git a/README.md b/README.md index fe92c2e..2143705 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![MIT license](https://img.shields.io/github/license/pytask-dev/cookiecutter-pytask-project)](https://github.com/pytask-dev/cookiecutter-pytask-project) [![image](https://readthedocs.org/projects/cookiecutter-pytask-project/badge/?version=latest)](https://cookiecutter-pytask-project.readthedocs.io/en/latest) -[![image](https://img.shields.io/github/workflow/status/pytask-dev/cookiecutter-pytask-project/main/main)](https://github.com/pytask-dev/cookiecutter-pytask-project/actions?query=branch%3Amain) +[![image](https://img.shields.io/github/actions/workflow/status/pytask-dev/cookiecutter-pytask-project/main.yml?branch=main)](https://github.com/pytask-dev/cookiecutter-pytask-project/actions?query=branch%3Amain) [![image](https://codecov.io/gh/pytask-dev/cookiecutter-pytask-project/branch/main/graph/badge.svg)](https://codecov.io/gh/pytask-dev/cookiecutter-pytask-project) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pytask-dev/cookiecutter-pytask-project/main.svg)](https://results.pre-commit.ci/latest/github/pytask-dev/cookiecutter-pytask-project/main) [![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) diff --git a/pyproject.toml b/pyproject.toml index cadab6b..55496ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,12 @@ [build-system] requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"] +build-backend = "setuptools.build_meta" [tool.setuptools_scm] write_to = "version.py" -[tool.tryceratops] -ignore = ["TC003"] - - [tool.mypy] files = ["hooks", "tests"] exclude = "{{cookiecutter.project_slug}}" @@ -26,3 +23,38 @@ warn_unused_ignores = true module = "tests.*" disallow_untyped_defs = false ignore_errors = true + + +[tool.ruff] +target-version = "py37" +select = ["ALL"] +fix = true +extend-ignore = [ + # Numpy docstyle + "D107", + "D203", + "D212", + "D213", + "D402", + "D404", + "D413", + "D415", + "D416", + "D417", + # Others. + "RET504", # unnecessary variable assignment before return. + "S101", # raise errors for asserts. + "B905", # strict parameter for zip that was implemented in py310. + "I", # ignore isort + "ANN101", # type annotating self + "ANN102", # type annotating cls + "FBT", # flake8-boolean-trap + "EM", # flake8-errmsg + "ANN401", # flake8-annotate typing.Any + "PD", # pandas-vet + "UP", # pyupgrade is too aggressive for py<3.10 +] + + +[tool.ruff.per-file-ignores] +"tests/*" = ["D", "ANN"] From 111aa31fce3b6124b537f3cd0460d4da1496da22 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 1 Jan 2023 18:55:03 +0100 Subject: [PATCH 3/5] Fix hooks. --- .pre-commit-config.yaml | 9 ---- cookiecutter.json | 2 +- pyproject.toml | 7 ++- .../.pre-commit-config.yaml | 53 ++++++------------- {{cookiecutter.project_slug}}/pyproject.toml | 38 +++++++++++++ 5 files changed, 61 insertions(+), 48 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 039a26a..48a94b2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,11 +34,6 @@ repos: - id: python-no-log-warn - id: python-use-type-annotations - id: text-unicode-replacement-char -- repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 - hooks: - - id: pyupgrade - args: [--py37-plus] - repo: https://github.com/asottile/reorder_python_imports rev: v3.9.0 hooks: @@ -86,10 +81,6 @@ repos: "{{cookiecutter.project_slug}}/tests/test_import.py" ] pass_filenames: false -- repo: https://github.com/codespell-project/codespell - rev: v2.2.2 - hooks: - - id: codespell - repo: https://github.com/executablebooks/mdformat rev: 0.7.16 hooks: diff --git a/cookiecutter.json b/cookiecutter.json index 331cfb7..6b7ff0a 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -6,7 +6,7 @@ "project_description": "A project for ...", "github_username": "{{ cookiecutter.author.lower().replace(' ', '') }}", "github_email": "{{ cookiecutter.email }}", - "python_version": "3.8", + "python_version": "3.10", "add_tox": ["yes", "no"], "add_github_actions": ["yes", "no"], "add_mypy": ["yes", "no"], diff --git a/pyproject.toml b/pyproject.toml index 55496ec..82bc87f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,12 +36,12 @@ extend-ignore = [ "D212", "D213", "D402", - "D404", "D413", "D415", "D416", "D417", # Others. + "D404", # Do not start module docstring with "This". "RET504", # unnecessary variable assignment before return. "S101", # raise errors for asserts. "B905", # strict parameter for zip that was implemented in py310. @@ -52,9 +52,12 @@ extend-ignore = [ "EM", # flake8-errmsg "ANN401", # flake8-annotate typing.Any "PD", # pandas-vet - "UP", # pyupgrade is too aggressive for py<3.10 ] [tool.ruff.per-file-ignores] "tests/*" = ["D", "ANN"] + + +[tool.ruff.pydocstyle] +convention = "numpy" diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 17f5274..f05aa76 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files args: ['--maxkb=25'] @@ -25,7 +25,7 @@ repos: - id: python-use-type-annotations - id: text-unicode-replacement-char - repo: https://github.com/asottile/pyupgrade - rev: v3.2.2 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py37-plus] @@ -39,54 +39,31 @@ repos: hooks: - id: setup-cfg-fmt - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/PyCQA/docformatter - rev: v1.5.0 + rev: v1.5.1 hooks: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] -- repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 +{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.205 hooks: - - id: flake8 - additional_dependencies: [ - flake8-alfred, - flake8-bugbear, - flake8-builtins, - flake8-comprehensions, - flake8-docstrings, - flake8-eradicate, - flake8-print, - flake8-pytest-style, - flake8-todo, - flake8-typing-imports, - flake8-unused-arguments, - pep8-naming, - pydocstyle, - Pygments, - ] -{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/dosisod/refurb - rev: v1.5.0 + - id: ruff +- repo: https://github.com/dosisod/refurb + rev: v1.9.1 hooks: - id: refurb args: [--ignore, FURB126] -{% endif %}- repo: https://github.com/guilatrova/tryceratops - rev: v1.1.0 - hooks: - - id: tryceratops +{% endif %} - repo: https://github.com/econchick/interrogate rev: 1.5.0 hooks: - id: interrogate args: [-v, --fail-under=40] -- repo: https://github.com/codespell-project/codespell - rev: v2.1.0 - hooks: - - id: codespell - repo: https://github.com/executablebooks/mdformat - rev: 0.7.14 + rev: 0.7.16 hooks: - id: mdformat additional_dependencies: [ @@ -111,7 +88,7 @@ repos: # path/to/file.py # )$ {% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.990' + rev: 'v0.991' hooks: - id: mypy args: [ @@ -119,7 +96,11 @@ repos: --ignore-missing-imports, ] pass_filenames: false -{% endif %}- repo: meta +{% endif %}- repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell +- repo: meta hooks: - id: check-hooks-apply - id: check-useless-excludes diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index e322336..9d0de2a 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -26,3 +26,41 @@ ignore_errors = true [tool.pytask.ini_options] paths = "./src/{{ cookiecutter.project_slug }}" + + +[tool.ruff] +target-version = "py{{ cookiecutter.python_version | replace('.', '') }}" +select = ["ALL"] +fix = true +extend-ignore = [ + # Numpy docstyle + "D107", + "D203", + "D212", + "D213", + "D402", + "D413", + "D415", + "D416", + "D417", + # Others. + "D404", # Do not start module docstring with "This". + "RET504", # unnecessary variable assignment before return. + "S101", # raise errors for asserts. + "B905", # strict parameter for zip that was implemented in py310. + "I", # ignore isort + "ANN101", # type annotating self + "ANN102", # type annotating cls + "FBT", # flake8-boolean-trap + "EM", # flake8-errmsg + "ANN401", # flake8-annotate typing.Any + "PD", # pandas-vet +] + + +[tool.ruff.per-file-ignores] +"tests/*" = ["D", "ANN"] + + +[tool.ruff.pydocstyle] +convention = "numpy" From 2ef947f5f502f31bcc630d739938095e9ab86e7e Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 1 Jan 2023 19:02:49 +0100 Subject: [PATCH 4/5] Remove flake8 config. --- tox.ini | 12 ------------ {{cookiecutter.project_slug}}/tox.ini | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/tox.ini b/tox.ini index d521a42..470470c 100644 --- a/tox.ini +++ b/tox.ini @@ -32,18 +32,6 @@ commands = sphinx-build -T -b html -d {envtmpdir}/doctrees . {envtmpdir}/html - sphinx-build -T -b linkcheck -d {envtmpdir}/doctrees . {envtmpdir}/linkcheck -[flake8] -docstring-convention = numpy -ignore = - D ; ignore missing docstrings. - E203 ; ignore whitespace around : which is enforced by Black. - W503 ; ignore linebreak before binary operator which is enforced by Black. - PT006 ; ignore that parametrizing tests with tuple argument names is preferred. -max-line-length = 88 -pytest-mark-no-parentheses = true -warn-symbols = - pytest.mark.wip = Remove 'wip' mark for tests. - [pytest] addopts = --doctest-modules testpaths = diff --git a/{{cookiecutter.project_slug}}/tox.ini b/{{cookiecutter.project_slug}}/tox.ini index d32b57c..a39f6d0 100644 --- a/{{cookiecutter.project_slug}}/tox.ini +++ b/{{cookiecutter.project_slug}}/tox.ini @@ -21,18 +21,6 @@ conda_deps = commands = pytest {posargs} -[flake8] -docstring-convention = numpy -ignore = - D ; ignore missing docstrings. - E203 ; ignore whitespace around : which is enforced by Black. - W503 ; ignore linebreak before binary operator which is enforced by Black. - PT006 ; ignore that parametrizing tests with tuple argument names is preferred. -max-line-length = 88 -pytest-mark-no-parentheses = true -warn-symbols = - pytest.mark.wip = Remove 'wip' mark for tests. - [pytest] addopts = --doctest-modules filterwarnings = From 222e5b83828e415f152e7fad5686000a30e548e4 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 1 Jan 2023 19:06:50 +0100 Subject: [PATCH 5/5] to changes. --- docs/source/changes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/changes.md b/docs/source/changes.md index b5f3cc3..745699c 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.4.0 - 2023-xx-xx + +- {pull}`29` adds ruff and refurb to pre-commits and fixes CI banner. + ## 1.3.0 - 2022-11-20 - {pull}`22` removes sphinx-click and renames docs environment to