Skip to content

Commit 62b859f

Browse files
Update pre-commit hooks. (#39)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fdf5ecd commit 62b859f

File tree

6 files changed

+24
-69
lines changed

6 files changed

+24
-69
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ repos:
3434
- id: python-no-log-warn
3535
- id: python-use-type-annotations
3636
- id: text-unicode-replacement-char
37-
- repo: https://github.com/asottile/reorder-python-imports
38-
rev: v3.12.0
39-
hooks:
40-
- id: reorder-python-imports
4137
- repo: https://github.com/aio-libs/sort-all
4238
rev: v1.2.0
4339
hooks:
@@ -54,7 +50,6 @@ repos:
5450
rev: v1.28.0
5551
hooks:
5652
- id: refurb
57-
args: [--ignore, FURB126]
5853
exclude: ({{cookiecutter.project_slug}})
5954
- repo: https://github.com/executablebooks/mdformat
6055
rev: 0.7.17
@@ -80,11 +75,6 @@ repos:
8075
]
8176
args: [--wrap, "88"]
8277
files: (docs/.)
83-
# Exclude files with admonitions.
84-
# exclude: |
85-
# (?x)^(
86-
# path/to/file.py
87-
# )$
8878
- repo: https://github.com/codespell-project/codespell
8979
rev: v2.2.6
9080
hooks:

docs/source/changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
This is a record of all past cookiecutter-pytask-project releases and what went into
44
them in reverse chronological order.
55

6+
## 1.7.0 - 2024-xx-xx
7+
8+
- {pull}`39` updates the pre-commit hooks.
9+
610
## 1.6.0 - 2023-11-23
711

812
- {pull}`35` modernizes the template.

pyproject.toml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
2+
requires = ["setuptools", "wheel", "setuptools_scm[toml]"]
33
build-backend = "setuptools.build_meta"
44

5-
65
[tool.setuptools_scm]
76
write_to = "version.py"
87

9-
108
[project]
119
name = "cookiecutter_pytask_project"
1210
description = "A minimal cookiecutter template for a project with pytask."
@@ -53,7 +51,6 @@ platforms = [ "unix", "linux", "osx", "cygwin", "win32",]
5351
license-files = [ "LICENSE"]
5452
include-package-data = false
5553

56-
5754
[tool.mypy]
5855
files = ["hooks", "tests"]
5956
exclude = "{{cookiecutter.project_slug}}"
@@ -65,45 +62,35 @@ no_implicit_optional = true
6562
warn_redundant_casts = true
6663
warn_unused_ignores = true
6764

68-
6965
[[tool.mypy.overrides]]
7066
module = "tests.*"
7167
disallow_untyped_defs = false
7268
ignore_errors = true
7369

74-
7570
[tool.ruff]
7671
target-version = "py38"
77-
select = ["ALL"]
7872
fix = true
73+
unsafe-fixes = true
74+
75+
[tool.ruff.lint]
7976
extend-ignore = [
80-
# Numpy docstyle
81-
"D107",
82-
"D203",
83-
"D212",
84-
"D213",
85-
"D402",
86-
"D413",
87-
"D415",
88-
"D416",
89-
"D417",
9077
# Others.
91-
"I", # ignore isort
9278
"COM812", # Comply with ruff-format.
9379
"ISC001", # Comply with ruff-format.
9480
]
81+
select = ["ALL"]
9582

96-
97-
[tool.ruff.per-file-ignores]
83+
[tool.ruff.lint.per-file-ignores]
9884
"hooks/*" = ["INP001"]
9985
"tests/*" = ["D", "ANN", "S101", "S603"]
10086
"hooks/post_gen_project.py" = ["PLR0133", "S603"]
10187

88+
[tool.ruff.lint.isort]
89+
force-single-line = true
10290

103-
[tool.ruff.pydocstyle]
91+
[tool.ruff.lint.pydocstyle]
10492
convention = "numpy"
10593

106-
10794
[tool.pytest.ini_options]
10895
addopts = ["--doctest-modules"]
10996
testpaths = ["tests"]

tests/test_cookie.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import pytest
66

7-
87
_PYTHON_VERSION = ".".join(map(str, sys.version_info[:2]))
98

109

{{cookiecutter.project_slug}}/.pre-commit-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ repos:
2424
- id: python-no-log-warn
2525
- id: python-use-type-annotations
2626
- id: text-unicode-replacement-char
27-
- repo: https://github.com/asottile/reorder_python_imports
28-
rev: v3.9.0
29-
hooks:
30-
- id: reorder-python-imports{% if cookiecutter.add_mypy == "yes" %}
31-
args: [--py38-plus, --add-import, 'from __future__ import annotations']{% endif %}
3227
- repo: https://github.com/asottile/setup-cfg-fmt
3328
rev: v2.2.0
3429
hooks:
@@ -67,11 +62,6 @@ repos:
6762
]
6863
args: [--wrap, "88"]
6964
files: (docs/.)
70-
# Exclude files with admonitions.
71-
# exclude: |
72-
# (?x)^(
73-
# path/to/file.py
74-
# )$
7565
{% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy
7666
rev: 'v1.7.0'
7767
hooks:

{{cookiecutter.project_slug}}/pyproject.toml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
[build-system]
22
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
33

4-
54
[tool.setuptools_scm]
65
write_to = "src/{{ cookiecutter.project_slug }}/_version.py"
76

8-
{% if cookiecutter.add_mypy == "yes" %}
9-
[tool.mypy]
7+
{% if cookiecutter.add_mypy == "yes" %}[tool.mypy]
108
files = ["src", "tests"]
119
check_untyped_defs = true
1210
disallow_any_generics = true
@@ -16,49 +14,36 @@ no_implicit_optional = true
1614
warn_redundant_casts = true
1715
warn_unused_ignores = true
1816

19-
2017
[[tool.mypy.overrides]]
2118
module = "tests.*"
2219
disallow_untyped_defs = false
23-
ignore_errors = true
24-
{% endif %}
25-
20+
ignore_errors = true{% endif %}
2621

2722
[tool.pytask.ini_options]
28-
paths = "./src/{{ cookiecutter.project_slug }}"
29-
23+
paths = ["src/{{ cookiecutter.project_slug }}"]
3024

3125
[tool.ruff]
3226
target-version = "py{{ cookiecutter.python_version | replace('.', '') }}"
33-
select = ["ALL"]
3427
fix = true
28+
unsafe-fixes = true
29+
30+
[tool.ruff.lint]
3531
extend-ignore = [
36-
# Numpy docstyle
37-
"D107",
38-
"D203",
39-
"D212",
40-
"D213",
41-
"D402",
42-
"D413",
43-
"D415",
44-
"D416",
45-
"D417",
46-
# Others.
47-
"I", # ignore isort
4832
"COM812", # Comply with ruff-format.
4933
"ISC001", # Comply with ruff-format.
5034
]
35+
select = ["ALL"]
5136

52-
53-
[tool.ruff.per-file-ignores]
37+
[tool.ruff.lint.per-file-ignores]
5438
"tests/*" = ["D", "ANN", "S101"]
5539
"docs/source/conf.py" = ["INP001"]
5640

41+
[tool.ruff.lint.isort]
42+
force-single-line = true
5743

58-
[tool.ruff.pydocstyle]
44+
[tool.ruff.lint.pydocstyle]
5945
convention = "numpy"
6046

61-
6247
[tool.pytest.ini_options]
6348
addopts = ["--doctest-modules"]
6449
testpaths = ["tests"]

0 commit comments

Comments
 (0)