/
tox.ini
141 lines (133 loc) · 5.08 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
# Flake8 doesn't believe in pyproject.toml, so we put the configuration here.
[flake8]
# https://flake8.readthedocs.org/en/latest/
exclude=\
venv*/*,\
local/*,\
docs/*,\
build/*,\
tests/apps/*,\
.eggs/*,\
.tox/*
max-line-length = 119
extend-ignore =
# whitespace before :
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
[tox]
envlist = towncrier-check,docs-lint,pre-commit,py{38,39,310,311,312,313}-cov,coverage
labels =
test = py{38,39,310,311,312,313}-cov,coverage
test38 = py38-cov,coverage38
test39 = py39-cov,coverage39
test310 = py310-cov,coverage310
test311 = py311-cov,coverage311
test312 = py312-cov,coverage312
test313 = py313-cov,coverage313
test-fast = py{38,39,310,311,312,313}-fast
test-platform = py{38,39,310,311,312,313}-cov,coverage-platform
ci = towncrier-check,docs-lint,pre-commit,py{38,39,310,311,312,313}-cov,coverage-platform
skip_missing_interpreters = True
[testenv:pre-commit]
skip_install = True
deps =
build==1.2.1
setuptools==69.5.1
wheel==0.43.0
commands_pre = python -m install_requirement pre-commit --extra dev --project-root "{tox_root}"
commands = pre-commit run --all-files --show-diff-on-failure --color=always
[testenv:py{,38,39,310,311,312,313}{,-fast,-cov}]
package = wheel
wheel_build_env = .pkg
depends: pre-commit
use_develop = fast: True
# Needed on Windows to test data directory creation
passenv = LOCALAPPDATA
setenv = COVERAGE_FILE = {env:COVERAGE_FILE:.coverage}
extras = dev
commands =
!fast-!cov : python -X warn_default_encoding -m pytest {posargs:-vv --color yes}
cov : python -X warn_default_encoding -m coverage run -m pytest {posargs:-vv --color yes}
fast : python -m pytest {posargs:-vv --color yes -n auto}
[testenv:coverage{,38,39,310,311,312,313}{,-ci}{,-platform,-platform-linux,-platform-macos,-platform-windows,-project}{,-keep}{,-html}]
depends = pre-commit,py{,38,39,310,311,312,313}{,-cov}
skip_install = True
# by default, coverage should run on oldest supported Python for testing platform coverage.
# however, coverage for a particular Python version should match the version used for pytest.
base_python =
coverage: py38,py39,py310,py311,py312,py313
coverage38: py38
coverage39: py39
coverage310: py310
coverage311: py311
coverage312: py312
coverage313: py313
passenv = COVERAGE_FILE
setenv =
keep: COMBINE_FLAGS = --keep
# spoof platform for conditional coverage exclusions
platform-linux: COVERAGE_PLATFORM = linux
platform-macos: COVERAGE_PLATFORM = darwin
platform-windows: COVERAGE_PLATFORM = win32
# use the coverage files created in CI for individual platforms
ci-platform-linux: COVERAGE_FILE = .coverage.ubuntu
ci-platform-macos: COVERAGE_FILE = .coverage.macos
ci-platform-windows: COVERAGE_FILE = .coverage.windows
# disable conditional coverage exclusions for Python version to test entire platform
{platform,project}: COVERAGE_EXCLUDE_PYTHON_VERSION=disable
# disable conditional coverage exclusions for host platform to test entire project
project: COVERAGE_EXCLUDE_PLATFORM=disable
deps =
build==1.2.1
setuptools==69.5.1
wheel==0.43.0
commands_pre =
python --version
python -m install_requirement coverage coverage-conditional-plugin --extra dev --project-root "{tox_root}"
commands =
-python -m coverage combine {env:COMBINE_FLAGS}
html: python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
[testenv:towncrier{,-check}]
skip_install = True
deps =
towncrier==23.11.0
commands =
check : python -m towncrier.check --compare-with origin/main
!check : python -m towncrier {posargs}
[docs]
docs_dir = {tox_root}{/}docs
build_dir = {[docs]docs_dir}{/}_build
# replace when Sphinx>=7.3 and Python 3.8 is dropped:
# -T => --show-traceback
# -W => --fail-on-warning
# -b => --builder
# -v => --verbose
# -a => --write-all
# -E => --fresh-env
sphinx_args = -T -W --keep-going --jobs auto
[testenv:docs{,-lint,-all,-live}]
package = wheel
wheel_build_env = .pkg
extras = docs
passenv =
# On macOS M1, you need to manually set the location of the PyEnchant
# library:
# export PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.2.dylib
PYENCHANT_LIBRARY_PATH
commands =
!lint-!all-!live : python -m sphinx {[docs]sphinx_args} {posargs} -b html {[docs]docs_dir} {[docs]build_dir}{/}html
lint : python -m sphinx {[docs]sphinx_args} {posargs} -b spelling {[docs]docs_dir} {[docs]build_dir}{/}spell
lint : python -m sphinx {[docs]sphinx_args} {posargs} -b linkcheck {[docs]docs_dir} {[docs]build_dir}{/}links
all : python -m sphinx {[docs]sphinx_args} {posargs} -v -a -E -b html {[docs]docs_dir} {[docs]build_dir}{/}html
live : sphinx-autobuild {[docs]sphinx_args} {posargs} -b html {[docs]docs_dir} {[docs]build_dir}{/}live
[testenv:package{,-with-automation}]
skip_install = True
passenv = FORCE_COLOR
deps =
build==1.2.1
twine==5.0.0
commands =
python -m build . --outdir dist{/}
with-automation: python -m build automation --outdir dist{/}
python -m twine check dist{/}*