File: tox.ini

package info (click to toggle)
python-autobahn 22.7.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,404 kB
  • sloc: python: 38,356; javascript: 2,705; makefile: 905; ansic: 371; sh: 63
file content (263 lines) | stat: -rw-r--r-- 7,329 bytes parent folder | download
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
[tox]
skip_missing_interpreters = true
envlist =
    flake8
    coverage
    sphinx

    # CPython
    py37-{tw1910,tw203,tw221,twtrunk,asyncio}
    py38-{tw1910,tw203,tw221,twtrunk,asyncio}
    py39-{tw1910,tw203,tw221,twtrunk,asyncio}
    py310-{tw1910,tw203,tw221,twtrunk,asyncio}

    # PyPy
    pypy37-{tw1910,tw203,tw221,twtrunk,asyncio}
    pypy38-{tw1910,tw203,tw221,twtrunk,asyncio}


# MAP: GitHub Actions Python Name => Tox Env Name (for Python)
#
# when called without a specific environment ("-e"), detect the
# python version / get from GH action, and map to tox env
#
# https://github.com/ymyzk/tox-gh-actions
#
[gh-actions]
python =
    3.7: py37
    3.8: py38
    3.9: py39
    3.10: py310
    pypy-3.7: pypy37
    pypy-3.8: pypy38


[testenv]
deps =
    coverage
    pytest

    ; txaio
    git+https://github.com/crossbario/txaio

    ; twisted dependencies
    tw1910: twisted==19.10.0
    tw203: twisted==20.3.0
    tw221: twisted==22.1.0

    # twtrunk: https://github.com/twisted/twisted/archive/trunk.zip
    twtrunk: git+https://github.com/twisted/twisted
    {tw1910,tw203,tw221,twtrunk}: pytest-twisted

    ; asyncio dependencies
    asyncio: pytest_asyncio

extras =
    encryption
    serialization
    scram
    nvx
    xbr

whitelist_externals =
    sh
    coverage
    codecov
    cp
    mkdir
    rm
    ls
    mv
    curl
    unzip
    find
    echo
    file
    du
    xbrnetwork
    chmod
    ldd
    which

passenv =
    WEB3_INFURA_PROJECT_ID
    WEB3_INFURA_API_SECRET

setenv =
    # NaCl/Sodium: use and build bundled sources (don't use any system library)
    SODIUM_INSTALL=bundled

    # controls build of WAMP serializers:
    PYUBJSON_NO_EXTENSION=1
    # AUTOBAHN_USE_NVX=1
    # AUTOBAHN_USE_UJSON=1

    # controls test setup according to networking framework
    asyncio: USE_ASYNCIO=1
    asyncio: PYTHONPATH={toxinidir}
    tw1910,tw203,tw221,twtrunk: USE_TWISTED=1

    # this enables "autobahn/test/test_rng.py" (on Linux),
    # which tests entropy depletion, and tests how to correctly
    # read _real_ entropy and block if not enough _real_ entropy is currently avail
    # also: https://github.com/crossbario/autobahn-python/issues/1275
    # AUTOBAHN_CI_ENABLE_RNG_DEPLETION_TESTS = 1

commands =
    # install package
    # pip install -q -U pip
    # sh -c "which python && which pip && python -V"
    # pip install -q --no-cache --ignore-installed --force-reinstall .[twisted,asyncio,compress,serialization,encryption,scram,xbr]

    # IMPORTANT: we need to exclude all twisted tests
    asyncio: pytest -s -v -rfP --ignore=./autobahn/twisted ./autobahn

    # IMPORTANT: trial doesn't allow to recurse-and-exclude, and hence we need this looong list (because we must exclude "asyncio")
    tw1910,tw203,tw221: trial        --no-recurse autobahn.test autobahn.twisted.test autobahn.websocket.test autobahn.rawsocket.test autobahn.wamp.test autobahn.xbr.test autobahn.nvx.test
    twtrunk: python -m twisted.trial --no-recurse autobahn.test autobahn.twisted.test autobahn.websocket.test autobahn.rawsocket.test autobahn.wamp.test autobahn.xbr.test autobahn.nvx.test


[testenv:flake8]
skip_install = True
deps =
    flake8<5
    pep8-naming
exclude = autobahn/wamp/gen
max-line-length = 119
commands =
    python -V
    flake8 --version
    flake8 -v --statistics \
        --ignore=E402,E501,E722,E741,N801,N802,N803,N805,N806,N815,N818 \
        --exclude "autobahn/wamp/message_fbs.py,autobahn/wamp/gen/*" \
        autobahn


