Skip to content

Commit 6a0c7b0

Browse files
authored
Merge pull request #1 from scientificcomputing/dokken/linting
Add linting as separate dependency
2 parents 53afc44 + fa34e66 commit 6a0c7b0

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

{{cookiecutter.module_name}}/.github/workflows/check_formatting.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
python-version: ${{ matrix.python-version }}
3333

3434
- name: Install code
35-
run: python -m pip install .[test]
35+
run: python -m pip install .[linting]
3636

3737
- name: Flake8 code
38-
run: python -m flake8
38+
run: python -m flake8 -v
3939

4040
- name: Mypy check
41-
run: python -m mypy
41+
run: python -m mypy -v

{{cookiecutter.module_name}}/pyproject.toml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,34 @@ readme = "README.md"
1616

1717
[project.optional-dependencies]
1818
test = [
19-
{%- if cookiecutter.linting|lower == 'y' %}
20-
"mypy",
21-
"flake8",
22-
{%- endif %}
2319
{%- if cookiecutter.testing|lower != 'none' %}
2420
"pytest",
2521
{%- endif %}
2622
{%- if cookiecutter.testing|lower == 'pytest-cov' %}
2723
"pytest-cov",
2824
{%- endif %}
2925
]
30-
26+
{% if cookiecutter.linting|lower == 'y' -%}
27+
linting = [
28+
"mypy",
29+
"flake8",
30+
]
31+
{% endif -%}
3132
{% if cookiecutter.build_docs|lower == 'y' -%}
3233
docs = [
3334
"jupyter-book",
3435
"jupytext",
3536
]
3637
{% endif -%}
38+
all = [
39+
"{{cookiecutter.module_name}}[test]",
40+
{%- if cookiecutter.linting|lower == 'y' %}
41+
"{{cookiecutter.module_name}}[linting]",
42+
{%- endif %}
43+
{%- if cookiecutter.build_docs|lower == 'y' %}
44+
"{{cookiecutter.module_name}}[docs]"
45+
{%- endif %}
46+
]
3747

3848
{% if cookiecutter.testing|lower != 'none' %}
3949
[tool.pytest.ini_options]
@@ -50,4 +60,19 @@ addopts = [
5060
testpaths = [
5161
"tests"
5262
]
53-
{% endif -%}
63+
{% endif -%}
64+
65+
{%- if cookiecutter.linting|lower == 'y' %}
66+
[tool.mypy]
67+
ignore_missing_imports = true
68+
# Folders to exclude
69+
exclude = [
70+
"docs/",
71+
"build/"
72+
]
73+
# Folder to check with mypy
74+
files = [
75+
"src",
76+
"tests"
77+
]
78+
{% endif -%}

0 commit comments

Comments
 (0)