[tox]
envlist =
  validate
  linting


[testenv:validate]
skip_install = true
deps =
    validate-pyproject==0.24.1
    packaging==25.0
commands =
    validate-pyproject ./pyproject.toml


[testenv:docs]
skip_install = true
deps =
    -r {toxinidir}/docs/requirements.txt
    -r {toxinidir}/requirements.txt
commands =
    # generate `docs/source/api.rst` with module listing
    {envpython} ./generate_api_module_listing.py
    # regenerate autodoc stub pages
    sphinx-autogen docs/source/api.rst
    # build api docs
    sphinx-build -b html -d ../build/docs/doctrees docs/source ../build/docs/api/py {posargs}
setenv =
  PYTHONPATH = {toxinidir}/.


[testenv:mypy]
skip_install = true
deps =
    mypy==1.16.0
    types-urllib3==1.26.25.14
    types-certifi==2021.10.8.3
    trio-typing==0.10.0
commands =
    mypy --install-types {posargs}


[testenv:linting]
skip_install = true
deps =
    ruff==0.11.12
commands =
    ruff check --fix --show-fixes --exit-non-zero-on-fix .
    ruff format --exit-non-zero-on-format .
