-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
119 lines (103 loc) · 4.19 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
# To use tox, see https://tox.readthedocs.io
# Simply pip or conda install tox
# If you use conda, you may also want to install tox-conda
# then run `tox` or `tox -- {pytest args}`
# run in parallel using `tox -p`
[tox]
env_list =
docs, format, lint, mypy, pre-commit, interrogate
toxworkdir = {env:TOXWORKDIR:.tox}
[testenv]
usedevelop = False
download = True
extras =
toml
basepython =
docs: python3.10
lint, format, mypy, pre-commit, interrogate: python3.9
deps =
-r requirements/pip.lock
build
# Windows can't update the pip version with pip running, so use Python
# to install things.
install_command = python -m pip install -I {opts} {packages}
passenv = *
setenv =
#PYTHONWARNINGS=ignore:removed in Python 3.14; use ast.Constant:DeprecationWarning
# Disable CPython's color output
PYTHON_COLORS=0
TOXINIDIR = {toxinidir}
DS_CONFIG_SETTINGS={temp_dir}/setuptools-build.toml
allowlist_externals = cat
# tox not recognizing config_settings passed via cli
# python -m build -C--kind="[tag | current]"
commands_pre =
python -c 'from pathlib import Path; txt="[project]\nname = \"whatever\"\nversion = \"0.0.1\"\n\n[tool.config-settings]\nkind=\"tag\"\n"; p=Path("{env:DS_CONFIG_SETTINGS}"); p.write_text(txt)'
commands =
python -m build
python -m pip install --disable-pip-version-check -q .
[testenv:docs]
description = sphinx docs
# Build the docs so we know if they are successful. We build twice: once with
# -q to get all warnings, and once with -QW to get a success/fail status
# return.
deps =
-r docs/requirements.lock
allowlist_externals =
make
# https://tox.wiki/en/latest/faq.html#building-documentation-with-sphinx
commands =
sphinx-build -d "{envtmpdir}{/}doctree" -b html -aEnqW docs "{toxworkdir}{/}docs_out"
rst2html --strict README.rst "{toxworkdir}{/}trash.html"
-sphinx-build -d "{envtmpdir}{/}doctree" -b html -b linkcheck -aEnq docs "{toxworkdir}{/}docs_out"
-sphinx-build -d "{envtmpdir}{/}doctree" -b html -b linkcheck -aEnQW docs "{toxworkdir}{/}docs_out"
python -c 'print(r"documentation available under file://{toxworkdir}{/}docs_out{/}index.html")'
[testenv:format]
description = fix / enforce code formatting
deps =
-r requirements/dev.lock
setenv =
{[testenv]setenv}
commands =
python -m isort --profile="black" --multi-line=3 --force-grid-wrap=2 --use-parentheses --trailing-comma --ensure-newline-before-comments --line-length=88 --supported-extension="py,pyi" src/
python -m isort --profile="black" --multi-line=3 --force-grid-wrap=2 --use-parentheses --trailing-comma --ensure-newline-before-comments --line-length=88 --supported-extension="py,pyi" tests/
python -m isort --profile="black" --multi-line=3 --force-grid-wrap=2 --use-parentheses --trailing-comma --ensure-newline-before-comments --line-length=88 --supported-extension="py,pyi" integration/
python -m black --quiet --include='\.pyi?$' src/
python -m black --quiet --include='\.pyi?$' tests/
python -m black --quiet --include='\.pyi?$' integration/
# Within a runner, have no access to dist/ folder nor contents. Skip, `twine check`
[testenv:lint]
description = pre-commit and build
deps =
-r requirements/dev.lock
setenv =
{[testenv]setenv}
commands =
validate-pyproject pyproject.toml
# flake8-pyi conflicts with black. Comes down to disagreeing on lines after fcn and classes
# in flake8, there is no --exclude-plugin
- python -m flake8 --max-line-length=88 --extend-ignore="E704,E203,W503,W605,W293,W291,E301,E302,E501" src/
python -m flake8 --max-line-length=88 --extend-ignore="E704,E203,W503,W605,W293,W291,E301,E302,E501" tests/
python -m flake8 --max-line-length=88 --extend-ignore="E704,E203,W503,W605,W293,W291,E301,E302,E501" integration/
[testenv:mypy]
description = static type checking
deps =
-r requirements/mypy.lock
setenv =
{[testenv]setenv}
commands =
mypy --python-version=3.9 -p drain_swamp
[testenv:pre-commit]
description = Run pre-commit
skip_install = true
deps =
-r requirements/manage.lock
setenv =
{[testenv]setenv}
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:interrogate]
deps = interrogate
skip_install = true
commands =
interrogate -vv src tests