From 9716b9ea8dabdfffa2fa64d5a7ae27028155b777 Mon Sep 17 00:00:00 2001
From: Hannes Feldt <feldt@astron.nl>
Date: Tue, 11 Mar 2025 13:53:27 +0100
Subject: [PATCH] fixes

---
 {{cookiecutter.project_slug}}/pyproject.toml | 65 ++++++++++++++++++++
 {{cookiecutter.project_slug}}/tox.ini        | 65 --------------------
 2 files changed, 65 insertions(+), 65 deletions(-)
 delete mode 100644 {{cookiecutter.project_slug}}/tox.ini

diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml
index 3eefe30..8018bc0 100644
--- a/{{cookiecutter.project_slug}}/pyproject.toml
+++ b/{{cookiecutter.project_slug}}/pyproject.toml
@@ -62,3 +62,68 @@ exclude = [
 [tool.ruff.lint]
 ignore = ["E203"]
 
+
+[tool.tox]
+# Generative environment list to test all supported Python versions
+requires = ["tox>=4.21"]
+env_list = ["fix", "coverage", "lint", "format", "py{13, 12, 11, 10}"]
+requires = ["tox-ignore-env-name-mismatch >= 0.2.0"]
+
+[tool.tox.env_run_base]
+package = "editable"
+deps = [
+    "-r{toxinidir}/requirements.txt",
+    "-r{toxinidir}/tests/requirements.txt"]
+set_env = { LANGUAGE = "en_US", LC_ALL = "en_US.UTF-8", PYTHONWARNINGS = "default::DeprecationWarning", DYNAMIC_VERSION_SOURCE= "{toxinidir}" }
+commands = [["python", "--version"], ["python", "-m", "pytest", "tests/{posargs}"]]
+
+[tool.tox.env.fix]
+description = "format the code base to adhere to our styles, and complain about what we cannot do automatically"
+skip_install = true
+deps = ["pre-commit-uv>=4.1.1"]
+commands = [["pre-commit", "run", "--all-files", "--show-diff-on-failure"]]
+
+[tool.tox.env.coverage]
+commands = [
+    ["python", "--version"],
+    ["python", "-m", "pytest", "--cov-report", "term", "--cov-report", "xml", "--cov-report", "html", "--cov={{cookiecutter.project_slug}}", "tests/{posargs}"]]
+
+# Command prefixes to reuse the same virtualenv for all linting jobs.
+[tool.tox.env.lint]
+deps = [
+    "ruff",
+    "-r{toxinidir}/tests/requirements.txt"]
+commands = [
+    ["python", "-m", "ruff", "--version"],
+    ["python", "-m", "ruff", "check", { replace = "posargs", default = ["{{cookiecutter.project_slug}}", "tests"], extend = true }]
+]
+
+[tool.tox.env.format]
+deps = [
+    "ruff",
+    "-r{toxinidir}/tests/requirements.txt"]
+commands = [
+    ["python", "-m", "ruff", "format", "-v", { replace = "posargs", default = ["{{cookiecutter.project_slug}}", "tests"], extend = true }]
+]
+
+[tool.tox.env.docs]
+deps = [
+    "-r{toxinidir}/requirements.txt",
+    "-r{toxinidir}/docs/requirements.txt"]
+# unset LC_ALL / LANGUAGE from testenv, would fail sphinx otherwise
+set_env = ""
+changedir = "{tox_root}"
+commands = [
+    ["python", "docs/cleanup.py"],
+    ["sphinx-build", "-b", "html", "docs/source", "docs/build/html"]
+]
+
+[tool.tox.env.build-local]
+package = "wheel"
+deps = ["-r{toxinidir}/build-requirements.txt"]
+commands = [["python", "-m", "build"]]
+
+[tool.tox.env.build-ci-linux]
+package = "wheel"
+deps = ["-r{toxinidir}/build-requirements.txt"]
+commands = [["python", "-m", "cibuildwheel", "--platform", "linux", "--output-dir", "dist"]]
diff --git a/{{cookiecutter.project_slug}}/tox.ini b/{{cookiecutter.project_slug}}/tox.ini
deleted file mode 100644
index 37d15ba..0000000
--- a/{{cookiecutter.project_slug}}/tox.ini
+++ /dev/null
@@ -1,65 +0,0 @@
-[tox]
-# Generative environment list to test all supported Python versions
-envlist = py3{9,10,11,12,13},black,pep8,pylint
-min_version = 4.3.3
-requires =
-    tox-ignore-env-name-mismatch >= 0.2.0
-
-[testenv]
-package = sdist  # 'Source' package required for binary extension
-use_develop = False  # use_develop implies 'editable' package, not possible
-
-setenv =
-    PYTHONWARNINGS=default::DeprecationWarning
-    DYNAMIC_VERSION_SOURCE={toxinidir}
-deps =
-    -r{toxinidir}/requirements.txt
-    -r{toxinidir}/tests/requirements.txt
-commands =
-    {envpython} --version
-    {envpython} -m pytest tests/{posargs}
-
-[testenv:coverage]
-commands =
-    {envpython} --version
-    {envpython} -m pytest --cov-report term --cov-report xml --cov-report html --cov={{cookiecutter.project_slug}} tests/{posargs}
-
-# Use generative name and command prefixes to reuse the same virtualenv
-# for all linting jobs.
-[testenv:{pep8,black,pylint,format}]
-usedevelop = False
-envdir = {toxworkdir}/linting
-commands =
-    pep8: {envpython} -m flake8 --version
-    pep8: {envpython} -m flake8 --exclude=_version.py --max-line-length 88 --extend-ignore=E203 src tests
-    black: {envpython} -m black --version
-    black: {envpython} -m black --check --diff src tests
-    pylint: {envpython} -m pylint --version
-    pylint: {envpython} -m pylint src tests
-    format: {envpython} -m autopep8 -v --max-line-length 88 -aa --in-place --recursive src
-    format: {envpython} -m autopep8 -v --max-line-length 88 -aa --in-place --recursive tests
-    format: {envpython} -m black -v src tests
-
-[testenv:docs]
-allowlist_externals =
-    sh
-; unset LC_ALL / LANGUAGE from testenv, would fail sphinx otherwise
-setenv =
-    PYTHONWARNINGS=default::DeprecationWarning
-    DYNAMIC_VERSION_SOURCE={toxinidir}
-deps =
-    -r{toxinidir}/requirements.txt
-    -r{toxinidir}/docs/requirements.txt
-changedir = {toxinidir}
-commands =
-    sh docs/cleanup.sh
-    sphinx-build -b html docs/source docs/build/html
-
-[testenv:{build-local,build-ci-linux}]
-deps =
-    -r{toxinidir}/tests/requirements.txt
-    -r{toxinidir}/build-requirements.txt
-skip_install = True
-commands =
-    build-local: {envpython} -m build
-    build-ci-linux: {envpython} -m cibuildwheel --platform linux --output-dir dist
-- 
GitLab