Skip to content

Commit

Permalink
DX: convert Tox config to native TOML
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Jan 8, 2025
1 parent 5e7bf08 commit 1b47cc1
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 102 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
".gitignore",
".pre-commit-config.yaml",
".prettierignore",
".taplo.toml",
".vscode/*",
"codecov.yml",
"docs/conf.py",
Expand Down
7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ compact_inline_tables = true
indent_string = " "
reorder_arrays = true
reorder_keys = true

[[rule]]
include = ["**/pyproject.toml"]
keys = ["tool.tox"]

[rule.formatting]
reorder_arrays = false
206 changes: 104 additions & 102 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -335,110 +335,112 @@ sort_first = [
"project",
"tool.setuptools",
"tool.setuptools_scm",
"tool.tox.env_run_base",
]
spaces_indent_inline_array = 4
trailing_comma_inline_array = true

[tool.tox]
legacy_tox_ini = """
[tox]
skip_install = True
skip_missing_interpreters=true
skipsdist = True
envlist =
cov,
docnb-force,
linkcheck,
sty,
[testenv]
allowlist_externals =
pytest
commands =
pytest {posargs:tests}
description = Run all fast unit tests
passenv = *
[testenv:cov]
allowlist_externals =
pytest
commands =
pytest {posargs:tests} \
--cov-fail-under=85 \
--cov-report=html \
--cov-report=xml \
--cov=boostcfg \
--cov=pawian
description = Compute the test coverage of all unit tests
[testenv:doc]
allowlist_externals =
sphinx-build
commands =
sphinx-build \
--builder=html \
--fail-on-warning \
--keep-going \
--show-traceback \
docs/ docs/_build/html
description = Build documentation and API through Sphinx
passenv = *
[testenv:docnb]
base = doc
description = {[testenv:doc]description} with cached notebook execution
setenv =
EXECUTE_NB =
[testenv:docnb-force]
base = doc
description = {[testenv:doc]description} with notebook execution (no cache)
setenv =
FORCE_EXECUTE_NB = yes
[testenv:doclive]
allowlist_externals =
sphinx-autobuild
commands =
sphinx-autobuild \
--ignore=docs/_build \
--ignore=docs/api \
--open-browser \
--port=0 \
--re-ignore docs/.*\\.inv \
--watch=docs \
--watch=src \
docs/ docs/_build/html
description = Set up a server to preview changes to the HTML pages live
passenv = *
[testenv:docnblive]
base = doclive
description = {[testenv:doclive]description} with cached notebook execution
setenv =
EXECUTE_NB = yes
[testenv:linkcheck]
allowlist_externals =
sphinx-build
commands =
sphinx-build \
--builder=linkcheck \
--show-traceback \
docs/ docs/_build/linkcheck
description = Check external links in the documentation (requires internet connection)
[testenv:nb]
allowlist_externals =
pytest
commands =
pytest --nbmake {posargs:docs}
description = Run all notebooks with pytest
[testenv:sty]
allowlist_externals =
pre-commit
commands =
pre-commit run --all-files {posargs}
description = Perform all linting, formatting, and spelling checks
"""
env_list = [
"cov",
"docnb-force",
"linkcheck",
"sty",
]
no_package = true
requires = ["tox>=4.21.0"]
skip_install = true
skip_missing_interpreters = true

[tool.tox.env_run_base]
allowlist_externals = ["pytest"]
commands = [["pytest", {replace = "posargs", extend = true}]]
description = "Run all fast unit tests"
pass_env = ["*"]

[tool.tox.env.cov]
allowlist_externals = ["pytest"]
commands = [
[
"pytest",
{replace = "posargs", extend = true},
"--cov-fail-under=85",
"--cov-report=html",
"--cov-report=xml",
"--cov=boostcfg",
"--cov=pawian",
],
]
description = "Compute the test coverage of all unit tests"

[tool.tox.env.doc]
allowlist_externals = ["sphinx-build"]
commands = [
[
"sphinx-build",
"--builder=html",
"--fail-on-warning",
"--keep-going",
"--show-traceback",
"docs/",
"docs/_build/html",
],
]
description = "Build documentation and API through Sphinx"

[tool.tox.env.doclive]
allowlist_externals = ["sphinx-autobuild"]
commands = [
[
"sphinx-autobuild",
"--ignore=docs/_build",
"--ignore=docs/api",
"--open-browser",
"--port=0",
"--re-ignore",
"docs/.*\\.inv",
"--watch=docs",
"--watch=src",
"docs/",
"docs/_build/html",
],
]
description = "Set up a server to preview changes to the HTML pages live"

[tool.tox.env.docnb]
base = ["tool.tox.env.doc", "tool.tox.env_run_base"]
description = "{[tool.tox.env.doc]description} with cached notebook execution"
set_env.EXECUTE_NB = ""

[tool.tox.env.docnb-force]
base = ["tool.tox.env.doc", "tool.tox.env_run_base"]
description = "{[tool.tox.env.doc]description} with notebook execution (no cache)"
set_env.FORCE_EXECUTE_NB = "yes"

[tool.tox.env.docnblive]
base = ["tool.tox.env.doclive", "tool.tox.env_run_base"]
description = "{[tool.tox.env.doclive]description} with cached notebook execution"
set_env.EXECUTE_NB = "yes"

[tool.tox.env.linkcheck]
allowlist_externals = ["sphinx-build"]
commands = [
[
"sphinx-build",
"--builder=linkcheck",
"--show-traceback",
"docs/",
"docs/_build/linkcheck",
],
]
description = "Check external links in the documentation (requires internet connection)"

[tool.tox.env.nb]
allowlist_externals = ["pytest"]
commands = [["pytest", "--nbmake", "{posargs:docs}"]]
description = "Run all notebooks with pytest"

[tool.tox.env.sty]
allowlist_externals = ["pre-commit"]
commands = [["pre-commit", "run", "--all-files", {replace = "posargs", extend = true}]]
description = "Perform all linting, formatting, and spelling checks"

0 comments on commit 1b47cc1

Please sign in to comment.