[testenv:coverage]
skip_install = False
deps =
    coverage
    codecov
    pytest
    pytest_asyncio
    pytest-twisted
    twisted
    git+https://github.com/crossbario/txaio
extras =
    encryption
    serialization
    scram
    nvx
    xbr
passenv =
    CODECOV_TOKEN
    WEB3_INFURA_PROJECT_ID
commands =
    # install package with all optional extensions
    pip install .[all]

    # test autobahn on asyncio (run under coverage)
    sh -c 'USE_ASYNCIO=1 coverage run --parallel-mode --include "*/autobahn/asyncio/*" --omit "*/twisted/*" --omit "*/test/*.py" -m pytest -v --ignore=./autobahn/twisted ./autobahn'

    # test autobahn on twisted (run under coverage)
    sh -c 'USE_TWISTED=1 coverage run --parallel-mode --include "*/autobahn/*" --omit "*/asyncio/*" --omit "*/test/*.py" -m twisted.trial autobahn.test autobahn.twisted.test autobahn.websocket.test autobahn.rawsocket.test autobahn.wamp.test autobahn.xbr.test autobahn.nvx.test'

    coverage combine
    coverage report
    coverage html
    codecov


[testenv:sphinx]
description =
    Generate docs using Sphinx.
skip_install = False
deps =
    sphinx
    sphinx_rtd_theme
    sphinxcontrib.images
    sphinx.autoapi
    git+https://github.com/crossbario/txaio
extras =
    twisted
    encryption
    serialization
    scram
    nvx
    xbr
commands =
    python -V
    sphinx-build --version
    pip install .[all]
    python -c "from autobahn import xbr; print('HAS_XBR=' + str(xbr.HAS_XBR))"
    python -c "from autobahn import xbr; assert(xbr.HAS_XBR)"
    python -c "from autobahn.websocket.utf8validator import Utf8Validator"

    # first test with all warnings fatal
    find ./docs -name "*.rst"

    # FIXME: readd "-W" .. I dont have time for this shit, fuck sphinx
    # sphinx-build -T -b dummy ./docs ./docs/_build

    # generate HTML output
    sphinx-build -b html ./docs ./docs/_build


[testenv:buildexe]
description =
    Build one-file executable using PyInstaller.
skip_install = True
passenv =
    AUTOBAHN_BUILD_DATE
    AUTOBAHN_BUILD_ID
    AUTOBAHN_VCS_REF
    AUTOBAHN_VERSION
    XBRNETWORK_EXE_FILENAME
deps =
    pip
    pyinstaller==4.8
commands =
    echo "Building with AUTOBAHN_BUILD_DATE={env:AUTOBAHN_BUILD_DATE}"
    echo "Building with AUTOBAHN_BUILD_ID={env:AUTOBAHN_BUILD_ID}"
    echo "Building with AUTOBAHN_VCS_REF={env:AUTOBAHN_VCS_REF}"
    echo "Building with AUTOBAHN_VERSION={env:AUTOBAHN_VERSION}"
    echo "Building with XBRNETWORK_EXE_FILENAME={env:XBRNETWORK_EXE_FILENAME}"

    # Install pip v19.3.1 (yes, absolutely, we do not want the "new resolver" shit)
    # curl -sSL -o get-pip.py https://bootstrap.pypa.io/get-pip.py
    # python get-pip.py   # fails with https://github.com/pypa/setuptools/issues/3044
    # python get-pip.py "pip<20"
    pip show pip

    # Install development dependencies
    pip install -r{toxinidir}/requirements-dev.txt

    # inject build ID into source code: modifies autobahn/_version.py!
    echo "Building with AUTOBAHN_BUILD_ID={env:AUTOBAHN_BUILD_ID}"
    python inject-build-id.py

    # Install the package itself
    pip install .[all]

    # print effective version/build
    python -c "from autobahn._version import __version__, __build__; print('autobahn==', __version__, __build__)"

    # run CLI and print versions
    xbrnetwork version

    # bundle up dist/xbrnetwork
    which pyinstaller
    pyinstaller --version
	pyinstaller --additional-hooks-dir={toxinidir}/pyinstaller \
        --specpath={toxinidir}/pyinstaller --onefile --clean \
        --name xbrnetwork {toxinidir}/autobahn/xbr/_cli.py

    chmod +x {toxinidir}/dist/xbrnetwork
    cp {toxinidir}/dist/xbrnetwork {homedir}/xbrnetwork

    # base check of the produced executable
	file {homedir}/xbrnetwork
	ldd {homedir}/xbrnetwork
    du -h {homedir}/xbrnetwork
	{homedir}/xbrnetwork version