[tox]
envlist = typing,pylint,docs,twinecheck,pre-commit,py39,py310,py311,py312,py313,py314,pypy3.11

[testenv]
usedevelop = True
deps =
    -r{toxinidir}/tests/requirements.txt
commands = py.test --cov=parsel --cov-report=xml {posargs:docs parsel tests}

[testenv:typing]
deps =
    {[testenv]deps}
    types-jmespath==1.1.0.20260124
    types-lxml==2026.1.1
    types-psutil==7.2.1.20260116
    py==1.11.0
    mypy==1.19.1
commands =
    mypy {posargs:parsel tests}

[testenv:pylint]
deps =
    {[testenv]deps}
    pylint==4.0.4
commands =
    pylint docs parsel tests

[docs]
changedir = docs
deps = -rdocs/requirements.txt

[testenv:docs]
changedir = {[docs]changedir}
deps = {[docs]deps}
# No -W in LaTeX, because ReadTheDocs does not use it either, and there are
# image conversion warnings that cannot be addressed in ReadTheDocs
commands =
    sphinx-build -W -b html . {envtmpdir}/html
    sphinx-build -b latex . {envtmpdir}/latex
    sphinx-build -b epub . {envtmpdir}/epub

[testenv:twinecheck]
basepython = python3
deps =
    twine==6.2.0
    build==1.4.0
commands =
    python -m build --sdist
    twine check dist/*

[testenv:pre-commit]
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure
skip_install = true

[testenv:min-deps]
description = Test with pinned minimum dependency versions
basepython = python3.10
deps =
    {[testenv]deps}
    cssselect==1.2.0
    jmespath==1.0.0
    lxml==5.1.0
    packaging==23.0
    w3lib==1.19.0
usedevelop = True
commands = {[testenv]commands}
