[tox] minversion = 3.21 # relies on the correct version of Python installed envlist = ruff,tests,mypy,ty # https://github.com/tox-dev/tox/issues/20#issuecomment-247788333 # hack to prevent .tox from crapping to the project directory toxworkdir = {env:TOXWORKDIR_BASE:}{toxinidir}/.tox [testenv] # TODO how to get package name from setuptools? package_name = "orgparse" pass_env = # useful for tests to know they are running under ci CI CI_* # respect user's cache dirs to prevent tox from crapping into project dir PYTHONPYCACHEPREFIX MYPY_CACHE_DIR RUFF_CACHE_DIR set_env = # do not add current working directory to pythonpath # generally this is more robust and safer, prevents weird issues later on PYTHONSAFEPATH=1 # default is 'editable', in which tox builds wheel first for some reason? not sure if makes much sense package = uv-editable [testenv:ruff] skip_install = true dependency_groups = testing commands = {envpython} -m ruff check \ {posargs} [testenv:tests] dependency_groups = testing commands = # posargs allow test filtering, e.g. tox ... -- -k test_name {envpython} -m pytest \ --pyargs {[testenv]package_name} \ {posargs} [testenv:mypy] dependency_groups = testing commands = {envpython} -m mypy --no-install-types \ -p {[testenv]package_name} \ --txt-report .coverage.mypy \ --html-report .coverage.mypy \ # this is for github actions to upload to codecov.io # sadly xml coverage crashes on windows... so we need to disable it {env:CI_MYPY_COVERAGE} \ {posargs} [testenv:ty] dependency_groups = testing extras = optional deps = # any other dependencies (if needed) commands = {envpython} -m ty \ check \ {posargs}