Various tox.ini improvements and cleanup
[mudpy.git] / tox.ini
1 # Copyright (c) 2016-2022 mudpy authors. Permission to use, copy,
2 # modify, and distribute this software is granted under terms
3 # provided in the LICENSE file distributed with this software.
4
5 [tox]
6 minversion = 3.18
7 envlist = bandit, codespell, dist, docs, flake8, yamllint, selftest_config, py3
8 skipsdist = True
9 ignore_basepython_conflict = True
10
11 [testenv]
12 description = run the functional selftest with optimized configuration
13 basepython = python3
14 # TODO(fungi) Switch this to "error" once the following are solved
15 #
16 # py311... Cython.Compiler.Main raises FutureWarning "Cython directive
17 #   'language_level' not set, using 2 for now (Py2). This will change in a
18 #   later release!" but this can't be matched by message because it has a comma
19 # py311... pip._vendor.pyparsing.core and pkg_resources._vendor.pyparsing raise
20 #   DeprecationWarning "module 'sre_constants' is deprecated" until
21 #   pyparsing>=3.0.8 is vendored into pip and pkg_resources
22 # py310... distutils.command.install raises DeprecationWarning "The
23 #   distutils.sysconfig module is deprecated, use sysconfig instead" but this
24 #   can't be matched by message because it contains a comma
25 # flake8... flake8.plugins.manager raises DeprecationWarning "SelectableGroups
26 #   dict interface is deprecated. Use select."
27 # multiple callers raise DeprecationWarning "The distutils package is
28 #   deprecated and slated for removal in Python 3.12. Use setuptools or check
29 #   PEP 632 for potential alternatives"
30 # multiple callers raise DeprecationWarning "Creating a LegacyVersion has been
31 #   deprecated and will be removed in the next major release"
32 # SetupTools raises
33 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning "setup.py
34 #   install is deprecated. Use build and pip and other standards-based tools."
35 #   but only the message can be matched because the exception is private
36 # SetupTools raises
37 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning
38 #   "setup_requires is deprecated. Supply build dependencies using PEP 517
39 #   pyproject.toml build-requires." but only the message can be matched because
40 #   the exception is private
41 # SetupTools raises
42 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning "easy_install
43 #   command is deprecated. Use build and pip and other standards-based tools."
44 #   but only the message can be matched because the exception is private
45 # pip._vendor.certifi.core and pip._vendor.pep517.in_process raise
46 #   DeprecationWarning "path is deprecated. Use files() instead. Refer to
47 #   https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy
48 #   for migration advice." but this can't be matched by message because it
49 #   contains a colon
50 setenv =
51     PYTHONWARNDFAULTENCODING = 1
52     PYTHONWARNINGS = error, ignore::FutureWarning:Cython.Compiler.Main, ignore::DeprecationWarning:distutils.command.install, ignore:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning, ignore:Creating a LegacyVersion has been deprecated and will be removed in the next major release:DeprecationWarning, ignore:SelectableGroups dict interface is deprecated. Use select.:DeprecationWarning:flake8.plugins.manager, ignore:setup.py install is deprecated. Use build and pip and other standards-based tools., ignore:easy_install command is deprecated. Use build and pip and other standards-based tools., ignore::DeprecationWarning:pip._vendor.certifi.core, ignore::DeprecationWarning:pip._vendor.pep517.in_process, ignore:module 'sre_constants' is deprecated:DeprecationWarning:pip._vendor.pyparsing.core, ignore:module 'sre_constants' is deprecated:DeprecationWarning:pkg_resources._vendor.pyparsing
53     PYTHONUTF8 = 1
54     VIRTUALENV_CREATOR = venv
55 commands = mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
56 deps = {toxinidir}
57
58 [testenv:bandit]
59 description = check for potential security risks in source code
60 skip_install = True
61 deps = bandit
62 commands = bandit -r mudpy -x mudpy/tests {posargs}
63
64 [testenv:codespell]
65 description = find common spelling mistakes in code and documentation
66 skip_install = True
67 deps = codespell
68 commands = codespell {posargs}
69
70 [testenv:demo]
71 description = start an interactive demo with the sample config
72 commands = mudpy {posargs}
73
74 [testenv:dist]
75 description = build release artifacts and check for conformance
76 skip_install = True
77 deps =
78     build
79     twine
80 commands =
81     {envpython} -c "import shutil; shutil.rmtree('{toxinidir}/dist', ignore_errors=True)"
82     {envpython} -m build
83     twine check --strict {toxinidir}/dist/*
84
85 [testenv:docs]
86 # Build an sdist into a temporary location so we'll have AUTHORS and ChangeLog
87 # files to include.
88 description = generate hypertext documentation
89 deps =
90     {[testenv]deps}
91     build
92     sphinx
93 commands =
94     {envpython} -c "import shutil; shutil.rmtree('{toxinidir}/doc/build', ignore_errors=True)"
95     {envpython} -m build --outdir={toxinidir}/doc/build/dist --sdist
96     sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
97
98 [testenv:flake8]
99 description = style checks and static analysis of source code
100 skip_install = True
101 deps = flake8-bugbear
102 commands = flake8 {posargs}
103
104 [testenv:selftest_config]
105 description = run the selftest with the included sample config
106 commands = mudpy_selftest etc/mudpy.yaml
107
108 [testenv:yamllint]
109 # Run the selftest before checking YAML files so we'll be sure to also catch at
110 # least some which are generated by the application, making sure it creates
111 # them with the same style we enforce for those carried in the repository.
112 description = test data files for correct syntax and formatting
113 deps =
114     {[testenv]deps}
115     yamllint
116 commands =
117     mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
118     yamllint --strict {posargs} .
119
120 [flake8]
121 show-source = True
122 exclude = .git, .tox, *lib/python*, *egg, build