From 338bb6581c7e96bda8bcc73d150eaf9dee079e52 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Jan 2023 20:11:54 +0000 Subject: [PATCH 1/7] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - https://github.com/myint/docformatter → https://github.com/PyCQA/docformatter - [github.com/charliermarsh/ruff-pre-commit: v0.0.205 → v0.0.206](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.205...v0.0.206) --- .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 0a3d05b..6bf18e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,13 +56,13 @@ repos: rev: 22.12.0 hooks: - id: black -- repo: https://github.com/myint/docformatter +- repo: https://github.com/PyCQA/docformatter rev: v1.5.1 hooks: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.205 + rev: v0.0.206 hooks: - id: ruff args: [hooks, tests] From e57624eee37a233cd800b7703528cd7f58090864 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Fri, 6 Jan 2023 12:28:47 +0100 Subject: [PATCH 2/7] Update inner pre-commit config. --- .pre-commit-config.yaml | 2 +- tests/test_cookie.py | 12 ++++++------ .../.pre-commit-config.yaml | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6bf18e5..7c9bf44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,7 @@ repos: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.206 + rev: v0.0.212 hooks: - id: ruff args: [hooks, tests] diff --git a/tests/test_cookie.py b/tests/test_cookie.py index b375b9b..b4cbf4e 100644 --- a/tests/test_cookie.py +++ b/tests/test_cookie.py @@ -7,7 +7,7 @@ import pytest -@pytest.mark.end_to_end +@pytest.mark.end_to_end() def test_bake_project(cookies): major, minor = sys.version_info[:2] python_version = f"{major}.{minor}" @@ -25,7 +25,7 @@ def test_bake_project(cookies): assert result.project_path.is_dir() -@pytest.mark.end_to_end +@pytest.mark.end_to_end() def test_remove_readthedocs(cookies): result = cookies.bake(extra_context={"add_readthedocs": "no"}) @@ -39,7 +39,7 @@ def test_remove_readthedocs(cookies): assert "readthedocs" not in readme -@pytest.mark.end_to_end +@pytest.mark.end_to_end() def test_remove_github_actions(cookies): result = cookies.bake(extra_context={"add_github_actions": "no"}) @@ -53,7 +53,7 @@ def test_remove_github_actions(cookies): assert "github/workflow/status" not in readme -@pytest.mark.end_to_end +@pytest.mark.end_to_end() def test_remove_tox(cookies): result = cookies.bake(extra_context={"add_tox": "no"}) @@ -67,7 +67,7 @@ def test_remove_tox(cookies): assert not tox.exists() -@pytest.mark.end_to_end +@pytest.mark.end_to_end() def test_remove_license(cookies): result = cookies.bake(extra_context={"open_source_license": "Not open source"}) @@ -79,7 +79,7 @@ def test_remove_license(cookies): assert not license_.exists() -@pytest.mark.end_to_end +@pytest.mark.end_to_end() @pytest.mark.skipif(os.environ.get("CI") is None, reason="Run only in CI.") def test_check_conda_environment_creation_and_run_all_checks(cookies): """Test that the conda environment is created and pre-commit passes.""" diff --git a/{{cookiecutter.package_name}}/.pre-commit-config.yaml b/{{cookiecutter.package_name}}/.pre-commit-config.yaml index 67933ce..c7e14f5 100644 --- a/{{cookiecutter.package_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.package_name}}/.pre-commit-config.yaml @@ -42,13 +42,13 @@ repos: rev: 22.12.0 hooks: - id: black -- repo: https://github.com/myint/docformatter +- repo: https://github.com/PyCQA/docformatter rev: v1.5.1 hooks: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] {% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.205 + rev: v0.0.212 hooks: - id: ruff - repo: https://github.com/dosisod/refurb From 126d4a7389b3638dde9b6fcda92fadb2bb20acfa Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Fri, 6 Jan 2023 12:33:21 +0100 Subject: [PATCH 3/7] Remove pyupgrade when ruff is installed. --- .pre-commit-config.yaml | 5 ----- {{cookiecutter.package_name}}/.pre-commit-config.yaml | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c9bf44..bc28a3b 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: diff --git a/{{cookiecutter.package_name}}/.pre-commit-config.yaml b/{{cookiecutter.package_name}}/.pre-commit-config.yaml index c7e14f5..de8c0db 100644 --- a/{{cookiecutter.package_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.package_name}}/.pre-commit-config.yaml @@ -24,11 +24,12 @@ repos: - id: python-no-log-warn - id: python-use-type-annotations - id: text-unicode-replacement-char -- repo: https://github.com/asottile/pyupgrade +{% if cookiecutter.python_version not in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/asottile/pyupgrade rev: v3.3.1 hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py{{ cookiecutter.python_version | replace('.', '') }}-plus] +{% endif %} - repo: https://github.com/asottile/reorder_python_imports rev: v3.9.0 hooks: From 34668e7567dff4b8525c9c9683513d451e12ecc4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 21:10:13 +0000 Subject: [PATCH 4/7] [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/pygrep-hooks: v1.9.0 → v1.10.0](https://github.com/pre-commit/pygrep-hooks/compare/v1.9.0...v1.10.0) - [github.com/PyCQA/docformatter: v1.5.1 → v1.6.0.rc1](https://github.com/PyCQA/docformatter/compare/v1.5.1...v1.6.0.rc1) - [github.com/charliermarsh/ruff-pre-commit: v0.0.212 → v0.0.237](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.212...v0.0.237) - [github.com/dosisod/refurb: v1.9.1 → v1.10.0](https://github.com/dosisod/refurb/compare/v1.9.1...v1.10.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bc28a3b..c5019d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: args: [--branch, main] - id: trailing-whitespace - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-check-blanket-noqa - id: python-check-mock-methods @@ -52,18 +52,18 @@ repos: hooks: - id: black - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.6.0.rc1 hooks: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.212 + rev: v0.0.237 hooks: - id: ruff args: [hooks, tests] pass_filenames: false - repo: https://github.com/dosisod/refurb - rev: v1.9.1 + rev: v1.10.0 hooks: - id: refurb args: [--ignore, FURB126] From 0188f1640f055dfcaae92cd683e11c7e8c670e2c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 21:10:25 +0000 Subject: [PATCH 5/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- hooks/post_gen_project.py | 4 ++-- hooks/pre_gen_project.py | 4 ++-- tests/test_cookie.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index c8c4955..6bc24ec 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -39,7 +39,7 @@ def main() -> None: remove_file(project_path, ".readthedocs.yaml") subprocess.run( - ("git", "init", "--initial-branch", "main"), check=True, capture_output=True + ("git", "init", "--initial-branch", "main"), check=True, capture_output=True, ) if "{{ cookiecutter.make_initial_commit }}" == "yes": @@ -82,7 +82,7 @@ def main() -> None: else: warnings.warn( "conda environment could not be created since no conda or mamba " - "executable was found." + "executable was found.", ) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index d6ffcb8..53e03e6 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -52,8 +52,8 @@ def main() -> None: if not re.match(PYTHONVERSION_REGEX, python_version): raise ValueError( EXCEPTION_MSG_PYTHONVERSION.format( - min_python_version=PYTHONVERSION_MIN, python_version=python_version - ) + min_python_version=PYTHONVERSION_MIN, python_version=python_version, + ), ) diff --git a/tests/test_cookie.py b/tests/test_cookie.py index b4cbf4e..4f9dc64 100644 --- a/tests/test_cookie.py +++ b/tests/test_cookie.py @@ -16,7 +16,7 @@ def test_bake_project(cookies): extra_context={ "package_name": "pytask-matlab", "python_version": python_version, - } + }, ) assert result.exit_code == 0 @@ -88,7 +88,7 @@ def test_check_conda_environment_creation_and_run_all_checks(cookies): "conda_environment_name": "__test__", "make_initial_commit": "yes", "create_conda_environment_at_finish": "yes", - } + }, ) assert result.exit_code == 0 @@ -98,7 +98,7 @@ def test_check_conda_environment_creation_and_run_all_checks(cookies): # Switch branch before pre-commit because otherwise failure because on main # branch. subprocess.run( - ("git", "checkout", "-b", "test"), cwd=result.project_path, check=True + ("git", "checkout", "-b", "test"), cwd=result.project_path, check=True, ) # Check linting, but not on the first try since formatters fix stuff. From 5142f32507661e8586f31e8b2925080d1f21c8af Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sat, 4 Feb 2023 19:52:54 +0100 Subject: [PATCH 6/7] Issues fixed. --- hooks/post_gen_project.py | 4 ++-- hooks/pre_gen_project.py | 4 ++-- pyproject.toml | 3 +++ tests/test_cookie.py | 6 +++--- {{cookiecutter.package_name}}/pyproject.toml | 1 + 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 6bc24ec..c8c4955 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -39,7 +39,7 @@ def main() -> None: remove_file(project_path, ".readthedocs.yaml") subprocess.run( - ("git", "init", "--initial-branch", "main"), check=True, capture_output=True, + ("git", "init", "--initial-branch", "main"), check=True, capture_output=True ) if "{{ cookiecutter.make_initial_commit }}" == "yes": @@ -82,7 +82,7 @@ def main() -> None: else: warnings.warn( "conda environment could not be created since no conda or mamba " - "executable was found.", + "executable was found." ) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 53e03e6..d6ffcb8 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -52,8 +52,8 @@ def main() -> None: if not re.match(PYTHONVERSION_REGEX, python_version): raise ValueError( EXCEPTION_MSG_PYTHONVERSION.format( - min_python_version=PYTHONVERSION_MIN, python_version=python_version, - ), + min_python_version=PYTHONVERSION_MIN, python_version=python_version + ) ) diff --git a/pyproject.toml b/pyproject.toml index 5fbf292..7e9d1ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,10 +42,13 @@ extend-ignore = [ "EM", # flake8-errmsg "ANN401", # flake8-annotate typing.Any "PD", # pandas-vet + "COM812", # trailing comma missing, but black takes care of that ] [tool.ruff.per-file-ignores] +"hooks/post_gen_project.py" = ["PLR0133"] +"hooks/*" = ["INP001"] "tests/*" = ["D", "ANN"] diff --git a/tests/test_cookie.py b/tests/test_cookie.py index 4f9dc64..b4cbf4e 100644 --- a/tests/test_cookie.py +++ b/tests/test_cookie.py @@ -16,7 +16,7 @@ def test_bake_project(cookies): extra_context={ "package_name": "pytask-matlab", "python_version": python_version, - }, + } ) assert result.exit_code == 0 @@ -88,7 +88,7 @@ def test_check_conda_environment_creation_and_run_all_checks(cookies): "conda_environment_name": "__test__", "make_initial_commit": "yes", "create_conda_environment_at_finish": "yes", - }, + } ) assert result.exit_code == 0 @@ -98,7 +98,7 @@ def test_check_conda_environment_creation_and_run_all_checks(cookies): # Switch branch before pre-commit because otherwise failure because on main # branch. subprocess.run( - ("git", "checkout", "-b", "test"), cwd=result.project_path, check=True, + ("git", "checkout", "-b", "test"), cwd=result.project_path, check=True ) # Check linting, but not on the first try since formatters fix stuff. diff --git a/{{cookiecutter.package_name}}/pyproject.toml b/{{cookiecutter.package_name}}/pyproject.toml index befd34d..6ab45ce 100644 --- a/{{cookiecutter.package_name}}/pyproject.toml +++ b/{{cookiecutter.package_name}}/pyproject.toml @@ -55,6 +55,7 @@ extend-ignore = [ "EM", # flake8-errmsg "ANN401", # flake8-annotate typing.Any "PD", # pandas-vet + "COM812", # trailing comma missing, but black takes care of that ] From c6a18e6ec23d55ff978d19b107f9a70953dda12b Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sat, 4 Feb 2023 19:55:51 +0100 Subject: [PATCH 7/7] Update innner pre-commit. --- .pre-commit-config.yaml | 9 ++------- hooks/post_gen_project.py | 1 - {{cookiecutter.package_name}}/.pre-commit-config.yaml | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c5019d5..105f30f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,16 +48,11 @@ repos: {{cookiecutter.package_name}}/setup.cfg )$ - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black -- repo: https://github.com/PyCQA/docformatter - rev: v1.6.0.rc1 - hooks: - - id: docformatter - args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.237 + rev: v0.0.241 hooks: - id: ruff args: [hooks, tests] diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index c8c4955..efe9511 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -60,7 +60,6 @@ def main() -> None: ) if "{{ cookiecutter.create_conda_environment_at_finish }}" == "yes": - if shutil.which("mamba") is not None: conda_exe = shutil.which("mamba") else: diff --git a/{{cookiecutter.package_name}}/.pre-commit-config.yaml b/{{cookiecutter.package_name}}/.pre-commit-config.yaml index de8c0db..e15e2c8 100644 --- a/{{cookiecutter.package_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.package_name}}/.pre-commit-config.yaml @@ -40,7 +40,7 @@ repos: hooks: - id: setup-cfg-fmt - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/docformatter @@ -49,7 +49,7 @@ repos: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] {% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.212 + rev: v0.0.241 hooks: - id: ruff - repo: https://github.com/dosisod/refurb