Skip to content

Commit d1c08b2

Browse files
deeenesclaude
andcommitted
Remove tox, add optional scripts/test-multi-py.py for multi-version testing
- Remove tox and tox-gh from test dependencies - Remove all [tool.tox*] configuration sections - Remove .tox from bandit exclude (keep in gitignore) - Add include_multiversion_testing option (default: no) - Add scripts/test-multi-py.py for local multi-version testing using uv - Add .venv-test-*/ to gitignore for test environments The new test-multi-py.py script provides a simpler alternative to tox: - Uses uv to create version-specific virtual environments - Supports parallel test execution with --parallel flag - Accepts pytest arguments after -- separator - Includes cleanup options for test environments GitHub Actions already runs tests directly via matrix builds, making tox redundant for CI purposes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent db9fc16 commit d1c08b2

File tree

6 files changed

+284
-110
lines changed

6 files changed

+284
-110
lines changed

cookiecutter.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
"no",
7373
"yes"
7474
],
75+
"include_multiversion_testing": [
76+
"no",
77+
"yes"
78+
],
7579
"__year": "{% now 'utc', '%Y' %}",
7680
"_extensions": [
7781
"cookiecutter.extensions.TimeExtension"

hooks/post_gen_project.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55

66
# Get the cookiecutter variables
77
include_security_workflow = '{{ cookiecutter.include_security_workflow }}'
8+
include_multiversion_testing = '{{ cookiecutter.include_multiversion_testing }}'
89

910
# Files/directories to remove based on options
1011
REMOVE_PATHS = []
1112

1213
if include_security_workflow == 'no':
1314
REMOVE_PATHS.append('.github/workflows/ci-security.yml')
1415

16+
if include_multiversion_testing == 'no':
17+
REMOVE_PATHS.append('scripts')
18+
1519

1620
def remove_path(path):
1721
"""Remove a file or directory if it exists."""

{{cookiecutter.project_slug}}/.github/workflows/ci-security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
- name: Install Bandit
1414
run: pip install bandit
1515
- name: Run Bandit
16-
run: bandit -r . --exclude venv,.venv,.tox --skip B101
16+
run: bandit -r . --exclude venv,.venv --skip B101

{{cookiecutter.project_slug}}/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ __pycache__/
1717
*.pyc
1818
*.kate-swp
1919
/.tox/
20+
/.venv-test-*/
2021
/.idea/
2122
/.pytest_cache/
2223
/.cache/

{{cookiecutter.project_slug}}/pyproject.toml

Lines changed: 1 addition & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ security = [
4747
tests = [
4848
"pytest>=6.0",
4949
"pytest-cov",
50-
"tox>=3.20.1",
51-
"tox-gh>=1.5.0",
5250
"coverage>=6.0",
5351
"codecov-cli>=10.2.0",
5452
"diff_cover",
@@ -63,7 +61,7 @@ Repository = "{{ cookiecutter.project_repo }}"
6361

6462

6563
[tool.bandit]
66-
exclude_dirs = [".venv", "venv", ".tox", "build", "dist"]
64+
exclude_dirs = [".venv", "venv", "build", "dist"]
6765
skips = [
6866
"B101" # Name: assert_used
6967
]
@@ -195,109 +193,3 @@ section-order = [
195193

196194
[tool.ruff.lint.pydocstyle]
197195
convention = "google"
198-
199-
[tool.tox]
200-
envlist = [
201-
"covclean",
202-
"lint",
203-
"py{39,310,311,312,313}",
204-
"coverage",
205-
"readme",
206-
"docs"
207-
]
208-
isolated_build = true
209-
min_version = "3.20.0"
210-
skip_missing_interpreters = true
211-
212-
[tool.tox.envs]
213-
base_python = [
214-
"py39: python3.9",
215-
"py310: python3.10",
216-
"py311: python3.11",
217-
"py312: python3.12",
218-
"py313: python3.13"
219-
]
220-
commands = [
221-
"pytest --cov --cov-append --cov-config={toxinidir}/.coveragerc --ignore docs/ {posargs:-vv {env:_PYTEST_TOX_POSARGS:}}"
222-
]
223-
deps = [
224-
".[tests]"
225-
]
226-
passenv = "TOXENV,CI,CODECOV_*,GITHUB_ACTIONS"
227-
platform = [
228-
"linux: linux",
229-
"macos: (macos|osx|darwin)"
230-
]
231-
usedevelop = true
232-
233-
[tool.tox.envs.clean-docs]
234-
allowlist_externals = ["rm"]
235-
changedir = "{toxinidir}/docs"
236-
commands = [
237-
"rm -rf site"
238-
]
239-
description = "Clean the documentation artifacts."
240-
skip_install = true
241-
242-
[tool.tox.envs.covclean]
243-
commands = [
244-
"coverage erase"
245-
]
246-
deps = [".[tests]"]
247-
description = "Clean coverage files."
248-
skip_install = true
249-
250-
[tool.tox.envs.coverage]
251-
commands = [
252-
"coverage report --omit=\"tox/*\"",
253-
"coverage xml --omit=\"tox/*\" -o {toxinidir}/coverage.xml",
254-
"diff-cover --compare-branch origin/main {toxinidir}/coverage.xml"
255-
]
256-
depends = "py{39,310,311,312,313}"
257-
deps = [".[tests]"]
258-
description = "Report the coverage difference."
259-
parallel_show_output = true
260-
skip_install = true
261-
262-
[tool.tox.envs.docs]
263-
allowlist_externals = ["uv"]
264-
commands = [
265-
"uv sync --extra docs",
266-
"uv run mkdocs build",
267-
"python -c 'import pathlib; print(f\"Documentation is available under:\", pathlib.Path(f\"{toxinidir}\") / \"site\" / \"index.html\")'"
268-
]
269-
description = "Build the documentation."
270-
skip_install = true
271-
272-
[tool.tox.envs.lint]
273-
commands = [
274-
"pre-commit run --all-files --show-diff-on-failure {posargs:}"
275-
]
276-
deps = [".[dev]"]
277-
description = "Perform linting."
278-
skip_install = true
279-
280-
[tool.tox.envs.py313]
281-
setenv = "_PYTEST_TOX_POSARGS=--log-cli-level=ERROR"
282-
283-
[tool.tox.envs.readme]
284-
allowlist_externals = ["uv"]
285-
commands = [
286-
"uv build --wheel --out-dir {envtmpdir}/build",
287-
"twine check {envtmpdir}/build/*"
288-
]
289-
deps = [".[dev]"]
290-
description = "Check if README renders on PyPI."
291-
skip_install = true
292-
293-
[tool.tox-gh-actions]
294-
env = [
295-
"py313: covclean, lint, coverage, readme, docs"
296-
]
297-
python = [
298-
"3.9: py39",
299-
"3.10: py310",
300-
"3.11: py311",
301-
"3.12: py312",
302-
"3.13: py313"
303-
]

0 commit comments

Comments
 (0)