-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
tox.ini
89 lines (82 loc) · 2.4 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
[tox]
minversion = 3.9.0
envlist =
lint
deps
docs
docs-devel
pkg
# do not enable skip missing to avoid CI false positives
skip_missing_interpreters = False
isolated_build = True
[testenv]
usedevelop = True
passenv = *
allowlist_externals =
rm
sh
setenv =
PIP_CONSTRAINT = {toxinidir}/requirements.txt
devel: PIP_CONSTRAINT = /dev/null
PIP_DISABLE_PIP_VERSION_CHECK = 1
PRE_COMMIT_COLOR = always
[testenv:lint]
description = Runs all linting tasks
commands =
# to run a single linter you can do "pre-commit run flake8"
python -m pre_commit run {posargs:--all --show-diff-on-failure}
deps = pre-commit>=2.20
extras =
skip_install = true
usedevelop = false
[testenv:deps]
description = Bump all test dependencies
skip_install = true
basepython = python3.9
deps =
pre-commit
setenv =
# without his upgrade would likely not do anything
PIP_CONSTRAINT = /dev/null
commands =
# manual hook calls the optional pip-compile-upgrade hook
pre-commit run --all-files --show-diff-on-failure --hook-stage manual up
# Update pre-commit hooks
pre-commit autoupdate
# We fail if files are modified at the end
git diff --exit-code
[testenv:docs-{devel}]
description = Invoke sphinx-build to build the HTML docs
# doc requires py3 due to use of f'' strings and using only python3 as
# basepython risks using python3.4 which is not supported.
basepython = python3
passenv = *
usedevelop = False
commands =
python -m sphinx \
-a -n \
-b html --color \
-W {posargs:--keep-going} \
"{toxinidir}/docs/" "{toxinidir}/docs/html"
# Print out the output docs dir and a way to serve html:
python -c \
'import pathlib; '\
'docs_dir = pathlib.Path(r"{toxworkdir}") / "docs/html"; index_file = docs_dir / "index.html"; print(f"\nDocumentation available under `file://\{index_file\}`\n\nTo serve docs, use `python3 -m http.server --directory \{docs_dir\} 0`\n")'
deps =
--editable=.[test]
[testenv:pkg]
description =
Do packaging/distribution. If tag is not present or PEP440 compliant upload to
PYPI could fail
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
skip_install = true
deps =
build>=0.9.0
twine>=4.0.1
setenv =
commands =
rm -rfv {toxinidir}/dist/
{envpython} -m build --outdir {toxinidir}/dist/ {toxinidir}
# metadata validation
sh -c "python -m twine check --strict {toxinidir}/dist/*"