Skip to content

Commit b00214e

Browse files
committed
centralize tool configurations
1 parent 614cd30 commit b00214e

File tree

7 files changed

+93
-94
lines changed

7 files changed

+93
-94
lines changed

docs/tutorial.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Go to this generated folder, the project layout should look like:
3535

3636
```
3737
.
38-
├── .coveragerc
38+
├── .bumpversion.cfg
3939
├── .editorconfig
4040
├── .github
4141
│ ├── ISSUE_TEMPLATE.md
@@ -58,17 +58,15 @@ Go to this generated folder, the project layout should look like:
5858
│ └── usage.md
5959
├── makefile
6060
├── mkdocs.yml
61-
├── poetry.lock
62-
├── pyproject.toml
6361
├── my_package
6462
│ ├── __init__.py
6563
│ ├── cli.py
6664
│ └── my_package.py
65+
├── pyproject.toml
6766
├── setup.cfg
68-
├── tests
69-
│ ├── __init__.py
70-
│ └── test_my_package.py
71-
└── tox.ini
67+
└── tests
68+
├── __init__.py
69+
└── test_my_package.py
7270
7371
```
7472

tests/test_bake_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_bake_with_defaults(cookies):
114114
found_toplevel_files = [f.basename for f in result.project.listdir()]
115115
assert _DEPENDENCY_FILE in found_toplevel_files
116116
assert 'python_boilerplate' in found_toplevel_files
117-
assert 'tox.ini' in found_toplevel_files
117+
assert 'setup.cfg' in found_toplevel_files
118118
assert 'tests' in found_toplevel_files
119119

120120
mkdocs_yml = os.path.join(result._project_dir, "mkdocs.yml")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[bumpversion]
2+
current_version = {{ cookiecutter.version }}
3+
commit = True
4+
tag = True
5+
6+
[bumpversion:file:pyproject.toml]
7+
search = version = "{current_version}"
8+
replace = version = "{new_version}"
9+
10+
[bumpversion:file:{{ cookiecutter.pkg_name }}/__init__.py]
11+
search = __version__ = '{current_version}'
12+
replace = __version__ = '{new_version}'

{{cookiecutter.project_slug}}/.coveragerc

Lines changed: 0 additions & 14 deletions
This file was deleted.

{{cookiecutter.project_slug}}/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ unittest:
1717
pytest
1818

1919
coverage:
20-
pytest --cov=$(sources) --cov-append --cov-report=term-missing tests
20+
pytest --cov=$(sources) --cov-branch --cov-report=term-missing tests
2121

2222
pre-commit:
2323
pre-commit run --all-files

{{cookiecutter.project_slug}}/setup.cfg

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
[bumpversion]
2-
current_version = {{ cookiecutter.version }}
3-
commit = True
4-
tag = True
5-
6-
[bumpversion:file:pyproject.toml]
7-
search = version = "{current_version}"
8-
replace = version = "{new_version}"
9-
10-
[bumpversion:file:{{ cookiecutter.pkg_name }}/__init__.py]
11-
search = __version__ = '{current_version}'
12-
replace = __version__ = '{new_version}'
13-
141
[flake8]
152
max-line-length = 120
163
max-complexity = 18
@@ -38,3 +25,77 @@ exclude = .git,
3825
[mypy]
3926
ignore_missing_imports = True
4027
{%- endif %}
28+
29+
[coverage:run]
30+
# uncomment the following to omit files during running
31+
#omit =
32+
[coverage:report]
33+
exclude_lines =
34+
pragma: no cover
35+
def __repr__
36+
if self.debug:
37+
if settings.DEBUG
38+
raise AssertionError
39+
raise NotImplementedError
40+
if 0:
41+
if __name__ == .__main__.:
42+
def main
43+
44+
[tox:tox]
45+
isolated_build = true
46+
envlist = py36, py37, py38, py39, format, lint, build
47+
48+
[gh-actions]
49+
python =
50+
3.9: py39
51+
3.8: py38, format, lint, build
52+
3.7: py37
53+
3.6: py36
54+
55+
[testenv]
56+
allowlist_externals = pytest
57+
extras =
58+
test
59+
passenv = *
60+
setenv =
61+
PYTHONPATH = {toxinidir}
62+
PYTHONWARNINGS = ignore
63+
commands =
64+
pytest --cov={{ cookiecutter.pkg_name }} --cov-branch --cov-report=xml --cov-report=term-missing tests
65+
66+
[testenv:format]
67+
allowlist_externals =
68+
isort
69+
black
70+
extras =
71+
test
72+
commands =
73+
isort {{ cookiecutter.pkg_name }}
74+
black {{ cookiecutter.pkg_name }} tests
75+
76+
[testenv:lint]
77+
allowlist_externals =
78+
flake8
79+
{%- if cookiecutter.use_mypy == 'y' %}
80+
mypy
81+
{%- endif %}
82+
extras =
83+
test
84+
commands =
85+
flake8 {{ cookiecutter.pkg_name }} tests
86+
{%- if cookiecutter.use_mypy == 'y' %}
87+
mypy {{ cookiecutter.pkg_name }} tests
88+
{%- endif %}
89+
90+
[testenv:build]
91+
allowlist_externals =
92+
poetry
93+
mkdocs
94+
twine
95+
extras =
96+
doc
97+
dev
98+
commands =
99+
poetry build
100+
mkdocs build
101+
twine check dist/*

{{cookiecutter.project_slug}}/tox.ini

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)