Skip to content
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
53 changes: 11 additions & 42 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exclude: |

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ['--maxkb=25']
Expand Down Expand Up @@ -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.2.2
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
hooks:
Expand All @@ -52,44 +47,26 @@ repos:
{{cookiecutter.project_slug}}/setup.cfg
)$
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.0
rev: v1.5.1
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.205
hooks:
- id: flake8
additional_dependencies: [
flake8-alfred,
flake8-bugbear,
flake8-builtins,
flake8-comprehensions,
flake8-docstrings,
flake8-eradicate,
flake8-print,
flake8-pytest-style,
flake8-todo,
flake8-typing-imports,
flake8-unused-arguments,
pep8-naming,
pydocstyle,
Pygments,
]
- id: ruff
args: [hooks, tests]
pass_filenames: false
- repo: https://github.com/dosisod/refurb
rev: v1.5.0
rev: v1.9.1
hooks:
- id: refurb
args: [--ignore, FURB126]
exclude: ({{cookiecutter.project_slug}})
- repo: https://github.com/guilatrova/tryceratops
rev: v1.1.0
hooks:
- id: tryceratops
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
Expand All @@ -104,10 +81,6 @@ repos:
"{{cookiecutter.project_slug}}/tests/test_import.py"
]
pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
Expand Down Expand Up @@ -141,13 +114,9 @@ repos:
rev: v2.2.2
hooks:
- id: codespell
- repo: https://github.com/guilatrova/tryceratops
rev: v1.1.0
hooks:
- id: tryceratops
exclude: "{{cookiecutter.project_slug}}/pyproject.toml"
additional_dependencies: [tomli]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.990'
rev: 'v0.991'
hooks:
- id: mypy
args: [
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"project_description": "A project for ...",
"github_username": "{{ cookiecutter.author.lower().replace(' ', '') }}",
"github_email": "{{ cookiecutter.email }}",
"python_version": "3.8",
"python_version": "3.10",
"add_tox": ["yes", "no"],
"add_github_actions": ["yes", "no"],
"add_mypy": ["yes", "no"],
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.4.0 - 2023-xx-xx

- {pull}`29` adds ruff and refurb to pre-commits and fixes CI banner.

## 1.3.0 - 2022-11-20

- {pull}`22` removes sphinx-click and renames docs environment to
Expand Down
43 changes: 39 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
build-backend = "setuptools.build_meta"


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


[tool.tryceratops]
ignore = ["TC003"]


[tool.mypy]
files = ["hooks", "tests"]
exclude = "{{cookiecutter.project_slug}}"
Expand All @@ -26,3 +23,41 @@ warn_unused_ignores = true
module = "tests.*"
disallow_untyped_defs = false
ignore_errors = true


[tool.ruff]
target-version = "py37"
select = ["ALL"]
fix = true
extend-ignore = [
# Numpy docstyle
"D107",
"D203",
"D212",
"D213",
"D402",
"D413",
"D415",
"D416",
"D417",
# Others.
"D404", # Do not start module docstring with "This".
"RET504", # unnecessary variable assignment before return.
"S101", # raise errors for asserts.
"B905", # strict parameter for zip that was implemented in py310.
"I", # ignore isort
"ANN101", # type annotating self
"ANN102", # type annotating cls
"FBT", # flake8-boolean-trap
"EM", # flake8-errmsg
"ANN401", # flake8-annotate typing.Any
"PD", # pandas-vet
]


[tool.ruff.per-file-ignores]
"tests/*" = ["D", "ANN"]


[tool.ruff.pydocstyle]
convention = "numpy"
12 changes: 0 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ commands =
sphinx-build -T -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
- sphinx-build -T -b linkcheck -d {envtmpdir}/doctrees . {envtmpdir}/linkcheck

[flake8]
docstring-convention = numpy
ignore =
D ; ignore missing docstrings.
E203 ; ignore whitespace around : which is enforced by Black.
W503 ; ignore linebreak before binary operator which is enforced by Black.
PT006 ; ignore that parametrizing tests with tuple argument names is preferred.
max-line-length = 88
pytest-mark-no-parentheses = true
warn-symbols =
pytest.mark.wip = Remove 'wip' mark for tests.

[pytest]
addopts = --doctest-modules
testpaths =
Expand Down
53 changes: 17 additions & 36 deletions {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ['--maxkb=25']
Expand All @@ -25,7 +25,7 @@ repos:
- id: python-use-type-annotations
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]
Expand All @@ -39,54 +39,31 @@ repos:
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.0
rev: v1.5.1
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.205
hooks:
- id: flake8
additional_dependencies: [
flake8-alfred,
flake8-bugbear,
flake8-builtins,
flake8-comprehensions,
flake8-docstrings,
flake8-eradicate,
flake8-print,
flake8-pytest-style,
flake8-todo,
flake8-typing-imports,
flake8-unused-arguments,
pep8-naming,
pydocstyle,
Pygments,
]
{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/dosisod/refurb
rev: v1.5.0
- id: ruff
- repo: https://github.com/dosisod/refurb
rev: v1.9.1
hooks:
- id: refurb
args: [--ignore, FURB126]
{% endif %}- repo: https://github.com/guilatrova/tryceratops
rev: v1.1.0
hooks:
- id: tryceratops
{% endif %}
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
args: [-v, --fail-under=40]
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.14
rev: 0.7.16
hooks:
- id: mdformat
additional_dependencies: [
Expand All @@ -111,15 +88,19 @@ repos:
# path/to/file.py
# )$
{% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.990'
rev: 'v0.991'
hooks:
- id: mypy
args: [
--no-strict-optional,
--ignore-missing-imports,
]
pass_filenames: false
{% endif %}- repo: meta
{% endif %}- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
Expand Down
38 changes: 38 additions & 0 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,41 @@ ignore_errors = true

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


[tool.ruff]
target-version = "py{{ cookiecutter.python_version | replace('.', '') }}"
select = ["ALL"]
fix = true
extend-ignore = [
# Numpy docstyle
"D107",
"D203",
"D212",
"D213",
"D402",
"D413",
"D415",
"D416",
"D417",
# Others.
"D404", # Do not start module docstring with "This".
"RET504", # unnecessary variable assignment before return.
"S101", # raise errors for asserts.
"B905", # strict parameter for zip that was implemented in py310.
"I", # ignore isort
"ANN101", # type annotating self
"ANN102", # type annotating cls
"FBT", # flake8-boolean-trap
"EM", # flake8-errmsg
"ANN401", # flake8-annotate typing.Any
"PD", # pandas-vet
]


[tool.ruff.per-file-ignores]
"tests/*" = ["D", "ANN"]


[tool.ruff.pydocstyle]
convention = "numpy"
12 changes: 0 additions & 12 deletions {{cookiecutter.project_slug}}/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ conda_deps =
commands =
pytest {posargs}

[flake8]
docstring-convention = numpy
ignore =
D ; ignore missing docstrings.
E203 ; ignore whitespace around : which is enforced by Black.
W503 ; ignore linebreak before binary operator which is enforced by Black.
PT006 ; ignore that parametrizing tests with tuple argument names is preferred.
max-line-length = 88
pytest-mark-no-parentheses = true
warn-symbols =
pytest.mark.wip = Remove 'wip' mark for tests.

[pytest]
addopts = --doctest-modules
filterwarnings =
Expand Down