# Sample usage:
#   tox --sitepackages -e reformat,mypy,flake8
#   tox --sitepackages -e pydocstyle
#   tox --sitepackages -e mypy,flake8,pydocstyle
#
#   tox -e reformat,mypy,flake8
#   tox -e pydocstyle
#   tox -e mypy,flake8,pydocstyle

[main]
src_dir=
    notebooks
    src

[tox]
envlist = reformat,flake8,pydocstyle
skipsdist = True

[pydocstyle]
match = (?!setup).*\.py

[flake8]
max-line-length = 100
max-complexity = 10
exclude =
    build/
    .git
    __pycache__
    .*_cache
    examples/
    .tox
    data/
    refdata/
    test/data/
    test/refdata/
    venv/
ignore = E203, W503, E722
per-file-ignores = __init__.py:F401

[isort]
atomic = True
profile = black
line_length = 100
known_smepu=smepu
known_first_party=train,inference
sections=FUTURE,SMEPU,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
# Add heading before every import section
#import_heading_future=Future
#import_heading_stdlib=Standard library
#import_heading_firstparty=My stuff
#import_heading_thirdparty=Third party
#import_heading_localfolder=Local folder

[pytest]
addopts =
    # -vrA
    --durations=5
    --doctest-modules
    --doctest-continue-on-failure
    --ignore=setup.py
    --ignore=docs
    --ignore=src/my_nb_color.py
filterwarnings =
    # https://github.com/boto/boto3/issues/1968
    ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated

[coverage:report]
exclude_lines =
    pragma: no cover
    raise NotImplementedError
omit =
    src/a2rl/nbtools.py
# Ignore "_remote_module_non_scriptable.py not found" due to .pyc from PyTorch.
ignore_errors = True

[doc8]
max-line-length=100
ignore=D001

[testenv:reformat]
# Used during development (before committing) to format .py files.
deps =
    autoflake
    black
    isort >= 5
    pydocstyle
commands =
    autoflake --in-place --recursive --ignore-init-module-imports --remove-unused-variables --remove-all-unused-imports {[main]src_dir}
    isort --recursive {[main]src_dir}
    black {[main]src_dir}

[testenv:flake8]
deps =
    flake8
commands =
    flake8 {[main]src_dir}

[testenv:mypy]
deps =
    mypy
commands =
    mypy --install-types --non-interactive {[main]src_dir}

[testenv:pydocstyle]
deps =
    pydocstyle
commands =
    pydocstyle {[main]src_dir}