[tox] envlist = py35,py36,py37,py38 isolated_build = true minversion = 3.21.0 [testenv] deps = -rrequirements.txt -rrequirements-testing.txt command = pytest [dists] setenv = PEP517_OUT_DIR = {env:PEP517_OUT_DIR:{toxinidir}{/}dist} [testenv:cleanup-dists] description = Wipe the the `{env:PEP517_OUT_DIR}{/}` folder usedevelop = false skip_install = true deps = setenv = {[dists]setenv} commands = {envpython} -c \ 'import os, shutil, sys; dists_dir = os.getenv("PEP517_OUT_DIR"); shutil.rmtree(dists_dir, ignore_errors=True); sys.exit(os.path.exists(dists_dir))' [testenv:build-dists] description = Build non-universal dists and put them into the `{env:PEP517_OUT_DIR}{/}` folder depends = cleanup-dists isolated_build = true # `usedevelop = true` overrides `skip_install` instruction, it's unwanted usedevelop = false skip_install = true deps = build >= 0.7.0, < 0.8.0 passenv = PEP517_BUILD_ARGS setenv = {[dists]setenv} commands = {envpython} -m build \ --outdir '{env:PEP517_OUT_DIR}{/}' \ {posargs:{env:PEP517_BUILD_ARGS:}} \ '{toxinidir}' [testenv:metadata-validation] description = Verify that dists under the `{env:PEP517_OUT_DIR}{/}` dir have valid metadata depends = build-dists deps = twine usedevelop = false skip_install = true setenv = {[dists]setenv} commands = {envpython} -m twine check \ --strict \ {env:PEP517_OUT_DIR}{/}* [testenv:lint] description = Enforce quality standards under `{basepython}` ({envpython}) commands = {envpython} -m \ pre_commit run \ --show-diff-on-failure \ --hook-stage manual \ {posargs:--all-files} # Print out the advice on how to install pre-commit from this env into Git: -{envpython} -c \ 'cmd = "{envpython} -m pre_commit install"; \ scr_width = len(cmd) + 10; \ sep = "=" * scr_width; \ cmd_str = " $ \{cmd\}";' \ 'print(f"\n\{sep\}\nTo install pre-commit hooks into the Git repo, run:\n\n\{cmd_str\}\n\n\{sep\}\n")' deps = pre-commit pylint >= 2.5.3 pylint-pytest < 1.1.0 -r requirements-tunnel.txt isolated_build = true skip_install = true