| # SPDX-License-Identifier: MIT |
| |
| [tox] |
| min_version = 4.25.0 |
| env_list = |
| pre-commit, |
| py3{9-14}-tests, |
| py3{10-14}-mypy, |
| pypy3-tests, |
| # Mypy needs to run within the respective Python version |
| typing-{pyright,ty,pyrefly} |
| docs-{sponsors,doctests}, |
| changelog, |
| coverage-{combine,report} |
| |
| |
| [pkgenv] |
| pass_env = SETUPTOOLS_SCM_PRETEND_VERSION |
| |
| |
| [testenv] |
| runner = uv-venv-lock-runner |
| package = wheel |
| wheel_build_env = .pkg |
| dependency_groups = |
| tests: tests |
| mypy: mypy |
| commands = |
| tests: pytest {posargs:-n auto} |
| mypy: pytest -k test_mypy |
| mypy: mypy typing-examples |
| mypy: mypy src/attrs/__init__.pyi src/attr/__init__.pyi src/attr/_typing_compat.pyi src/attr/_version_info.pyi src/attr/converters.pyi src/attr/exceptions.pyi src/attr/filters.pyi src/attr/setters.pyi src/attr/validators.pyi |
| |
| [testenv:pypy3-tests] |
| dependency_groups = tests |
| commands = pytest tests/test_functional.py |
| |
| # Keep versions in-sync with coverage-combine. |
| [testenv:py3{9,10,14}-tests] |
| dependency_groups = cov |
| # Python 3.6+ has a number of compile-time warnings on invalid string escapes. |
| # PYTHONWARNINGS=d makes them visible during the tox run. |
| set_env = |
| COVERAGE_PROCESS_START={toxinidir}/pyproject.toml |
| PYTHONWARNINGS=d |
| commands = |
| coverage run -m pytest {posargs:-n auto} |
| |
| # Split combine/report in 2 to avoid excessive "Combined data file ..." output. |
| [testenv:coverage-combine] |
| # Keep base_python in-sync with .python-version-default |
| base_python = py314 |
| # Keep depends in-sync with testenv above that has the cov dependency group. |
| depends = py3{9,10,14}-tests |
| skip_install = true |
| dependency_groups = cov |
| commands = coverage combine |
| |
| [testenv:coverage-report] |
| # Keep base_python in-sync with .python-version-default |
| base_python = py314 |
| depends = coverage-combine |
| parallel_show_output = true |
| skip_install = true |
| dependency_groups = cov |
| commands = coverage report |
| |
| |
| [testenv:codspeed] |
| dependency_groups = benchmark |
| pass_env = |
| CODSPEED_TOKEN |
| CODSPEED_ENV |
| ARCH |
| PYTHONHASHSEED |
| PYTHONMALLOC |
| commands = pytest --codspeed -n auto bench/test_benchmarks.py |
| |
| |
| [testenv:docs-{build,doctests,linkcheck}] |
| runner = uv-venv-lock-runner |
| # Keep base_python in-sync with .readthedocs.yaml. |
| base_python = py313 |
| dependency_groups = docs |
| commands = |
| build: sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html |
| doctests: sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html |
| linkcheck: sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html |
| |
| [testenv:docs-watch] |
| package = editable |
| base_python = {[testenv:docs-build]base_python} |
| dependency_groups = docs-watch |
| deps = watchfiles |
| commands = |
| watchfiles \ |
| --ignore-paths docs/_build/ \ |
| 'sphinx-build -W -n --jobs auto -b html -d {envtmpdir}/doctrees docs docs/_build/html' \ |
| README.md \ |
| src \ |
| docs |
| |
| [testenv:docs-sponsors] |
| runner = uv-venv-runner |
| skip_install = true |
| description = Ensure sponsor logos are up to date. |
| deps = cogapp |
| commands = cog -rP README.md docs/index.md |
| |
| |
| [testenv:pre-commit] |
| runner = uv-venv-runner |
| skip_install = true |
| deps = prek |
| commands = prek run --all-files |
| |
| |
| [testenv:changelog] |
| dependency_groups = docs |
| skip_install = true |
| commands = |
| towncrier --version |
| towncrier build --version main --draft |
| |
| |
| [testenv:typing-pyright] |
| dependency_groups = pyright |
| commands = |
| pyright typing-examples/baseline.py |
| pytest tests/test_pyright.py -vv |
| |
| [testenv:typing-ty] |
| dependency_groups = ty |
| commands = ty check typing-examples/baseline.py |
| |
| [testenv:typing-pyrefly] |
| dependency_groups = pyrefly |
| commands = pyrefly check typing-examples/baseline.py |
| |
| |
| [testenv:docset] |
| runner = uv-venv-runner |
| deps = doc2dash |
| dependency_groups = docs |
| allowlist_externals = |
| rm |
| cp |
| tar |
| commands = |
| rm -rf attrs.docset attrs.tgz docs/_build |
| sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html |
| doc2dash --index-page index.html --icon docs/_static/docset-icon.png --icon-2x docs/_static/docset-icon@2x.png --online-redirect-url https://www.attrs.org/en/latest/ docs/_build/html |
| tar --exclude='.DS_Store' -cvzf attrs.tgz attrs.docset |