Skip to content

Update pre-commit hooks. #39

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 4 commits into from
Mar 12, 2024
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
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ repos:
- id: python-no-log-warn
- id: python-use-type-annotations
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/aio-libs/sort-all
rev: v1.2.0
hooks:
Expand All @@ -54,7 +50,6 @@ repos:
rev: v1.28.0
hooks:
- id: refurb
args: [--ignore, FURB126]
exclude: ({{cookiecutter.project_slug}})
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
Expand All @@ -80,11 +75,6 @@ repos:
]
args: [--wrap, "88"]
files: (docs/.)
# Exclude files with admonitions.
# exclude: |
# (?x)^(
# path/to/file.py
# )$
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
4 changes: 4 additions & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.0 - 2024-xx-xx

- {pull}`39` updates the pre-commit hooks.

## 1.6.0 - 2023-11-23

- {pull}`35` modernizes the template.
Expand Down
31 changes: 9 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
requires = ["setuptools", "wheel", "setuptools_scm[toml]"]
build-backend = "setuptools.build_meta"


[tool.setuptools_scm]
write_to = "version.py"


[project]
name = "cookiecutter_pytask_project"
description = "A minimal cookiecutter template for a project with pytask."
Expand Down Expand Up @@ -53,7 +51,6 @@ platforms = [ "unix", "linux", "osx", "cygwin", "win32",]
license-files = [ "LICENSE"]
include-package-data = false


[tool.mypy]
files = ["hooks", "tests"]
exclude = "{{cookiecutter.project_slug}}"
Expand All @@ -65,45 +62,35 @@ no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true


[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
ignore_errors = true


[tool.ruff]
target-version = "py38"
select = ["ALL"]
fix = true
unsafe-fixes = true

[tool.ruff.lint]
extend-ignore = [
# Numpy docstyle
"D107",
"D203",
"D212",
"D213",
"D402",
"D413",
"D415",
"D416",
"D417",
# Others.
"I", # ignore isort
"COM812", # Comply with ruff-format.
"ISC001", # Comply with ruff-format.
]
select = ["ALL"]


[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"hooks/*" = ["INP001"]
"tests/*" = ["D", "ANN", "S101", "S603"]
"hooks/post_gen_project.py" = ["PLR0133", "S603"]

[tool.ruff.lint.isort]
force-single-line = true

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "numpy"


[tool.pytest.ini_options]
addopts = ["--doctest-modules"]
testpaths = ["tests"]
Expand Down
1 change: 0 additions & 1 deletion tests/test_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import pytest


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


Expand Down
10 changes: 0 additions & 10 deletions {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ repos:
- id: python-no-log-warn
- id: python-use-type-annotations
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
hooks:
- id: reorder-python-imports{% if cookiecutter.add_mypy == "yes" %}
args: [--py38-plus, --add-import, 'from __future__ import annotations']{% endif %}
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.2.0
hooks:
Expand Down Expand Up @@ -67,11 +62,6 @@ repos:
]
args: [--wrap, "88"]
files: (docs/.)
# Exclude files with admonitions.
# exclude: |
# (?x)^(
# path/to/file.py
# )$
{% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.7.0'
hooks:
Expand Down
37 changes: 11 additions & 26 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]


[tool.setuptools_scm]
write_to = "src/{{ cookiecutter.project_slug }}/_version.py"

{% if cookiecutter.add_mypy == "yes" %}
[tool.mypy]
{% if cookiecutter.add_mypy == "yes" %}[tool.mypy]
files = ["src", "tests"]
check_untyped_defs = true
disallow_any_generics = true
Expand All @@ -16,49 +14,36 @@ no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true


[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
ignore_errors = true
{% endif %}

ignore_errors = true{% endif %}

[tool.pytask.ini_options]
paths = "./src/{{ cookiecutter.project_slug }}"

paths = ["src/{{ cookiecutter.project_slug }}"]

[tool.ruff]
target-version = "py{{ cookiecutter.python_version | replace('.', '') }}"
select = ["ALL"]
fix = true
unsafe-fixes = true

[tool.ruff.lint]
extend-ignore = [
# Numpy docstyle
"D107",
"D203",
"D212",
"D213",
"D402",
"D413",
"D415",
"D416",
"D417",
# Others.
"I", # ignore isort
"COM812", # Comply with ruff-format.
"ISC001", # Comply with ruff-format.
]
select = ["ALL"]


[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D", "ANN", "S101"]
"docs/source/conf.py" = ["INP001"]

[tool.ruff.lint.isort]
force-single-line = true

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "numpy"


[tool.pytest.ini_options]
addopts = ["--doctest-modules"]
testpaths = ["tests"]
Expand Down