Skip to content

[pre-commit.ci] pre-commit autoupdate #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
7 changes: 6 additions & 1 deletion docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 0 additions & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main() -> None:
raise ValueError(
EXCEPTION_MSG_PYTHONVERSION.format(
min_python_version=PYTHONVERSION_MIN, python_version=python_version
)
),
)


Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
28 changes: 15 additions & 13 deletions tests/test_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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."""
Expand All @@ -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
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down