|
| 1 | +[tox] |
| 2 | +description = Default tox environments list |
| 3 | +envlist = |
| 4 | + code-style |
| 5 | + doc-style-{linux,windows} |
| 6 | + doc-{links,html,pdf} |
| 7 | + dist |
| 8 | +skip_missing_interpreters = true |
| 9 | +isolated_build = true |
| 10 | +isolated_build_env = build |
| 11 | + |
| 12 | +[testenv] |
| 13 | +description = Checks for project testing with desired extras |
| 14 | +basepython = |
| 15 | + test39: python3.9 |
| 16 | + test310: python3.10 |
| 17 | + test311: python3.11 |
| 18 | + test312: python3.12 |
| 19 | + {style,doc,dist}: python3 |
| 20 | +passenv = |
| 21 | +setenv = |
| 22 | + PYTHONUNBUFFERED = yes |
| 23 | +deps = |
| 24 | + -r{toxinidir}/requirements/requirements_test.txt |
| 25 | +commands = |
| 26 | + pytest {toxinidir}/tests |
| 27 | + |
| 28 | +[testenv:code-style] |
| 29 | +description = Checks project code style |
| 30 | +skip_install = true |
| 31 | +deps = |
| 32 | + pre-commit |
| 33 | +commands = |
| 34 | + pre-commit install |
| 35 | + pre-commit run --all-files --show-diff-on-failure |
| 36 | + |
| 37 | +[testenv:doc-style-{linux,windows}] |
| 38 | +description = Checks project documentation style |
| 39 | +skip_install = true |
| 40 | +allowlist_externals = |
| 41 | + find |
| 42 | + vale |
| 43 | + bash |
| 44 | + cmd |
| 45 | +platform = |
| 46 | + linux: linux |
| 47 | + windows: win32 |
| 48 | +commands = |
| 49 | + linux: bash -c 'rst_files=$(find {toxinidir}/doc/source -type f -name "*.rst" ! -path "doc/source/api/*") && py_files=$(find {toxinidir}/examples -type f -name "*.py" ! -name "*_*") && vale_files="$rst_files $py_files" && vale sync --config="{toxinidir}/doc/.vale.ini" && vale --config="{toxinidir}/doc/.vale.ini" $rst_files' |
| 50 | + windows: cmd /c "for /r {toxinidir}\doc\source %i in (*.rst) do @echo %i | findstr /v /i \doc\source\api\ > tmp_rst_files.txt" |
| 51 | + windows: cmd /c "for /r {toxinidir}\examples %i in (*.py) do @echo %i | findstr /v /i *_* >> tmp_py_files.txt" |
| 52 | + windows: cmd /c "setlocal enabledelayedexpansion && for /f %i in (tmp_rst_files.txt) do @set vale_files=!vale_files! %i && for /f %i in (tmp_py_files.txt) do @set vale_files=!vale_files! %i && vale sync --config="{toxinidir}\doc\.vale.ini" && vale --config="{toxinidir}\doc\.vale.ini" !rst_files! && endlocal" |
| 53 | + |
| 54 | +[testenv:doc-{clean,links,html,pdf}] |
| 55 | +description = Check if documentation generates properly |
| 56 | +allowlist_externals = |
| 57 | + pdflatex |
| 58 | +setenv = |
| 59 | + SOURCE_DIR = doc/source |
| 60 | + BUILD_DIR = doc/_build |
| 61 | + STATIC_DIR = doc/source/_static |
| 62 | + SPHINX_APIDOC_OPTIONS=inherited-members |
| 63 | + links: BUILDER = linkcheck |
| 64 | + html: BUILDER = html |
| 65 | + pdf: BUILDER = latex |
| 66 | + links,html,pdf: BUILDER_OPTS = --color -v -j auto -W --keep-going |
| 67 | +deps = |
| 68 | + -r{toxinidir}/requirements/requirements_docs.txt |
| 69 | +commands = |
| 70 | + # Remove rendered documentation and additional static files |
| 71 | + clean: python -c "import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)" "{toxinidir}/{env:BUILD_DIR}" |
| 72 | + clean: python -c "import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)" "{toxinidir}/{env:STATIC_DIR}/artifacts" |
| 73 | + |
| 74 | + # Render documentation with desired builder |
| 75 | + links,html,pdf: sphinx-apidoc -o {toxinidir}/doc/source/api {toxinidir}/src/ansys {toxinidir}/src/ansys/dpf/core/log.py \ |
| 76 | + {toxinidir}/src/ansys/dpf/core/help.py {toxinidir}/src/ansys/dpf/core/mapping_types.py {toxinidir}/src/ansys/dpf/core/ipconfig.py \ |
| 77 | + {toxinidir}/src/ansys/dpf/core/field_base.py {toxinidir}/src/ansys/dpf/core/cache.py {toxinidir}/src/ansys/dpf/core/misc.py \ |
| 78 | + {toxinidir}/src/ansys/dpf/core/check_version.py {toxinidir}/src/ansys/dpf/core/operators/build.py {toxinidir}/src/ansys/dpf/core/operators/specification.py \ |
| 79 | + {toxinidir}/src/ansys/dpf/core/vtk_helper.py {toxinidir}/src/ansys/dpf/core/label_space.py {toxinidir}/src/ansys/dpf/core/examples/python_plugins/* \ |
| 80 | + {toxinidir}/src/ansys/dpf/core/examples/examples.py {toxinidir}/src/ansys/dpf/gate/* {toxinidir}/src/ansys/dpf/gatebin/* {toxinidir}/src/ansys/grpc/dpf/* \ |
| 81 | + {toxinidir}/src/ansys/dpf/core/property_fields_container.py \ |
| 82 | + -f --implicit-namespaces --separate --no-headings |
| 83 | + links,html,pdf: sphinx-build -d "{toxworkdir}/doc_doctree" {env:SOURCE_DIR} "{toxinidir}/{env:BUILD_DIR}/{env:BUILDER}" {env:BUILDER_OPTS} -b {env:BUILDER} |
| 84 | + |
| 85 | + # PDF documentation |
| 86 | + pdf: pdflatex -interaction=nonstopmode -output-directory="{toxinidir}/{env:BUILD_DIR}/{env:BUILDER}" {toxinidir}/{env:BUILD_DIR}/{env:BUILDER}/ansys-dpf-core.tex |
| 87 | + |
0 commit comments