-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtox.ini
More file actions
169 lines (163 loc) · 5.09 KB
/
tox.ini
File metadata and controls
169 lines (163 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# tox configuration <https://tox.readthedocs.io/en/latest/config.html>
[tox]
envlist =
docs,
lint,
py310,
py314,
pypy3
isolated_build = true
[testenv]
# Note: Can't use -r in deps with isolated_build = true. Use commands_pre.
# See https://github.com/tox-dev/tox/issues/1085
# This is a hack which seems preferable to duplicating dependency package specs
commands_pre = pip install --group test
# Note: --cov= source in tox virtualenv <https://stackoverflow.com/a/59072005>
# Note: If packagename.py is a file, use --cov=packagename since --cov= needs a
# dir (with __init__.py) or module name <https://stackoverflow.com/a/55338611>
commands = python -bb -m pytest --cov={envsitepackagesdir}{/}packagename {posargs}
extras = argcomplete
[testenv:py310]
# Same as above, additionally enable EncodingWarning and ignore it by default.
# pytest filterwarnings in pyproject makes it throw for code in this project.
# https://docs.python.org/3/library/io.html#io-encoding-warning
commands = python -bb -X warn_default_encoding -Wignore::EncodingWarning -m pytest --cov={envsitepackagesdir}{/}packagename {posargs}
[testenv:docs]
commands_pre = pip install --group docs
commands =
sphinx-build -nW -j auto docs docs/_build
[testenv:lint]
commands_pre =
pip install --group dev
commands =
ruff check
mypy .
flake8
# FIXME: Want to lint all .py files in project. See:
# https://stackoverflow.com/q/36873096
# https://github.com/PyCQA/pylint/issues/352
# Could use https://github.com/MasterOdin/pylint_runner once pyproject.toml
# is supported: https://github.com/MasterOdin/pylint_runner/pull/14
# List files and top-level packages/directories explicitly for now.
pylint docs src tests
isort --check --diff .
bandit -c pyproject.toml -f txt -r .
pyroma --min 10 .
vulture --exclude */docs/*,*/tests/*,*/.tox/*,*/.venv*/* .
ruff format --check --diff .
# Flake8 Configuration
# https://flake8.pycqa.org/en/latest/user/configuration.html
#
# TODO: Move to pyproject.toml if/when supported
# https://github.com/PyCQA/flake8/issues/234#issuecomment-812800722
[flake8]
exclude =
*.egg,
.eggs,
.git,
.tox,
.venv,
.vulture,
__pycache__,
build,
dist,
ignore =
# Line break before binary operator
W503,
max-line-length = 80
multiline-quotes = """
per-file-ignores =
# Don't require doc comments for test members
test_*.py:D101,D102,D103,D105,D107
# Configure reST directives/roles for flake8-rst-docstrings
# https://github.com/peterjc/flake8-rst-docstrings/pull/16
# Note: Can get directives/roles from sphinx based on code from
# https://github.com/peterjc/flake8-rst-docstrings/issues/7#issuecomment-438788459
# Note: Modified to match both default domain and explicit py domain
# https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html
#
# from sphinx.application import Sphinx
# s = Sphinx('.', None, '/tmp', '.', 'html')
# domains = s.registry.domains.values()
# print('rst-directives =\n '
# + ',\n '.join(sorted({dr + ', py:' + dr for d in domains for dr in d.directives}))
# + ',\nrst-roles =\n '
# + ',\n '.join(sorted({r + ', py:' + r for d in domains for r in d.roles})))
rst-directives =
alias, py:alias,
attribute, py:attribute,
class, py:class,
classmethod, py:classmethod,
cmdoption, py:cmdoption,
concept, py:concept,
currentmodule, py:currentmodule,
data, py:data,
decorator, py:decorator,
decoratormethod, py:decoratormethod,
directive, py:directive,
directive:option, py:directive:option,
enum, py:enum,
enum-class, py:enum-class,
enum-struct, py:enum-struct,
enumerator, py:enumerator,
envvar, py:envvar,
exception, py:exception,
function, py:function,
glossary, py:glossary,
macro, py:macro,
member, py:member,
method, py:method,
module, py:module,
namespace, py:namespace,
namespace-pop, py:namespace-pop,
namespace-push, py:namespace-push,
option, py:option,
productionlist, py:productionlist,
program, py:program,
property, py:property,
role, py:role,
staticmethod, py:staticmethod,
struct, py:struct,
type, py:type,
union, py:union,
var, py:var,
rst-roles =
any, py:any,
attr, py:attr,
class, py:class,
concept, py:concept,
const, py:const,
data, py:data,
dir, py:dir,
doc, py:doc,
enum, py:enum,
enumerator, py:enumerator,
envvar, py:envvar,
exc, py:exc,
expr, py:expr,
func, py:func,
keyword, py:keyword,
macro, py:macro,
member, py:member,
meth, py:meth,
mod, py:mod,
numref, py:numref,
obj, py:obj,
option, py:option,
ref, py:ref,
role, py:role,
struct, py:struct,
term, py:term,
texpr, py:texpr,
token, py:token,
type, py:type,
union, py:union,
var, py:var
# pycodestyle Configuration
# https://pycodestyle.pycqa.org/en/latest/intro.html#configuration
#
# TODO: Move to pyproject.toml if/when supported
# https://github.com/PyCQA/pycodestyle/issues/813
# https://github.com/PyCQA/pycodestyle/pull/1223
[pycodestyle]
max_line_length = 80