| 1 |
[tox] |
| 2 |
min_version = 4 |
| 3 |
env_list = |
| 4 |
pre-commit, |
| 5 |
py3{7,8,9,10,11,12}-tests, |
| 6 |
py3{8,9,10,11,12}-mypy, |
| 7 |
pypy3, |
| 8 |
pyright, |
| 9 |
docs, |
| 10 |
changelog, |
| 11 |
coverage-report |
| 12 |
|
| 13 |
|
| 14 |
[testenv:.pkg] |
| 15 |
pass_env = SETUPTOOLS_SCM_PRETEND_VERSION |
| 16 |
|
| 17 |
|
| 18 |
[testenv] |
| 19 |
package = wheel |
| 20 |
wheel_build_env = .pkg |
| 21 |
pass_env = |
| 22 |
FORCE_COLOR |
| 23 |
NO_COLOR |
| 24 |
extras = |
| 25 |
tests: tests |
| 26 |
mypy: tests-mypy |
| 27 |
commands = |
| 28 |
tests: pytest {posargs:-n auto} |
| 29 |
mypy: mypy tests/typing_example.py |
| 30 |
mypy: mypy src/attrs/__init__.pyi src/attr/__init__.pyi src/attr/_typing_compat.pyi src/attr/_version_info.pyi src/attr/converters.pyi src/attr/exceptions.pyi src/attr/filters.pyi src/attr/setters.pyi src/attr/validators.pyi |
| 31 |
|
| 32 |
[testenv:py3{7,10,12}-tests] |
| 33 |
extras = cov |
| 34 |
# Python 3.6+ has a number of compile-time warnings on invalid string escapes. |
| 35 |
# PYTHONWARNINGS=d and --no-compile below make them visible during the tox run. |
| 36 |
set_env = |
| 37 |
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml |
| 38 |
PYTHONWARNINGS=d |
| 39 |
install_command = python -Im pip install --no-compile {opts} {packages} |
| 40 |
commands_pre = python -c 'import pathlib; pathlib.Path("{env_site_packages_dir}/cov.pth").write_text("import coverage; coverage.process_startup()")' |
| 41 |
commands = coverage run -m pytest {posargs:-n auto} |
| 42 |
|
| 43 |
|
| 44 |
[testenv:coverage-report] |
| 45 |
# Keep base_python in-sync with .python-version-default |
| 46 |
base_python = py312 |
| 47 |
depends = py3{7,10,11} |
| 48 |
skip_install = true |
| 49 |
deps = coverage[toml]>=5.3 |
| 50 |
commands = |
| 51 |
coverage combine |
| 52 |
coverage report |
| 53 |
|
| 54 |
|
| 55 |
[testenv:docs] |
| 56 |
# Keep base_python in-sync with ci.yml/docs and .readthedocs.yaml. |
| 57 |
base_python = py312 |
| 58 |
extras = docs |
| 59 |
commands = |
| 60 |
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html |
| 61 |
sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html |
| 62 |
|
| 63 |
|
| 64 |
[testenv:docs-watch] |
| 65 |
package = editable |
| 66 |
base_python = {[testenv:docs]base_python} |
| 67 |
extras = {[testenv:docs]extras} |
| 68 |
deps = watchfiles |
| 69 |
commands = |
| 70 |
watchfiles \ |
| 71 |
--ignore-paths docs/_build/ \ |
| 72 |
'sphinx-build -W -n --jobs auto -b html -d {envtmpdir}/doctrees docs docs/_build/html' \ |
| 73 |
src \ |
| 74 |
docs |
| 75 |
|
| 76 |
|
| 77 |
[testenv:docs-linkcheck] |
| 78 |
package = editable |
| 79 |
base_python = {[testenv:docs]base_python} |
| 80 |
extras = {[testenv:docs]extras} |
| 81 |
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html |
| 82 |
|
| 83 |
|
| 84 |
[testenv:pre-commit] |
| 85 |
skip_install = true |
| 86 |
deps = pre-commit |
| 87 |
commands = pre-commit run --all-files |
| 88 |
|
| 89 |
|
| 90 |
[testenv:changelog] |
| 91 |
deps = towncrier |
| 92 |
skip_install = true |
| 93 |
commands = towncrier build --version main --draft |
| 94 |
|
| 95 |
|
| 96 |
[testenv:pyright] |
| 97 |
extras = tests |
| 98 |
deps = pyright |
| 99 |
commands = pytest tests/test_pyright.py -vv |
| 100 |
|
| 101 |
|
| 102 |
[testenv:docset] |
| 103 |
deps = doc2dash |
| 104 |
extras = docs |
| 105 |
allowlist_externals = |
| 106 |
rm |
| 107 |
cp |
| 108 |
tar |
| 109 |
commands = |
| 110 |
rm -rf attrs.docset attrs.tgz docs/_build |
| 111 |
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html |
| 112 |
doc2dash --index-page index.html --icon docs/_static/docset-icon.png --online-redirect-url https://www.attrs.org/en/latest/ docs/_build/html |
| 113 |
cp docs/_static/[email protected] attrs.docset/[email protected] |
| 114 |
tar --exclude='.DS_Store' -cvzf attrs.tgz attrs.docset |