diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4be6b25..8add4b2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: check-useless-excludes - repo: https://github.com/ComPWA/policy - rev: 0.5.8 + rev: 0.5.10 hooks: - id: check-dev-files args: @@ -99,6 +99,6 @@ repos: )$ - repo: https://github.com/astral-sh/uv-pre-commit - rev: 0.5.15 + rev: 0.5.16 hooks: - id: uv-lock diff --git a/.taplo.toml b/.taplo.toml index 0db1df7..71fcb1b 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index b82dc5a..1317840 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -150,98 +150,100 @@ in_place = true sort_first = [ "build-system", "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] -envlist = - docnb-force, - linkcheck, - sty, -skip_install = True -skip_missing_interpreters = True -skipsdist = True - -[testenv] -passenv = * - -[testenv:doc] -allowlist_externals = - sphinx-build -commands = - sphinx-build \ - --keep-going \ - -b html \ - -T \ - -W \ - docs/ docs/_build/html -description = Build documentation as website -passenv = * -setenv = - PYTHONWARNINGS = - -[testenv:docnb] -base = doc -description = {[testenv:doc]description} with cached notebook execution -setenv = - {[testenv:doc]setenv} - EXECUTE_NB = yes - -[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/ \ - --open-browser \ - --watch=docs \ - docs/ docs/_build/html -description = Set up a server to directly preview changes to the HTML pages -passenv = * -setenv = - PYTHONWARNINGS = - -[testenv:docnblive] -base = doclive -description = {[testenv:doclive]description} with cached notebook execution -setenv = - {[testenv:doclive]setenv} - EXECUTE_NB = yes - -[testenv:linkcheck] -allowlist_externals = - sphinx-build -base = doc -commands = - sphinx-build \ - -b linkcheck \ - -T \ - docs/ docs/_build/linkcheck -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 - -[testenv:sty] -allowlist_externals = - pre-commit -commands = - pre-commit run --all-files {posargs} -description = Perform all linting, formatting, and spelling checks -""" +env_list = [ + "docnb-force", + "linkcheck", + "sty", +] +no_package = true +requires = ["tox>=4.21.0"] +skip_install = true +skip_missing_interpreters = true + +[tool.tox.env_run_base] +pass_env = ["*"] + +[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 as website" +set_env.PYTHONWARNINGS = "" + +[tool.tox.env.doclive] +allowlist_externals = ["sphinx-autobuild"] +commands = [ + [ + "sphinx-autobuild", + "--ignore=docs/_build/", + "--open-browser", + "--watch=docs", + "docs/", + "docs/_build/html", + ], +] +description = "Set up a server to directly preview changes to the HTML pages" +set_env.PYTHONWARNINGS = "" + +[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 = [ + {replace = "ref", of = ["tool.tox.env.doc.set_env"]}, + {EXECUTE_NB = "yes"}, +] + +[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 = [ + {replace = "ref", of = ["tool.tox.env.doc.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 = [ + {replace = "ref", of = ["tool.tox.env.doclive.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)" +set_env.PYTHONWARNINGS = "" + +[tool.tox.env.nb] +allowlist_externals = ["pytest"] +commands = [["pytest", "{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" diff --git a/uv.lock b/uv.lock index 11ab6e2..8e20558 100644 --- a/uv.lock +++ b/uv.lock @@ -1920,11 +1920,11 @@ wheels = [ [[package]] name = "setuptools" -version = "75.7.0" +version = "75.8.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ac/57/e6f0bde5a2c333a32fbcce201f906c1fd0b3a7144138712a5e9d9598c5ec/setuptools-75.7.0.tar.gz", hash = "sha256:886ff7b16cd342f1d1defc16fc98c9ce3fde69e087a4e1983d7ab634e5f41f4f", size = 1338616 } +sdist = { url = "https://files.pythonhosted.org/packages/92/ec/089608b791d210aec4e7f97488e67ab0d33add3efccb83a056cbafe3a2a6/setuptools-75.8.0.tar.gz", hash = "sha256:c5afc8f407c626b8313a86e10311dd3f661c6cd9c09d4bf8c15c0e11f9f2b0e6", size = 1343222 } wheels = [ - { url = "https://files.pythonhosted.org/packages/4e/6e/abdfaaf5c294c553e7a81cf5d801fbb4f53f5c5b6646de651f92a2667547/setuptools-75.7.0-py3-none-any.whl", hash = "sha256:84fb203f278ebcf5cd08f97d3fb96d3fbed4b629d500b29ad60d11e00769b183", size = 1224467 }, + { url = "https://files.pythonhosted.org/packages/69/8a/b9dc7678803429e4a3bc9ba462fa3dd9066824d3c607490235c6a796be5a/setuptools-75.8.0-py3-none-any.whl", hash = "sha256:e3982f444617239225d675215d51f6ba05f845d4eec313da4418fdbb56fb27e3", size = 1228782 }, ] [[package]]