generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
143 lines (130 loc) · 3.81 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
[tox]
envlist =
unit_tests
integration_tests
linting
coverage
type_check
skip_missing_interpreters = True
skipsdist = True
[testenv]
commands = python -m pip install --upgrade pip
[testenv:unit_tests]
# the tests environment is called by the Github action that runs the unit tests
changedir = tests/unit_tests
setenv = PYTHONPATH = {toxinidir}/src
deps =
-r requirements.txt
.[unit_tests]
commands = python -m pytest --basetemp={envtmpdir} {posargs}
[testenv:integration_tests]
# the tests environment is called by the Github action that runs the unit tests
changedir = tests/integration_tests
setenv = PYTHONPATH = {toxinidir}/src
deps =
-r requirements.txt
.[integration_tests]
commands = python -m pytest --basetemp={envtmpdir} {posargs}
[testenv:linting]
# the linting environment is called by the Github Action that runs the linter
deps =
{[testenv:unit_tests]deps}
.[linting]
# add your fixtures like e.g. pytest_datafiles here
commands =
pylint src/maus
# add single files (ending with .py) or packages here
[testenv:type_check]
# the type_check environment checks the type hints using mypy
usedevelop = True
setenv = PYTHONPATH = {toxinidir}/src
deps =
{[testenv:unit_tests]deps}
.[type_check]
commands =
mypy --show-error-codes src/maus
mypy --show-error-codes tests/unit_tests
mypy --show-error-codes tests/integration_tests
# add single files (ending with .py) or packages here
[testenv:spell_check]
# the spellcheck environment checks the code for typos
setenv = PYTHONPATH = {toxinidir}/src
deps =
-r requirements.txt
.[spell_check]
commands =
codespell --ignore-words=domain-specific-terms.txt src
codespell --ignore-words=domain-specific-terms.txt README.md
# add single files (ending with .py) or packages here
[testenv:coverage]
# the coverage environment is called by the Github Action that runs the coverage measurement
changedir = tests/unit_tests
setenv = PYTHONPATH = {toxinidir}/src
deps =
{[testenv:unit_tests]deps}
.[coverage]
commands =
coverage run -m pytest --basetemp={envtmpdir} {posargs}
coverage html --omit .tox/*,unittests/*
coverage report --fail-under 90 --omit .tox/*,unit_tests/*
[testenv:formatting]
setenv = PYTHONPATH = {toxinidir}/src
deps =
-r requirements.txt
.[formating]
commands =
black . --check
isort . --check
[testenv:dev]
# the dev environment contains everything you need to start developing on your local machine.
deps =
{[testenv:unit_tests]deps}
{[testenv:integration_tests]deps}
{[testenv:linting]deps}
{[testenv:type_check]deps}
{[testenv:docs]deps}
{[testenv:coverage]deps}
{[testenv:json_schemas]deps}
{[testenv:formatting]deps}
{[testenv:spell_check]deps}
pre-commit
commands =
python -m pip install --upgrade pip
pip-compile requirements.in
pip install -r requirements.txt
pre-commit install
[testenv:test_packaging]
skip_install = true
deps =
.[test_packaging]
commands =
python -m build
twine check dist/*
[testenv:build_executable]
# first build a package using test_packaging
# the install it from the dist directory
# then bundle it
skip_install = true
deps =
-r requirements.txt
.[build_executable]
commands =
# to provide the name of the executable use the following command:
# tox -e build_executable -- --name maus_cli_macos
pyinstaller --onefile {posargs} src/maus/__init__.py
[testenv:docs]
usedevelop = True
deps =
-r requirements.txt
.[docs]
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html
sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html
python -m doctest README.rst
[testenv:json_schemas]
usedevelop = True
deps =
-r requirements.txt
.[json_schema]
commands =
python json_schemas/generate_json_schemas.py