Skip to content

Commit fd254fd

Browse files
author
a.pirogov
committed
remove interrogate tool because it is unmaintained, closes #6
1 parent b79836c commit fd254fd

8 files changed

Lines changed: 53 additions & 47 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ repos:
5555
- id: pydocstyle
5656
additional_dependencies: ["tomli==2.0.1"]
5757
files: "^src/"
58-
- repo: https://github.com/econchick/interrogate
59-
rev: "1.5.0"
60-
hooks:
61-
- id: interrogate
62-
files: "^src/"
58+
6359
- repo: https://github.com/pre-commit/mirrors-mypy
6460
rev: 'v1.1.1'
6561
hooks:

codemeta.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"audience": [
1111
{
1212
"@type": "Audience",
13-
"audienceType": "Science/Research"
13+
"audienceType": "Developers"
1414
},
1515
{
1616
"@type": "Audience",
17-
"audienceType": "Developers"
17+
"audienceType": "Science/Research"
1818
}
1919
],
2020
"author": [
@@ -44,7 +44,7 @@
4444
"identifier": "cookiecutter",
4545
"name": "cookiecutter",
4646
"runtimePlatform": "Python 3",
47-
"version": "^2.1.1"
47+
"version": "^2.1.2"
4848
},
4949
{
5050
"@type": "SoftwareApplication",
@@ -55,4 +55,4 @@
5555
}
5656
],
5757
"version": "0.1.0"
58-
}
58+
}

hooks/post_gen_project.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ rm tests/test_api.py
2626

2727
# finalize repo setup
2828
git init
29-
poetry install
29+
poetry install --with docs
3030
poetry run poe init-dev # init git repo + register pre-commit
3131
poetry run pip install pipx # install pipx into venv without adding it as dep
3232
poetry run pipx run reuse download --all # get license files for REUSE compliance

tests/test_template.py

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
import subprocess
2+
import sys
23

34
import pytest
5+
from cookiecutter.exceptions import CookiecutterException
46
from cookiecutter.main import cookiecutter
57

68

79
def sanity_check_project(proj_path):
810
"""Sanity-check a generated project (linters, tests, doc generation)."""
9-
subprocess.check_call("poetry install --with docs".split(), cwd=proj_path)
10-
subprocess.check_call("poetry run poe lint --all-files".split(), cwd=proj_path)
11-
subprocess.check_call("poetry run poe test".split(), cwd=proj_path)
12-
subprocess.check_call("poetry run poe docs".split(), cwd=proj_path)
11+
try:
12+
subprocess.check_output(
13+
"poetry install --with docs".split(), cwd=proj_path, stderr=subprocess.PIPE
14+
)
15+
subprocess.check_output(
16+
"poetry run poe lint --all-files".split(),
17+
cwd=proj_path,
18+
stderr=subprocess.PIPE,
19+
)
20+
subprocess.check_output(
21+
"poetry run poe test".split(), cwd=proj_path, stderr=subprocess.PIPE
22+
)
23+
subprocess.check_output(
24+
"poetry run poe docs".split(), cwd=proj_path, stderr=subprocess.PIPE
25+
)
26+
except subprocess.CalledProcessError as e:
27+
print("exit code: {}".format(e.returncode))
28+
print("stderr: {}".format(e.stderr.decode(sys.getfilesystemencoding())))
1329

1430

1531
@pytest.fixture
@@ -23,9 +39,25 @@ def gen(tmp_path_factory):
2339

2440
def gen_project(**cc_args):
2541
out_dir = tmp_path_factory.mktemp("gen_proj")
42+
out_dir_raw = tmp_path_factory.mktemp("gen_proj_raw")
2643

27-
# actual project generation
28-
cookiecutter(template="./", no_input=True, output_dir=out_dir, **cc_args)
44+
# NOTE: once 2.1.2 is out with keep_project_on_failure,
45+
# this can be simplified
46+
# instantiate without hooks (for debugging)
47+
cookiecutter(
48+
template="./",
49+
no_input=True,
50+
output_dir=out_dir_raw,
51+
accept_hooks=False,
52+
**cc_args,
53+
)
54+
55+
# actual project generation (with hooks)
56+
try:
57+
cookiecutter(template="./", no_input=True, output_dir=out_dir, **cc_args)
58+
except CookiecutterException as e:
59+
print(f"DEBUG DIR (without hook evaluation): {out_dir_raw}")
60+
raise e
2961

