# Reference: https://github.com/ethereum/ethereum-python-project-template/blob/master/tox.ini

# TODO: consider pypy3 support
[tox]
envlist =
    py{36,37}-test
    py37-interop
    lint
    docs

[isort]
combine_as_imports=False
force_sort_within_sections=True
include_trailing_comma=True
known_third_party=hypothesis,pytest,p2pclient,pexpect,factory
known_first_party=libp2p
line_length=88
multi_line_output=3
use_parentheses=True
force_grid_wrap=0
skip_glob=
    *_pb2*.py
    *.pyi

[flake8]
max-line-length = 100
exclude = venv*,.tox,docs,build,*_pb2*.py
ignore = E203, W503
max-complexity = 18
select = B,C,E,F,W,T4,B9

[testenv]
usedevelop=True
commands =
    test: pytest {posargs:tests/}
    docs: make build-docs
basepython =
    docs: python
    py37: python3.7
    py36: python3.6
extras =
    test
    docs: doc
whitelist_externals = make
deps =
passenv = CI TRAVIS TRAVIS_*

[testenv:lint]
basepython = python3
extras = lint
commands =
    mypy -p {toxinidir}/libp2p -p examples --config-file {toxinidir}/mypy.ini
    flake8 {toxinidir}/libp2p {toxinidir}/tests tests_interop examples setup.py
    black --check libp2p tests tests_interop examples setup.py
    isort --recursive --check-only --diff {toxinidir}/libp2p {toxinidir}/tests tests_interop examples setup.py
    docformatter --pre-summary-newline --check --recursive libp2p tests tests_interop examples setup.py

[testenv:py37-interop]
deps =
    p2pclient
    pexpect
passenv = CI TRAVIS TRAVIS_* GOPATH
extras = test
commands =
    pytest tests_interop/
basepython =
    py37: python3.7