| 1 |
requires = ["tox-uv>=1.28"] |
| 2 |
env_list = [ |
| 3 |
"fix", |
| 4 |
"type", |
| 5 |
"docs", |
| 6 |
"path", |
| 7 |
{ product = [{ prefix = "3.", start = 10, stop = 15 }]}, |
| 8 |
{ product = [{ prefix = "pypy3.", start = 10, stop = 11 }]}, |
| 9 |
{ product = [{ prefix = "min-3.", start = 10, stop = 15 }]}, |
| 10 |
{ product = [{ prefix = "min-pypy3.", start = 10, stop = 11 }]}, |
| 11 |
] |
| 12 |
skip_missing_interpreters = true |
| 13 |
|
| 14 |
[env_run_base] |
| 15 |
description = "run test suite with {basepython}" |
| 16 |
uv_seed = true |
| 17 |
pass_env = ["LC_ALL", "PIP_*", "PYTEST_*", "TERM"] |
| 18 |
commands = [ |
| 19 |
[ |
| 20 |
"pytest", "-ra", "--cov", "--cov-config", "pyproject.toml", |
| 21 |
"--cov-report=html:{envdir}/htmlcov", "--cov-context=test", |
| 22 |
"--cov-report=xml:{toxworkdir}/coverage.{envname}.xml", |
| 23 |
"--cov-report", "term-missing", |
| 24 |
{ replace = "posargs", default = ["-n", "auto"], extend = true }, |
| 25 |
], |
| 26 |
] |
| 27 |
dependency_groups = ["test"] |
| 28 |
|
| 29 |
[env_run_base.set_env] |
| 30 |
COVERAGE_CORE = "sysmon" |
| 31 |
COVERAGE_FILE = "{toxworkdir}/.coverage.{envname}" |
| 32 |
PYPY3323BUG = "1" |
| 33 |
PYTHONWARNDEFAULTENCODING = "1" |
| 34 |
TEST_STATUS_DIR = "{envtmpdir}" |
| 35 |
|
| 36 |
[env_base.min] |
| 37 |
factors = [["3.10", "3.11", "3.12", "3.13", "3.14", "3.15", "pypy3.10", "pypy3.11"]] |
| 38 |
description = "check minimum versions required of all dependencies" |
| 39 |
set_env = { PIP_CONSTRAINT = "{toxinidir}/tests/constraints.txt", UV_CONSTRAINT = "{toxinidir}/tests/constraints.txt" } |
| 40 |
|
| 41 |
[env.fix] |
| 42 |
description = "run static analysis and style checks" |
| 43 |
skip_install = true |
| 44 |
pass_env = ["HOMEPATH", "PROGRAMDATA"] |
| 45 |
commands = [ |
| 46 |
["prek", "run", "--all-files", "--show-diff-on-failure"], |
| 47 |
["python", "-c", 'print("hint: run {envdir}/bin/prek install to add checks as pre-commit hook")'], |
| 48 |
] |
| 49 |
dependency_groups = ["lint"] |
| 50 |
|
| 51 |
[env.type] |
| 52 |
description = "run type check on code base" |
| 53 |
set_env = { PYTHONWARNDEFAULTENCODING = "" } |
| 54 |
commands = [["mypy", { replace = "posargs", extend = true }]] |
| 55 |
dependency_groups = ["mypy"] |
| 56 |
|
| 57 |
[env.docs] |
| 58 |
description = "build documentations" |
| 59 |
base_python = "3.14" |
| 60 |
set_env = { PYTHONUTF8 = "1" } |
| 61 |
commands = [ |
| 62 |
["proselint", "check", "docs"], |
| 63 |
["sphinx-build", "-W", "-n", "-b", "html", "docs", "{env:READTHEDOCS_OUTPUT:{envtmpdir}}/html"], |
| 64 |
["python", "-c", 'import os; print("Documentation available under file://" + os.environ.get("READTHEDOCS_OUTPUT", "{envtmpdir}") + "/html/index.html")'], |
| 65 |
] |
| 66 |
dependency_groups = ["docs"] |
| 67 |
|
| 68 |
[env.path] |
| 69 |
description = "verify build can run from source (bootstrap)" |
| 70 |
set_env = { COVERAGE_FILE = "{toxworkdir}/.coverage.{envname}", PYTHONPATH = "{toxinidir}/src" } |
| 71 |
commands_pre = [ |
| 72 |
["python", "-E", "-m", "pip", "uninstall", "-y", "build", "colorama"], |
| 73 |
] |
| 74 |
|
| 75 |
[env.dev] |
| 76 |
description = "generate a DEV environment" |
| 77 |
package = "editable" |
| 78 |
deps = ["virtualenv>=20.0.34"] |
| 79 |
commands = [ |
| 80 |
["python", "-m", "pip", "list", "--format=columns"], |
| 81 |
["python", "-c", "import sys; print(sys.executable)"], |
| 82 |
] |
| 83 |
dependency_groups = ["docs", "test"] |
| 84 |
|
| 85 |
[env.coverage] |
| 86 |
description = "combine coverage from test environments" |
| 87 |
skip_install = true |
| 88 |
parallel_show_output = true |
| 89 |
dependency_groups = ["coverage"] |
| 90 |
pass_env = ["DIFF_AGAINST"] |
| 91 |
set_env = {} |
| 92 |
commands = [ |
| 93 |
["-", "coverage", "combine", "{toxworkdir}"], |
| 94 |
["coverage", "report", "--skip-covered", "--show-missing", "-i"], |
| 95 |
["coverage", "xml", "-o", "{toxworkdir}/coverage.xml", "-i"], |
| 96 |
["coverage", "html", "-d", "{toxworkdir}/htmlcov", "-i"], |
| 97 |
["python", "-m", "diff_cover.diff_cover_tool", "--compare-branch", "{env:DIFF_AGAINST:origin/main}", "{toxworkdir}/coverage.xml"], |
| 98 |
] |
| 99 |
depends = [ |
| 100 |
"path", |
| 101 |
{ product = [{ prefix = "3.", start = 10, stop = 15 }]}, |
| 102 |
{ product = [{ prefix = "pypy3.", start = 10, stop = 11 }]}, |
| 103 |
{ product = [{ prefix = "min-3.", start = 10, stop = 15 }]}, |
| 104 |
{ product = [{ prefix = "min-pypy3.", start = 10, stop = 11 }]}, |
| 105 |
] |
| 106 |
|
| 107 |
[env.bump] |
| 108 |
description = "bump versions, pass major/minor/patch" |
| 109 |
skip_install = true |
| 110 |
set_env = {} |
| 111 |
commands = [["bump-my-version", "bump", { replace = "posargs", extend = true }]] |
| 112 |
dependency_groups = ["bump"] |
| 113 |
|
| 114 |
[env.release] |
| 115 |
description = "create a release (commit, tag, and push)" |
| 116 |
skip_install = true |
| 117 |
change_dir = "{toxinidir}/tasks" |
| 118 |
commands = [["python", "release.py", { replace = "posargs", extend = true }]] |
| 119 |
dependency_groups = ["release"] |