forked from columbia-it/django-jsonapi-training
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
96 lines (85 loc) · 2.46 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
[tox]
envlist =
py{38,39,310}
tox_pip_extensions_ext_venv_update = True
download = true
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
[testenv]
deps =
-rrequirements.txt
flake8
coverage
isort
bandit
safety
setenv =
DJANGO_SETTINGS_MODULE = training.settings
PYTHONIOENCODING = utf8
commands =
flake8 --exclude **/migrations,**/migration_overrides myapp oauth
isort --check-only --diff --skip migrations myapp oauth
python manage.py check
bandit --recursive myapp oauth
safety check --full-report
coverage erase
coverage run --source='{toxinidir}/myapp' manage.py test
coverage html
[testenv:fix-isort]
deps =
-rrequirements.txt
isort
setenv =
DJANGO_SETTINGS_MODULE = training.settings
commands =
isort --skip migrations myapp
[testenv:mkdocs]
deps =
-rdocs/requirements-mkdocs.txt
setenv =
DJANGO_SETTINGS_MODULE = training.settings
commands =
/bin/sh -c "python manage.py graph_models -g -S --disable-abstract-fields -E -o docs/media/current-uml.png myapp"
mkdocs build
[testenv:devenv]
envdir = env
basepython = python3.6
usedevelop = True
deps =
-rrequirements.txt
commands =
/usr/bin/printf '\n\033[0;31m dont forget to source env/bin/activate\033[0m\n'
[testenv:openapi]
deps =
-rrequirements.txt
setenv =
DJANGO_SETTINGS_MODULE = training.settings
commands =
/bin/sh -c "python manage.py generateschema --generator_class myapp.schemas.SchemaGenerator --file docs/schemas/openapi.yaml"
/bin/sh -c "python manage.py generateschema --generator_class myapp.schemas.SchemaGenerator --format openapi-json --file docs/schemas/openapi.json"
[testenv:docker]
deps =
-rrequirements.txt
allowlist_externals =
docker
setenv =
DJANGO_SETTINGS_MODULE = training.settings
commands =
/bin/sh -c "python manage.py generateschema --generator_class myapp.schemas.SchemaGenerator --format openapi-json >docs/schemas/openapi.json"
/bin/cp docs/schemas/openapi.json myapp/static/openapi/openapi.json
/bin/rm -rf dist
python setup.py bdist_wheel
docker build -t myapp:latest .
docker image save -o myapp-docker.tar myapp:latest
/usr/bin/printf '\n\033[0;31m copy the tar to the docker host and do docker image load -i myapp-docker.tar\033[0m\n'
[flake8]
max-line-length = 120
exclude = docs/, myapp/migrations/, .tox/, env/
application-import-names = myapp
builtins = __class__
[isort]
known_first_party = myapp
line_length = 120