[tox]
envlist =
    py{35,36,37,38,39}
    pypy3
    build
    clean
    cov
    docs
    fmt
    lint
    readme
    release

[testenv]
deps =
    .[test]
commands =
    pytest {posargs}

[testenv:build]
basepython = python3.8
deps =
    twine
    wheel
commands =
    python setup.py sdist bdist_wheel
    twine check dist/*
    python setup.py clean --all

[testenv:clean]
deps =
    cleanpy
commands =
    cleanpy --all --exclude-envs .

[testenv:cov]
deps =
    .[test]
    coverage[toml]
    pytest-cov
commands =
    pytest --cov {posargs:-vv}

[testenv:docs]
basepython = python3.8
deps =
    -r{toxinidir}/requirements/docs_requirements.txt
commands =
    python setup.py build_sphinx --source-dir=docs/ --build-dir=docs/_build --all-files

[testenv:fmt]
basepython = python3.8
deps =
    autoflake
    black
    isort[pyproject]
commands =
    black setup.py test pytablereader
    autoflake --in-place --recursive --remove-all-unused-imports --ignore-init-module-imports .
    isort --apply --recursive

[testenv:lint]
basepython = python3.7
deps =
    codespell
    #mypy>=0.761
    pylama
commands =
    python setup.py check
    #mypy pytablereader setup.py --ignore-missing-imports --show-error-context --show-error-codes --python-version 3.5
    codespell pytablereader docs examples test -q 2 --check-filenames --ignore-words-list te --exclude-file "test/data/python - Wiktionary.html"
    pylama

[testenv:readme]
changedir = docs
deps =
    path
    readmemaker>=1.0.0
commands =
    python make_readme.py

[testenv:release]
deps =
    releasecmd>=0.3.1,<1
commands =
    python setup.py release --sign {posargs}
