Skip to content

Commit

Permalink
centralize tool configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
waynerv committed Jun 18, 2021
1 parent 614cd30 commit b00214e
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 94 deletions.
12 changes: 5 additions & 7 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Go to this generated folder, the project layout should look like:

```
.
├── .coveragerc
├── .bumpversion.cfg
├── .editorconfig
├── .github
│ ├── ISSUE_TEMPLATE.md
Expand All @@ -58,17 +58,15 @@ Go to this generated folder, the project layout should look like:
│ └── usage.md
├── makefile
├── mkdocs.yml
├── poetry.lock
├── pyproject.toml
├── my_package
│ ├── __init__.py
│ ├── cli.py
│ └── my_package.py
├── pyproject.toml
├── setup.cfg
├── tests
│ ├── __init__.py
│ └── test_my_package.py
└── tox.ini
└── tests
├── __init__.py
└── test_my_package.py
```

Expand Down
2 changes: 1 addition & 1 deletion tests/test_bake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_bake_with_defaults(cookies):
found_toplevel_files = [f.basename for f in result.project.listdir()]
assert _DEPENDENCY_FILE in found_toplevel_files
assert 'python_boilerplate' in found_toplevel_files
assert 'tox.ini' in found_toplevel_files
assert 'setup.cfg' in found_toplevel_files
assert 'tests' in found_toplevel_files

mkdocs_yml = os.path.join(result._project_dir, "mkdocs.yml")
Expand Down
12 changes: 12 additions & 0 deletions {{cookiecutter.project_slug}}/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[bumpversion]
current_version = {{ cookiecutter.version }}
commit = True
tag = True

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:{{ cookiecutter.pkg_name }}/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
14 changes: 0 additions & 14 deletions {{cookiecutter.project_slug}}/.coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ unittest:
pytest

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

pre-commit:
pre-commit run --all-files
Expand Down
87 changes: 74 additions & 13 deletions {{cookiecutter.project_slug}}/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
[bumpversion]
current_version = {{ cookiecutter.version }}
commit = True
tag = True

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:{{ cookiecutter.pkg_name }}/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[flake8]
max-line-length = 120
max-complexity = 18
Expand Down Expand Up @@ -38,3 +25,77 @@ exclude = .git,
[mypy]
ignore_missing_imports = True
{%- endif %}

[coverage:run]
# uncomment the following to omit files during running
#omit =
[coverage:report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
def main

[tox:tox]
isolated_build = true
envlist = py36, py37, py38, py39, format, lint, build

[gh-actions]
python =
3.9: py39
3.8: py38, format, lint, build
3.7: py37
3.6: py36

[testenv]
allowlist_externals = pytest
extras =
test
passenv = *
setenv =
PYTHONPATH = {toxinidir}
PYTHONWARNINGS = ignore
commands =
pytest --cov={{ cookiecutter.pkg_name }} --cov-branch --cov-report=xml --cov-report=term-missing tests

[testenv:format]
allowlist_externals =
isort
black
extras =
test
commands =
isort {{ cookiecutter.pkg_name }}
black {{ cookiecutter.pkg_name }} tests

[testenv:lint]
allowlist_externals =
flake8
{%- if cookiecutter.use_mypy == 'y' %}
mypy
{%- endif %}
extras =
test
commands =
flake8 {{ cookiecutter.pkg_name }} tests
{%- if cookiecutter.use_mypy == 'y' %}
mypy {{ cookiecutter.pkg_name }} tests
{%- endif %}

[testenv:build]
allowlist_externals =
poetry
mkdocs
twine
extras =
doc
dev
commands =
poetry build
mkdocs build
twine check dist/*
58 changes: 0 additions & 58 deletions {{cookiecutter.project_slug}}/tox.ini

This file was deleted.

0 comments on commit b00214e

Please sign in to comment.