[tox]
envlist = coverage-clean,py{3.8,3.9,3.10,3.11,3.12,py3.8,3.9-nooptionals},coverage-report,flake8,isort,mypy

[testenv]
deps =
    coverage
    pytest
    attrs
    {py3.8,pypy3.8}: twisted
    py3.8: asgiref
    # See https://github.com/django/asgiref/issues/393 for why we need to pin asgiref for pypy
    pypy3.8: asgiref==3.6.0
commands = coverage run --parallel -m pytest {posargs}

[testenv:py3.9-nooptionals]
commands = coverage run --parallel -m pytest {posargs}

[testenv:coverage-clean]
deps = coverage
skip_install = true
commands = coverage erase

[testenv:coverage-report]
deps = coverage
skip_install = true
commands =
    coverage combine
    coverage report

[testenv:flake8]
deps =
    flake8==6.0.0
    flake8-docstrings==1.6.0
    flake8-import-order==0.18.2
skip_install = true
commands =
    flake8 prometheus_client/ tests/ setup.py

[testenv:isort]
deps =
    isort==5.10.1
skip_install = true
commands =
    isort --check prometheus_client/ tests/ setup.py

[testenv:mypy]
deps =
    pytest
    asgiref
    mypy==0.991
skip_install = true
commands =
    mypy --install-types --non-interactive prometheus_client/ tests/

[flake8]
ignore =
    D,
    E303,
    E402,
    E501,
    E722,
    E741,
    F821,
    F841,
    W291,
    W293,
    W503,
    E129,
    E731

per-file-ignores = prometheus_client/__init__.py:F401
import-order-style = google
application-import-names = prometheus_client

[isort]
force_alphabetical_sort_within_sections = True
force_sort_within_sections = True
include_trailing_comma = True
multi_line_output = 5
