[build-system]
requires = [ "setuptools" ]
build-backend = "setuptools.build_meta"


# =======================================
# tox
# =======================================
[tool.tox]
legacy_tox_ini = """
[tox]
skip_missing_interpreters = True
skipsdist = True
envlist =
    py{27,36,37,38,39,310,311,312,313,314}
    cov-report

[testenv]
deps =
    -rtests/requirements.txt
    setuptools
    -e .

setenv =
    COVERAGE_FILE = .coverage.{envname}
    SETUP_CEXT_REQUIRED = 1
passenv =
    CFLAGS
    CPPFLAGS
    LDFLAGS
    PKG_CONFIG_PATH
commands =
    inv test.local --coverage --no-coverage-report

[testenv:cov-report]
deps = -rtests/coverage.txt

setenv =
    COVERAGE_FILE = .coverage
commands =
    coverage erase
    coverage combine
    coverage report
    coverage html
    - python -c 'import sys, os; os.mkdir(sys.argv[1])' "docs/gcov"
    - gcovr --print-summary --html-details --output docs/gcov/index.html
"""


# =======================================
# Pytest
# =======================================
[tool.pytest.ini_options]
junit_family = "xunit2"
doctest_optionflags = "IGNORE_EXCEPTION_DETAIL ALLOW_UNICODE ALLOW_BYTES ELLIPSIS"
filterwarnings = [
    "error",
]


# =======================================
# Coverage
# =======================================
[tool.coverage.run]
branch = true

[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
    # Have to re-enable the standard pragma
    "pragma: no cover",

    # Don't complain about missing debug-only code:
    "if self\\.debug",

    # Don't complain if tests don't hit defensive assertion code:
    "raise NotImplementedError",

    # Don't complain if non-runnable code isn't run:
    "if 0:",
    "if __name__ == .__main__.:",
]

# Special part-branch exclusion
partial_branches = [
    # Re-enable standard pragma
    "pragma: no branch",
]

# Source files to exclude
omit = []

ignore_errors = true

[tool.coverage.html]
directory = "docs/coverage"


# =======================================
# Black
# =======================================
[tool.black]
skip-string-normalization = true
# skip-magic-trailing-comma = true
line-length = 78
# target-version = ['py313']
include='''
(
    pyliblinear/.*\.py
|   tests/.*\.py
|   tasks/.*\.py
)$
'''
extend-exclude='''
    tasks/_inv/shell.py
'''


# =======================================
# isort
# =======================================
[tool.isort]
profile = "black"
force_single_line = true

# vim: nowrap
