-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtox.ini
215 lines (194 loc) · 5.41 KB
/
tox.ini
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
[tox]
minversion=3.15.1
envlist = clean,py38,py39,py310,py311,py312,py313,lint,lint-docs,docs
[testenv]
skip_missing_interpreters = true
passenv =
PYTHONWARNINGS
PYTHONDEVMODE
usedevelop = true
commands =
pytest {posargs} src/firewheel/tests/
[testenv:clean]
deps = coverage
skip_install = true
commands = coverage erase
# Eventually we can test with this once our dependencies update
#[testenv:py{38,39,310,311}]
#setenv =
# PYTHONWARNINGS=error
# PYTHONDEVMODE=1
# Autoformatter
[testenv:format]
basepython = python3
extras = format
commands =
ruff format {toxinidir}/src/firewheel
# Linters
[testenv:flake8]
basepython = python3
skip_install = true
deps =
flake8~=7.0.0
pydoclint[flake8]
commands =
flake8 {toxinidir}/src/firewheel/ {posargs}
[testenv:ruff]
basepython = python3
extras = format
commands =
ruff check {posargs}
[testenv:shell]
# This is currently broken with Python 3.12
# Until this is fixed, we will remove it from our
# CI testing: `tox -e shell -- logs/fw_cli/*.sh logs/fw_cli/*/*.sh`
# See: https://github.com/lovesegfault/beautysh/issues/248
basepython = python3
extras = format
commands =
beautysh --indent-size 4 --force-function-style fnpar --check {toxinidir}/install.sh {toxinidir}/src/firewheel/cli/completion/completion-template.sh {posargs}
[testenv:pre-commit]
basepython = python3
skip_install = true
deps = pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:type]
description = type check ourselves
skip_install = true
deps =
mypy
types-PyYAML
types-protobuf
passenv =
TERM
MYPY_FORCE_COLOR
MYPY_FORCE_TERMINAL_WIDTH
commands =
python -m mypy --config-file {toxinidir}/pyproject.toml {toxinidir}/src
[testenv:lint]
basepython = python3
passenv =
{[testenv:type]passenv}
extras = format
deps =
{[testenv:type]deps}
commands =
{[testenv:ruff]commands}
{[testenv:type]commands}
[testenv:{lint-docs,lint-docs-all}]
basepython = python3
extras = dev
deps =
{[testenv:flake8]deps}
commands =
firewheel docs {toxinidir}/docs/source/cli
doc8 {toxinidir}/docs/source
{[testenv:flake8]commands}
all: sphinx-build -E -W -b spelling {toxinidir}/docs/source/ {toxinidir}/docs/build/spelling
all: sphinx-build -E -n -b linkcheck {toxinidir}/docs/source/ {toxinidir}/docs/build/linkcheck
# Documentation
[testenv:{docs,docs-all}]
basepython = python3
changedir={toxinidir}/docs
extras = docs
deps =
firewheel-repo-base
firewheel-repo-linux
firewheel-repo-vyos
firewheel-repo-tutorials
firewheel-repo-layer2
firewheel-repo-ntp
firewheel-repo-dns
allowlist_externals=
/usr/bin/make
/bin/mkdir
commands =
/bin/mkdir -p source/model_components
/usr/bin/make html
all: make singlehtml
all: sphinx-build -M man source/cli build -c source
all: make latexpdf
# Generate Protobuf files
[testenv:protobuf]
basepython = python3
skip_install = true
changedir = {toxinidir}/src
deps =
grpcio
grpcio-tools
commands =
python -m grpc_tools.protoc -I . --python_out=. --pyi_out=. --grpc_python_out=. firewheel/lib/grpc/firewheel_grpc.proto
# Create a class diagram
[testenv:classdiag]
basepython = python3
allowlist_externals=
/usr/bin/dot
/bin/mv
/bin/rm
deps =
pylint
commands =
pyreverse --ignore tests firewheel
dot -O -Tpng classes.dot
dot -O -Tpng packages.dot
mv classes.dot.png {toxinidir}/docs/source/system/classes.png
mv packages.dot.png {toxinidir}/docs/source/system/packages.png
rm classes.dot
rm packages.dot
# Identify FIREWHEEL dependencies
[testenv:dependencies]
basepython = python3
extras = dev
deps =
pip-licenses
commands =
pip-licenses --with-system --with-description --with-urls --from=mixed --order=name --format=rst --output-file={toxinidir}/docs/source/install/prereqs/pip-dependencies.rst
[testenv:serve-docs]
basepython = python3
skip_install = true
changedir = docs/build/html
commands =
python -m http.server --bind 127.0.0.1 {posargs}
## Release tooling
[testenv:build]
basepython = python3
skip_install = true
deps =
build
commands =
python -m build
#[testenv:release]
#basepython = python3
#skip_install = true
#deps =
# {[testenv:build]deps}
# twine >= 1.5.0
#commands =
# {[testenv:build]commands}
# twine upload --skip-existing dist/*
## Flake8 Configuration
[flake8]
color = always
extend_ignore =
F841 ; Local variable never used. Use ruff instead.
E125 ; continuation line. Use ruff instead
E203 ; whitespace before ':'. Use ruff instead
E501 ; line too long. Use ruff for this.
DOC301 ; We should allow __init__() to have a docstring.
DOC203 ; Currently don't force return type annotations.
DOC108 ; But we don't force not having type hints
DOC201 ; Ignore until issue is solved: https://github.com/jsh9/pydoclint/issues/125
DOC501 ; Current issues with raise checking
DOC503 ; Current issues with raise checking
# See https://github.com/psf/black/blob/master/README.md#line-length for more details
max-line-length = 88
max-complexity = 40
exclude =
src/firewheel/lib/grpc/firewheel_grpc_pb2.py
src/firewheel/lib/grpc/firewheel_grpc_pb2_grpc.py
src/firewheel/control/utils/new_model_component.py
format = %(cyan)s%(path)s%(reset)s:%(bold)s%(yellow)s%(row)d%(reset)s:%(bold)s%(green)s%(col)d%(reset)s: %(bold)s%(red)s%(code)s%(reset)s %(text)s
# Options for pydoclint
style = google
arg-type-hints-in-signature = False