Use build instead of setup.py
[mudpy.git] / tox.ini
1 # Copyright (c) 2016-2021 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 usedevelop = True
15 # TODO(fungi) Switch this to "error" once the following are solved
16 #
17 # py310... distutils.command.install raises DeprecationWarning "The
18 #   distutils.sysconfig module is deprecated, use sysconfig instead" but this
19 #   can't be matched by message because it contains a comma
20 # py310... importlib._bootstrap raises ImportWarning
21 #   "_SixMetaPathImporter.find_spec() not found; falling back to find_module()"
22 #   but this can't be matched by message for unknown reasons
23 # py310... pip._vendor.urllib3.connection and pip._vendor.urllib3.util.ssl_
24 #   both raise DeprecationWarning "ssl module: PROTOCOL_TLS is deprecated" but
25 #   this can't be matched by message because it contains a colon
26 # multiple callers raise DeprecationWarning "The distutils package is
27 #   deprecated and slated for removal in Python 3.12. Use setuptools or check
28 #   PEP 632 for potential alternatives"
29 # multiple callers raise DeprecationWarning "Creating a LegacyVersion has been
30 #   deprecated and will be removed in the next major release"
31 setenv =
32     PYTHONWARNINGS = error, ignore::DeprecationWarning:distutils.command.install, ignore::ImportWarning:importlib._bootstrap, ignore::DeprecationWarning:pip._vendor.urllib3.connection, ignore::DeprecationWarning:pip._vendor.urllib3.util.ssl_, 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
33     VIRTUALENV_CREATOR = venv
34 commands = mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
35
36 [testenv:bandit]
37 description = check for potential security risks in source code
38 deps = bandit
39 commands = bandit -r mudpy -x mudpy/tests {posargs}
40 usedevelop = False
41
42 [testenv:codespell]
43 description = find common spelling mistakes in code and documentation
44 deps = codespell
45 commands = codespell {posargs}
46 usedevelop = False
47
48 [testenv:demo]
49 description = start an interactive demo with the sample config
50 commands = mudpy {posargs}
51
52 [testenv:dist]
53 description = build release artifacts and check for conformance
54 allowlist_externals = rm
55 deps =
56     build
57     twine
58 commands =
59     rm -fr {toxinidir}/dist
60     python -m build
61     twine check --strict {toxinidir}/dist/*
62 usedevelop = False
63
64 [testenv:docs]
65 # Build an sdist into a temporary location so we'll have AUTHORS and ChangeLog
66 # files to include. Keep usedevelop on so that the project dependencies will be
67 # installed in the venv.
68 description = generate hypertext documentation
69 allowlist_externals = rm
70 deps =
71     build
72     sphinx
73 commands =
74     rm -fr {toxinidir}/doc/build
75     python -m build --outdir={toxinidir}/doc/build/dist --sdist
76     sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
77
78 [testenv:flake8]
79 description = style checks and static analysis of source code
80 deps =
81     flake8
82     flake8-bugbear
83 commands = flake8 {posargs}
84 usedevelop = False
85
86 [testenv:selftest_config]
87 description = run the selftest with the included sample config
88 commands = mudpy_selftest etc/mudpy.yaml
89
90 [testenv:yamllint]
91 # Run the selftest before checking YAML files so we'll be sure to also catch at
92 # least some which are generated by the application, making sure it creates
93 # them with the same style we enforce for those carried in the repository.
94 description = test data files for correct syntax and formatting
95 deps = yamllint
96 commands =
97     mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
98     yamllint --strict {posargs} .
99
100 [flake8]
101 show-source = True
102 exclude = .git, .tox, *lib/python*, *egg, build