LiberTEM/LiberTEM

View on GitHub
tox.ini

Summary

Maintainability
Test Coverage
[tox]
envlist = py{39,310,311,312}{,-data}{,-nogpu}, notebooks

[testenv]
commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml {posargs:tests/}
    # win_tweaks.py depends on modules that are only available on Windows
    pytest --doctest-modules --ignore=src/libertem/common/win_tweaks.py --ignore=src/libertem/analysis/fullmatch.py src/libertem/
deps=
    -rtest_requirements.txt
    # Inject release candidates for testing
    -roverride_requirements.txt
    cuda101: cupy-cuda101
    cuda102: cupy-cuda102
    cuda110: cupy-cuda110
    cuda11x: cupy-cuda11x
    cuda12x: cupy-cuda12x
extras=
    bqplot
    hdf5plugin
setenv=
    # Using pytest in combination with tox on files that are part of the installed package
    # leads to collisions between the local source tree and the installed package when running tests.
    # See https://github.com/pytest-dev/pytest/issues/2042
    PY_IGNORE_IMPORTMISMATCH=1
    # Debug asyncio problems - has some perf overhead, so only enable if there is a problem
    # PYTHONASYNCIODEBUG=1
    # Dask configuration to reduce background load:
    DASK_DISTRIBUTED__ADMIN__TICK__INTERVAL=1000
    DASK_DISTRIBUTED__SCHEDULER__WORK_STEALING_INTERVAL=1000
    DASK_DISTRIBUTED__WORKER__PROFILE__CYCLE=60000
    DASK_DISTRIBUTED__WORKER__PROFILE__INTERVAL=30000
    NUMBA_FULL_TRACEBACKS=1
    NUMBA_BOUNDSCHECK=1
    LIBERTEM_IO_HDF5_TIMEOUT_DEBUG=30
    nogpu: CUDA_VISIBLE_DEVICES=""
passenv=
    DASK_SCHEDULER_ADDRESS
    TESTDATA_BASE_PATH
    NUMBA_*
    # HyperSpy expects this on Windows
    PROGRAMFILES
    RUNNER_ARCH
    RUNNER_OS
uv_seed=True

[testenv:web_api]
commands=
    pytest --durations=5 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg -m "web_api and not dist" --junitxml=junit.xml {posargs:tests/}
setenv=
    PYTHONASYNCIODEBUG=1
    {[testenv]setenv}

[testenv:numba_coverage]
commands=
    pytest --durations=5 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg -m with_numba --junitxml=junit.xml {posargs:tests/}
setenv=
    NUMBA_DISABLE_JIT=1

[testenv:py{39,310,311,312}-data,py{39,310,311,312}-data-cuda{101,102,110,11x,12x}]
deps=
    -rtest_requirements.txt
    hyperspy
    py{311,312}-data,py{311,312}-data-cuda{101,102,110,11x,12x}: orix
    stemtool
    mrcfile
    py{311,312}-data,py{311,312}-data-cuda{101,102,110,11x,12x}: rosettasciio
    pims
    scikit-image
    pint<0.20
    py{39,310,311,312}-data-cuda101: cupy-cuda101
    py{39,310,311,312}-data-cuda102: cupy-cuda102
    py{39,310,311,312}-data-cuda110: cupy-cuda110
    py{39,310,311,312}-data-cuda11x: cupy-cuda11x
    py{39,310,311,312}-data-cuda12x: cupy-cuda12x

commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml tests/io/datasets tests/executor/test_functional.py {posargs}

[testenv:notebooks,notebooks-cuda{101,102,110,11x,12x}]
deps=
    -rtest_requirements.txt
    nbval
    nbqa
    libertem-blobfinder[hdbscan]>=0.6
    hyperspy
    ipywidgets
    pyxem>=0.17
    rosettasciio
    scikit-image
    pint<0.20
    notebooks-cuda101: cupy-cuda101
    notebooks-cuda102: cupy-cuda102
    notebooks-cuda110: cupy-cuda110
    notebooks-cuda11x: cupy-cuda11x
    notebooks-cuda12x: cupy-cuda12x
extras=
    {[testenv]extras}

commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml --nbval --nbval-sanitize-with nbval_sanitize.cfg -p no:python --nbval-current-env {posargs:examples/}
passenv=
    TESTDATA_BASE_PATH
    # HyperSpy expects this on Windows
    PROGRAMFILES

[testenv:benchmark]
changedir={toxinidir}
commands=
    pytest --benchmark-enable --benchmark-warmup=on --benchmark-autosave --benchmark-storage "{toxinidir}/benchmark_results" -m "not compilation" {posargs:benchmarks/}
    pytest --benchmark-enable --benchmark-warmup=off --benchmark-autosave --benchmark-storage "{toxinidir}/benchmark_results" -m "compilation" {posargs:benchmarks/}

[testenv:benchmark-cuda{101,102,110,114}]
changedir={toxinidir}
commands=
    {[testenv:benchmark]commands}

[testenv:build_client]
changedir={toxinidir}
skipsdist=True
skip_install=True
passenv=APPDATA
deps=
commands=
    python setup.py build_client copy_client

[testenv:docs]
changedir={toxinidir}
basepython=python3
whitelist_externals=
    make
setenv=
    PYTHONPATH={toxinidir}
commands=
    python "{toxinidir}/scripts/cli-help"
    sphinx-autobuild -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html" --port 8008 {posargs} -j auto
deps=
    setuptools
    -rdocs_requirements.txt
    # Inject release candidates for doctest testing
    -roverride_requirements.txt
skipsdist=True

# just a non-watching version of the docs environment above, also building twice for bibs
[testenv:docs-build-ci]
changedir={toxinidir}
basepython=python3
setenv=
    PYTHONPATH={toxinidir}
commands=
    python "{toxinidir}/scripts/cli-help"
    # Two runs to get complete bibliography. The first one will throw warnings about missing
    # citations.
    sphinx-build -j auto -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    sphinx-build -j auto -W -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
deps=
    setuptools
    -rdocs_requirements.txt
    # Inject release candidates for doctest testing
    -roverride_requirements.txt
skipsdist=True
passenv=
    HOME

[testenv:docs-check]
changedir={toxinidir}
basepython=python3
setenv=
    PYTHONPATH={toxinidir}
commands=
    python "{toxinidir}/scripts/cli-help"
    # Two runs to get complete bibliography. The first one will throw warnings about missing
    # citations.
    sphinx-build -j auto -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    sphinx-build -j auto -W -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    sphinx-build -j auto -b doctest "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    # sphinx-build -b linkcheck "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    # cat docs/build/html/output.txt
deps=
    setuptools
    -rdocs_requirements.txt
skipsdist=True
whitelist_externals=
    cat
passenv=
    HOME
    PYTHONWARNINGS

[testenv:notebooks_gen]
deps=
    -rtest_requirements.txt
    libertem-blobfinder[hdbscan]>=0.6
    hyperspy
    pyxem>=0.17
    rosettasciio
    scikit-image
    # for hyperspy-integration.ipynb
    graphviz
    pyopencl
extras=
    bqplot
commands=
    jupyter nbconvert --ExecutePreprocessor.kernel_name=python3 --allow-errors --to notebook --output-dir "{toxinidir}/examples/generated/" --execute "{toxinidir}/examples/*.ipynb"
passenv=
    TESTDATA_BASE_PATH
    # HyperSpy expects this on Windows
    PROGRAMFILES
setenv=
    PYTHONWARNINGS=ignore
    DASK_DISTRIBUTED__LOGGING__DISTRIBUTED=60
    KMP_WARNINGS=0