From fe52fef74fb24087c00a16976e664bd3aa4c52dd Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:16:06 +0200 Subject: [PATCH] DX: clean up `tox` configuration --- pyproject.toml | 172 +++++++++++++++---------------------------------- 1 file changed, 51 insertions(+), 121 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5befe44..5aba6b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,13 +118,12 @@ depends_on = ["docnb", "linkcheck", "sty"] [tool.pixi.feature.dev.tasks.doc] cmd = """ sphinx-build \ - --builder html \ + --builder=html \ --fail-on-warning \ --keep-going \ --show-traceback \ docs/ docs/_build/html """ -env = {FORCE_COLOR = "1", PYTHONWARNINGS = "", ZFIT_DISABLE_TF_WARNINGS = "1"} [tool.pixi.feature.dev.tasks.doclive] cmd = """ @@ -148,28 +147,23 @@ sphinx-autobuild \ --watch docs \ docs/ docs/_build/html """ -env = {FORCE_COLOR = "1", PYTHONWARNINGS = "", ZFIT_DISABLE_TF_WARNINGS = "1"} [tool.pixi.feature.dev.tasks.docnb] cmd = "pixi run doc" -env = {EXECUTE_NB = "yes", FORCE_COLOR = "1", PYTHONWARNINGS = "", TF_CPP_MIN_LOG_LEVEL = "3", ZFIT_DISABLE_TF_WARNINGS = "1"} [tool.pixi.feature.dev.tasks.docnb-force] cmd = "pixi run doc" -env = {FORCE_COLOR = "1", FORCE_EXECUTE_NB = "yes", PYTHONWARNINGS = "", TF_CPP_MIN_LOG_LEVEL = "3", ZFIT_DISABLE_TF_WARNINGS = "1"} [tool.pixi.feature.dev.tasks.docnblive] cmd = "pixi run doclive" -env = {EXECUTE_NB = "yes", FORCE_COLOR = "1", PYTHONWARNINGS = "", TF_CPP_MIN_LOG_LEVEL = "3", ZFIT_DISABLE_TF_WARNINGS = "1"} [tool.pixi.feature.dev.tasks.linkcheck] cmd = """ sphinx-build \ - --builder linkcheck \ + --builder=linkcheck \ --show-traceback \ docs/ docs/_build/linkcheck """ -env = {FORCE_COLOR = "1"} [tool.pixi.feature.dev.tasks.nb] cmd = "pytest --nbmake docs" @@ -397,170 +391,106 @@ trailing_comma_inline_array = true legacy_tox_ini = """ [tox] envlist = - doc, + docnb-force, + linkcheck, sty, skip_install = True skip_missing_interpreters = True skipsdist = True +[testenv] +passenv = * + [testenv:doc] allowlist_externals = sphinx-build commands = sphinx-build \ - --builder html \ + --builder=html \ + --fail-on-warning \ --keep-going \ - --show-traceback --fail-on-warning \ - docs/ docs/_build/html -description = - Build documentation and API through Sphinx -passenv = * -setenv = - FORCE_COLOR = 1 - PYTHONWARNINGS = - ZFIT_DISABLE_TF_WARNINGS = 1 - -[testenv:doclive] -allowlist_externals = - sphinx-autobuild -commands = - sphinx-autobuild \ - --open-browser \ - --re-ignore .*/.ipynb_checkpoints/.* \ - --re-ignore .*/__pycache__/.* \ - --re-ignore .*\\.gitignore \ - --re-ignore docs/.*\\.csv \ - --re-ignore docs/.*\\.gif \ - --re-ignore docs/.*\\.gv \ - --re-ignore docs/.*\\.inv \ - --re-ignore docs/.*\\.json \ - --re-ignore docs/.*\\.pickle \ - --re-ignore docs/.*\\.png \ - --re-ignore docs/.*\\.svg \ - --re-ignore docs/.*\\.yaml \ - --re-ignore docs/.*\\.yml \ - --re-ignore docs/_build/.* \ - --re-ignore docs/_static/exported_intensity_model.py \ - --watch docs \ + --show-traceback \ docs/ docs/_build/html -description = - Set up a server to directly preview changes to the HTML pages -passenv = * +description = Build documentation and API through Sphinx setenv = - FORCE_COLOR = 1 PYTHONWARNINGS = + TF_CPP_MIN_LOG_LEVEL = 3 ZFIT_DISABLE_TF_WARNINGS = 1 [testenv:docnb] -allowlist_externals = - sphinx-build -commands = - sphinx-build \ - --builder html \ - --keep-going \ - --show-traceback --fail-on-warning \ - docs/ docs/_build/html -description = - Build documentation through Sphinx WITH output of Jupyter notebooks -passenv = * +base = doc +description = {[testenv:doc]description} with cached notebook execution setenv = + {[testenv:doc]setenv} EXECUTE_NB = yes - FORCE_COLOR = 1 - PYTHONWARNINGS = - TF_CPP_MIN_LOG_LEVEL = 3 - ZFIT_DISABLE_TF_WARNINGS = 1 -[testenv:docnblive] +[testenv:docnb-force] +base = doc +description = {[testenv:doc]description} with notebook execution (no cache) +setenv = + {[testenv:doc]setenv} + FORCE_EXECUTE_NB = yes + +[testenv:doclive] allowlist_externals = sphinx-autobuild commands = sphinx-autobuild \ + --ignore=docs/_build/ \ + --ignore=docs/_static/exported_intensity_model.py \ --open-browser \ - --re-ignore .*/.ipynb_checkpoints/.* \ - --re-ignore .*/__pycache__/.* \ - --re-ignore .*\\.gitignore \ - --re-ignore docs/.*\\.csv \ - --re-ignore docs/.*\\.gif \ - --re-ignore docs/.*\\.gv \ - --re-ignore docs/.*\\.inv \ - --re-ignore docs/.*\\.json \ - --re-ignore docs/.*\\.pickle \ - --re-ignore docs/.*\\.png \ - --re-ignore docs/.*\\.svg \ - --re-ignore docs/.*\\.yaml \ - --re-ignore docs/.*\\.yml \ - --re-ignore docs/_build/.* \ - --re-ignore docs/_static/exported_intensity_model.py \ + --port=0 \ + --re-ignore='.*/__pycache__/.*' \ + --re-ignore='.*/.ipynb_checkpoints/.*' \ + --re-ignore='.*/.virtual_documents/.*' \ + --re-ignore='.*\\.csv' \ + --re-ignore='.*\\.gif' \ + --re-ignore='.*\\.gitignore' \ + --re-ignore='.*\\.gv' \ + --re-ignore='.*\\.inv' \ + --re-ignore='.*\\.json' \ + --re-ignore='.*\\.pickle' \ + --re-ignore='.*\\.png' \ + --re-ignore='.*\\.svg' \ + --re-ignore='.*\\.yaml' \ + --re-ignore='.*\\.yml' \ --watch docs \ docs/ docs/_build/html -description = - Set up a server to directly preview changes to the HTML pages -passenv = * +description = Set up a server to directly preview changes to the HTML pages setenv = - EXECUTE_NB = yes - FORCE_COLOR = 1 PYTHONWARNINGS = - TF_CPP_MIN_LOG_LEVEL = 3 ZFIT_DISABLE_TF_WARNINGS = 1 -[testenv:docnb-force] -allowlist_externals = - sphinx-build -commands = - sphinx-build \ - --builder html \ - --fail-on-warning \ - --keep-going \ - docs/ docs/_build/html -description = - Execute ALL Jupyter notebooks and build documentation with Sphinx -passenv = * +[testenv:docnblive] +base = doclive +description = {[testenv:doclive]description} with cached notebook execution setenv = - FORCE_COLOR = 1 - FORCE_EXECUTE_NB = yes - PYTHONWARNINGS = - TF_CPP_MIN_LOG_LEVEL = 3 - ZFIT_DISABLE_TF_WARNINGS = 1 - -[testenv:jcache] -allowlist_externals = - jcache -changedir = docs/_build -commands = - jcache {posargs:notebook list} -description = - Inspect Jupyter cache + {[testenv:doclive]setenv} + EXECUTE_NB = yes [testenv:linkcheck] allowlist_externals = sphinx-build commands = sphinx-build \ - --builder linkcheck \ + --builder=linkcheck \ --show-traceback \ docs/ docs/_build/linkcheck -description = - Check external links in the documentation (requires internet connection) -passenv = * -setenv = - FORCE_COLOR = 1 +description = Check external links in the documentation (requires internet connection) [testenv:nb] allowlist_externals = pytest commands = pytest {posargs:docs} -description = - Run all notebooks with pytest -passenv = * +description = Run all notebooks with pytest [testenv:sty] allowlist_externals = pre-commit commands = - pre-commit run {posargs} -a -description = - Perform all linting, formatting, and spelling checks + pre-commit run --all-files {posargs} +description = Perform all linting, formatting, and spelling checks setenv = SKIP = pyright """