[tox]
envlist = bandit-main, bandit-tests, black, black-check, copyright_check, docs, flake8, liccheck, mypy, py3.8, py3.7, py3.6
skipsdist = False
ignore_basepython_conflict = True

[testenv:py3.8]
basepython = python3.8
deps =
    Cython
    pytest==5.3.5
    pytest-cov==2.8.1
    pytest-asyncio==0.10.0
    pytest-randomly==3.2.1
    docker
    colorlog==4.1.0
    oef==0.8.1
    gym==0.15.6
    numpy==1.18.1
    openapi-core==0.13.2
    openapi-spec-validator==0.2.8

commands =
    pip install git+https://github.com/pytoolz/cytoolz.git#egg=cytoolz==0.10.1.dev0
    pip install -e .[all]
    pip install -i https://test.pypi.org/simple/ fetch-p2p-api==0.0.2
    pytest --doctest-modules aea packages/fetchai/protocols packages/fetchai/connections tests/ --cov-report=html --cov-report=xml --cov-report=term --cov=aea --cov=packages/fetchai/protocols --cov=packages/fetchai/connections {posargs}

[testenv:py3.7]
basepython = python3.7
deps =
    pytest==5.3.5
    pytest-cov==2.8.1
    pytest-asyncio==0.10.0
    pytest-randomly==3.2.1
    docker
    colorlog==4.1.0
    oef==0.8.1
    gym==0.15.6
    numpy==1.18.1
    tensorflow==1.14.0
    openapi-core==0.13.2
    openapi-spec-validator==0.2.8

commands =
    pip install -e .[all]
    pip install -i https://test.pypi.org/simple/ fetch-p2p-api==0.0.2
    pytest --doctest-modules aea packages/fetchai/protocols packages/fetchai/connections tests/ --cov-report=html --cov-report=xml --cov-report=term --cov=aea --cov=packages/fetchai/protocols --cov=packages/fetchai/connections {posargs}

[testenv:py3.6]
basepython = python3.6
deps =
    pytest==5.3.5
    pytest-cov==2.8.1
    pytest-asyncio==0.10.0
    pytest-randomly==3.2.1
    docker
    colorlog==4.1.0
    oef==0.8.1
    gym==0.15.6
    numpy==1.18.1
    tensorflow==1.14.0
    openapi-core==0.13.2
    openapi-spec-validator==0.2.8

commands =
    pip install -e .[all]
    pip install -i https://test.pypi.org/simple/ fetch-p2p-api==0.0.2
    pytest --doctest-modules aea packages/fetchai/protocols packages/fetchai/connections tests/ --cov-report=html --cov-report=xml --cov-report=term --cov=aea --cov=packages/fetchai/protocols --cov=packages/fetchai/connections {posargs}

[testenv:bandit-main]
deps = bandit==1.6.2
commands = bandit -s B101 -r aea packages scripts

[testenv:bandit-tests]
deps = bandit==1.6.2
commands = bandit -s B101 -r tests

[testenv:black]
deps = black==19.10b0
commands = black aea examples packages scripts tests

[testenv:black-check]
deps = black==19.10b0
commands = black aea examples packages scripts tests --check --verbose

[testenv:copyright_check]
commands = {toxinidir}/scripts/check_copyright_notice.py --directory {toxinidir}

[testenv:docs]
description = Build the documentation.
deps = markdown==3.2.1
       mkdocs==1.1
       mkdocs-material==4.6.3
       pymdown-extensions==6.3
       bs4==0.0.1
commands = pip3 install git+https://github.com/pugong/mkdocs-mermaid-plugin.git#egg=mkdocs-mermaid-plugin
           mkdocs build --clean

[testenv:docs-serve]
description = Run a development server for working on documentation.
deps = markdown==3.2.1
       mkdocs==1.1
       mkdocs-material==4.6.3
       pymdown-extensions==6.3
       bs4==0.0.1
commands = pip3 install git+https://github.com/pugong/mkdocs-mermaid-plugin.git#egg=mkdocs-mermaid-plugin
           mkdocs build --clean
           python -c 'print("###### Starting local server. Press Control+C to stop server ######")'
           mkdocs serve -a localhost:8080

[testenv:flake8]
deps = flake8==3.7.9
       flake8-bugbear==20.1.4
       flake8-docstrings==1.5.0
       flake8-import-order==0.18.1
       pydocstyle==3.0.0
commands = flake8 aea examples packages scripts tests

[testenv:liccheck]
deps = liccheck==0.4.0
commands = {toxinidir}/scripts/freeze_dependencies.py -o {envtmpdir}/requirements.txt
           liccheck -s strategy.ini -r {envtmpdir}/requirements.txt -l PARANOID

[testenv:mypy]
deps = mypy==0.761
commands = mypy aea packages tests scripts

[testenv:safety]
deps = safety==1.8.5
commands = safety check
