diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48a94b2..74e785d 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 @@ -47,22 +47,17 @@ repos: {{cookiecutter.project_slug}}/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.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.241 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] diff --git a/docs/source/changes.md b/docs/source/changes.md index 745699c..2ce32cc 100644 --- a/docs/source/changes.md +++ b/docs/source/changes.md @@ -3,7 +3,12 @@ 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 +## 1.5.0 - 2023-02-04 + +- {pull}`33` fixes some small things. (Thanks to @hmgaudecker!) +- {pull}`34` adds dependabot to update Github Actions. + +## 1.4.0 - 2023-01-01 - {pull}`29` adds ruff and refurb to pre-commits and fixes CI banner. 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/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index f46714f..66e93ac 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -45,7 +45,7 @@ def main() -> None: raise ValueError( EXCEPTION_MSG_PYTHONVERSION.format( min_python_version=PYTHONVERSION_MIN, python_version=python_version - ) + ), ) diff --git a/pyproject.toml b/pyproject.toml index 82bc87f..0d65a3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,11 +52,14 @@ 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] "tests/*" = ["D", "ANN"] +"hooks/post_gen_project.py" = ["PLR0133"] +"hooks/*" = ["INP001"] [tool.ruff.pydocstyle] diff --git a/tests/test_cookie.py b/tests/test_cookie.py index d8cb6fc..28db28c 100644 --- a/tests/test_cookie.py +++ b/tests/test_cookie.py @@ -8,10 +8,10 @@ _PYTHON_VERSION = ".".join(map(str, sys.version_info[:2])) -@pytest.mark.end_to_end +@pytest.mark.end_to_end() def test_bake_project(cookies): result = cookies.bake( - extra_context={"project_slug": "helloworld", "python_version": _PYTHON_VERSION} + extra_context={"project_slug": "helloworld", "python_version": _PYTHON_VERSION}, ) assert result.exit_code == 0 @@ -20,13 +20,13 @@ 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", "python_version": ".".join(map(str, sys.version_info[:2])), - } + }, ) rtd_config = result.project_path.joinpath(".readthedocs.yaml") @@ -39,10 +39,10 @@ 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", "python_version": _PYTHON_VERSION} + extra_context={"add_github_actions": "no", "python_version": _PYTHON_VERSION}, ) ga_config = result.project_path.joinpath(".github", "workflows", "main.yml") @@ -55,10 +55,10 @@ 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", "python_version": _PYTHON_VERSION} + extra_context={"add_tox": "no", "python_version": _PYTHON_VERSION}, ) ga_config = result.project_path.joinpath(".github", "workflows", "main.yml") @@ -71,13 +71,13 @@ 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", "python_version": _PYTHON_VERSION, - } + }, ) license_ = result.project_path.joinpath("LICENSE") @@ -88,7 +88,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.""" @@ -98,7 +98,7 @@ def test_check_conda_environment_creation_and_run_all_checks(cookies): "make_initial_commit": "yes", "create_conda_environment_at_finish": "yes", "python_version": _PYTHON_VERSION, - } + }, ) assert result.exit_code == 0 @@ -108,7 +108,9 @@ 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.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index f05aa76..4d341aa 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -39,7 +39,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 @@ -48,11 +48,11 @@ 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.205 + rev: v0.0.241 hooks: - id: ruff - repo: https://github.com/dosisod/refurb - rev: v1.9.1 + rev: v1.10.0 hooks: - id: refurb args: [--ignore, FURB126] diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 9d0de2a..05f08af 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -55,11 +55,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] "tests/*" = ["D", "ANN"] +"docs/source/conf.py" = ["INP001"] [tool.ruff.pydocstyle]