Skip to content

Commit bd2139a

Browse files
committed
make mypy optional.
1 parent 022b7ad commit bd2139a

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ repos:
88
- id: check-merge-conflict
99
- id: check-vcs-permalinks
1010
- id: check-yaml
11-
exclude: "{{cookiecutter.project_slug}}/environment.yml"
11+
exclude: |
12+
(?x)^(
13+
{{cookiecutter.project_slug}}/environment.yml|
14+
{{cookiecutter.project_slug}}/.pre-commit-config.yaml
15+
)$
1216
- id: debug-statements
1317
- id: end-of-file-fixer
1418
- id: fix-byte-order-marker

cookiecutter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"python_version": "3.8",
1111
"add_tox": ["yes", "no"],
1212
"add_github_actions": ["yes", "no"],
13+
"add_mypy": ["yes", "no"],
1314
"add_readthedocs": ["yes", "no"],
1415
"add_codecov": ["yes", "no"],
1516
"create_changelog": ["yes", "no"],

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ repos:
3535
- repo: https://github.com/asottile/reorder_python_imports
3636
rev: v2.7.1
3737
hooks:
38-
- id: reorder-python-imports
38+
- id: reorder-python-imports{% if cookiecutter.add_mypy == "yes" %}
39+
args: [--py37-plus, --add-import, 'from __future__ import annotations']{% endif %}
3940
- repo: https://github.com/asottile/setup-cfg-fmt
4041
rev: v1.20.0
4142
hooks:
@@ -86,7 +87,7 @@ repos:
8687
rev: v1.0.1
8788
hooks:
8889
- id: tryceratops
89-
- repo: https://github.com/pre-commit/mirrors-mypy
90+
{% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy
9091
rev: 'v0.931'
9192
hooks:
9293
- id: mypy
@@ -95,7 +96,7 @@ repos:
9596
--ignore-missing-imports,
9697
]
9798
pass_filenames: false
98-
- repo: meta
99+
{% endif %}- repo: meta
99100
hooks:
100101
- id: check-hooks-apply
101102
- id: check-useless-excludes

{{cookiecutter.project_slug}}/LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,5 +758,4 @@ into proprietary programs. If your program is a subroutine library, you
758758
may consider it more useful to permit linking proprietary applications with
759759
the library. If this is what you want to do, use the GNU Lesser General
760760
Public License instead of this License. But first, please read
761-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
762-
{% endif %}
761+
<https://www.gnu.org/licenses/why-not-lgpl.html>.{% endif %}

{{cookiecutter.project_slug}}/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ Credits
3939
-------
4040

4141
This project was created with `cookiecutter <https://github.com/audreyr/cookiecutter>`_
42-
and the `cookiecutter-pytask-project <https://github.com/pytask-dev/cookiecutter-pytask-project>`_
43-
template.
42+
and the `cookiecutter-pytask-project
43+
<https://github.com/pytask-dev/cookiecutter-pytask-project>`_ template.

{{cookiecutter.project_slug}}/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
55
[tool.setuptools_scm]
66
write_to = "src/{{ cookiecutter.project_slug }}/_version.py"
77

8-
8+
{% if cookiecutter.add_mypy == "yes" %}
99
[tool.mypy]
1010
files = ["src", "tests"]
1111
check_untyped_defs = true
@@ -21,3 +21,4 @@ warn_unused_ignores = true
2121
module = "tests.*"
2222
disallow_untyped_defs = false
2323
ignore_errors = true
24+
{% endif %}

0 commit comments

Comments
 (0)