118 lines
4.2 KiB
INI
118 lines
4.2 KiB
INI
# Flake8 doesn't provide a pyproject configuration, but allows tox.ini
|
|
[flake8]
|
|
max-line-length = 119
|
|
extend-ignore =
|
|
# whitespace before :
|
|
# See https://github.com/PyCQA/pycodestyle/issues/373
|
|
E203,
|
|
|
|
[tox]
|
|
# Add Python 3.13 once a wheel for Pillow is available
|
|
envlist = py{38,39,310,311,312}-cov,coverage
|
|
labels =
|
|
test = py-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
|
|
ci = towncrier-check,docs-lint,pre-commit,py{38,39,310,311,312}-cov,coverage
|
|
skip_missing_interpreters = True
|
|
|
|
[testenv:pre-commit]
|
|
skip_install = True
|
|
deps =
|
|
{tox_root}{/}core[dev]
|
|
commands = pre-commit run --all-files --show-diff-on-failure --color=always
|
|
|
|
# The leading comma generates the "py" environment
|
|
[testenv:py{,38,39,310,311,312,313}{,-cov}]
|
|
depends = pre-commit
|
|
changedir = core
|
|
skip_install = True
|
|
setenv =
|
|
TOGA_BACKEND = toga_dummy
|
|
allowlist_externals =
|
|
bash
|
|
commands =
|
|
# TOGA_INSTALL_COMMAND is set to a bash command by the CI workflow
|
|
# Install as editable so parallel runs don't clobber the build directory for each other
|
|
{env:TOGA_INSTALL_COMMAND:python -m pip install {tox_root}{/}core[dev] {tox_root}{/}dummy}
|
|
!cov: python -m pytest {posargs:-vv --color yes}
|
|
cov : python -m coverage run -m pytest {posargs:-vv --color yes}
|
|
|
|
[testenv:coverage{,38,39,310,311,312,313}{,-html}{,-keep}{,-fail}]
|
|
depends = pre-commit,py{,38,39,310,311,312,313}{,-cov}
|
|
changedir = core
|
|
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 =
|
|
coverage38: py38
|
|
coverage39: py39
|
|
coverage310: py310
|
|
coverage311: py311
|
|
coverage312: py312
|
|
coverage313: py313
|
|
deps =
|
|
{tox_root}{/}core[dev]
|
|
setenv =
|
|
keep: COMBINE_KEEP = --keep
|
|
fail: REPORT_FAIL_COND = --fail-under=100
|
|
CORE_RCFILE = --rcfile {tox_root}{/}core{/}pyproject.toml
|
|
PROJECT_RCFILE = --rcfile {tox_root}{/}pyproject.toml
|
|
commands_pre = python --version
|
|
commands =
|
|
-python -m coverage combine {env:CORE_RCFILE} {env:COMBINE_KEEP}
|
|
html: python -m coverage html {env:PROJECT_RCFILE} --skip-covered --skip-empty
|
|
python -m coverage report {env:PROJECT_RCFILE} {env:REPORT_FAIL_COND}
|
|
|
|
[testenv:towncrier{,-check}]
|
|
skip_install = True
|
|
deps =
|
|
towncrier==23.11.0
|
|
{tox_root}{/}core
|
|
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,-live-src}]
|
|
skip_install = True
|
|
deps =
|
|
# editable install so docstrings can be updated for 'all' and 'live'
|
|
-e {tox_root}{/}core[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-!src : sphinx-autobuild {[docs]sphinx_args} {posargs} -b html {[docs]docs_dir} {[docs]build_dir}{/}live
|
|
live-src : sphinx-autobuild {[docs]sphinx_args} {posargs} -a -E --watch {tox_root}{/}core{/}src{/}toga -b html {[docs]docs_dir} {[docs]build_dir}{/}live
|
|
|
|
[testenv:package]
|
|
skip_install = True
|
|
passenv = FORCE_COLOR
|
|
deps =
|
|
build==1.2.1
|
|
twine==5.0.0
|
|
commands =
|
|
python -m build {posargs}
|
|
python -m twine check {posargs}{/}dist{/}*
|