3062
# should be unique directory
3163
paths = list(out_dir.iterdir())

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ repos:
5353
- id: pydocstyle
5454
additional_dependencies: ["tomli==2.0.1"]
5555
files: "^src/"
56-
- repo: https://github.com/econchick/interrogate
57-
rev: "1.5.0"
58-
hooks:
59-
- id: interrogate
60-
files: "^src/"
6156
- repo: https://github.com/pre-commit/mirrors-mypy
6257
rev: 'v1.1.1'
6358
hooks:

{{ cookiecutter.__project_slug }}/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
![Project status](https://img.shields.io/badge/project%20status-alpha-%23ff8000)
21
[
32
![Docs](https://img.shields.io/badge/read-docs-success)
43
]({{ cookiecutter.__project_gh_pages }})
@@ -8,9 +7,6 @@
87
[
98
![Test Coverage]({{ cookiecutter.__project_gh_pages }}/main/coverage_badge.svg)
109
]({{ cookiecutter.__project_gh_pages }}/main/coverage)
11-
[
12-
![Docs Coverage]({{ cookiecutter.__project_gh_pages }}/main/interrogate_badge.svg)
13-
]({{ cookiecutter.__project_gh_pages }})
1410

1511
<!-- --8<-- [start:abstract] -->
1612
# {{ cookiecutter.project_name.strip() }}

{{ cookiecutter.__project_slug }}/docs/scripts/coverage_status.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66
import anybadge
77
import pytest
88
from coverage import Coverage
9-
from interrogate import badge_gen
10-
from interrogate.coverage import InterrogateCoverage
119

1210
log = logging.getLogger("mkdocs")
1311

1412

1513
badge_colors = {
16-
20: "red",
17-
40: "orange",
18-
60: "yellow",
19-
80: "greenyellow",
20-
90: "green",
14+
20.0: "red",
15+
40.0: "orange",
16+
60.0: "yellow",
17+
80.0: "greenyellow",
18+
90.0: "green",
2119
}
2220
"""Colors for overall coverage percentage (0-100)."""
2321

2422

25-
def on_pre_build(config):
23+
def on_pre_build(_config):
2624
"""Generate coverage report if it is missing and create a badge."""
2725
if not Path("htmlcov").is_dir() or not Path(".coverage").is_file():
2826
log.info("Missing htmlcov or .coverage, running pytest to collect.")
@@ -47,8 +45,3 @@ def on_pre_build(config):
4745
if badge_svg.is_file():
4846
badge_svg.unlink()
4947
badge.write_badge(badge_svg)
50-
51-
# generates a docs coverage badge in docs/interrogate_badge.svg
52-
doc_cov = InterrogateCoverage(paths=["src"]).get_coverage()
53-
log.info(f"Docs Coverage: {doc_cov.perc_covered}%, generating badge.")
54-
badge_gen.create("docs", doc_cov)

{{ cookiecutter.__project_slug }}/pyproject.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ classifiers = [
1515
# TODO: update the classifier strings
1616
# (see https://pypi.org/classifiers/)
1717
"Operating System :: POSIX :: Linux",
18-
"Development Status :: 3 - Alpha",
1918
"Intended Audience :: Science/Research",
2019
"Intended Audience :: Developers",
2120
]
@@ -27,10 +26,9 @@ packages = [{include = "{{ cookiecutter.__project_package }}", from = "src"}]
2726
# include files related to test and documentation only in sdist:
2827
include = [
2928
"*.md", "LICENSE", "LICENSES", ".reuse/dep5", "CITATION.cff", "codemeta.json",
30-
"mkdocs.yml", "docs", "tests", # NOTE: temporary workaround (codemetapy bug)
31-
# { path = "mkdocs.yml", format = "sdist" },
32-
# { path = "docs", format = "sdist" },
33-
# { path = "tests", format = "sdist" },
29+
{ path = "mkdocs.yml", format = "sdist" },
30+
{ path = "docs", format = "sdist" },
31+
{ path = "tests", format = "sdist" },
3432
]
3533

3634
[tool.poetry.dependencies]
@@ -71,7 +69,6 @@ markdown-exec = {extras = ["ansi"], version = "^1.6.0"}
7169
mkdocs-coverage = "^0.2.7"
7270
mike = "^1.1.2"
7371
anybadge = "^1.14.0"
74-
interrogate = "^1.5.0"
7572
black = "^23.3.0"
7673

7774
[tool.poetry.scripts]
@@ -129,9 +126,6 @@ max-line-length = 88
129126
[tool.pydocstyle]
130127
convention = "google"
131128

132-
[tool.interrogate]
133-
fail-under = 95
134-
135129
[tool.bandit]
136130
exclude_dirs = ["tests", "scripts"]
137131

0 commit comments

Comments
 (0)