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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
|
.PHONY: test docs pep8 build
WHEELS=https://crossbarbuilder.s3.eu-central-1.amazonaws.com/wheels
XBRNETWORK=${HOME}/.local/bin/xbrnetwork
all:
@echo "Targets:"
@echo ""
@echo " clean Cleanup"
@echo " install Local install"
@echo " publish Clean build, register and publish to PyPi"
@echo " test Run unit tests"
@echo " flake8 Run flake8 code checking"
@echo ""
# deprecated with v21.2.1 (ABI files are no longer bundled in this package)
abi_files:
curl -s https://xbr.network/lib/abi/xbr-protocol-latest.zip -o /tmp/xbr-protocol-latest.zip
unzip -t /tmp/xbr-protocol-latest.zip
rm -rf ${PWD}/autobahn/xbr/contracts
unzip /tmp/xbr-protocol-latest.zip -d ${PWD}/autobahn/xbr/contracts
# install locally
install:
-pip uninstall -y pytest_asyncio # remove the broken shit
-pip uninstall -y pytest_cov # remove the broken shit
# enforce use of bundled libsodium
AUTOBAHN_USE_NVX=1 SODIUM_INSTALL=bundled pip install -e .[all]
build:
-rm -f dist/*
# AUTOBAHN_USE_NVX=0 python setup.py sdist --universal
AUTOBAHN_USE_NVX=1 python setup.py sdist
ls -la dist
# upload to our internal deployment system
upload: clean
AUTOBAHN_USE_NVX=0 python setup.py sdist --universal
aws s3 cp --acl public-read \
dist/autobahn-*.whl \
s3://fabric-deploy/autobahn/
# cleanup everything
clean: clean_docs clean_catalog
-rm -f ./*.so
-rm -rf ./docs/build
-rm -rf ./.cache
-rm -rf ./autobahn.egg-info
-rm -rf ./build
-rm -rf ./dist
-rm -rf ./temp
-rm -rf ./_trial_temp
-rm -rf ./.tox
-rm -rf ./.eggs
-rm -rf ./htmlcov
-rm -f ./twisted/plugins/dropin.cache
-find . -name "*dropin.cache.new" -type f -exec rm -f {} \;
-find . -name ".pytest_cache" -type d -exec rm -rf {} \;
-find . -name "*.tar.gz" -type f -exec rm -f {} \;
-find . -name "*.egg" -type f -exec rm -f {} \;
-find . -name "*.pyc" -type f -exec rm -f {} \;
# Learn to love the shell! http://unix.stackexchange.com/a/115869/52500
-find . \( -name "*__pycache__" -type d \) -prune -exec rm -rf {} +
clean_catalog:
cd ./autobahn/xbr/test/catalog && make clean
rebuild_catalog:
cd ./autobahn/xbr/test/catalog && make distclean && make build
# publish to PyPI
publish: clean
AUTOBAHN_USE_NVX=0 python setup.py sdist
twine upload dist/*
clean_docs:
-rm -rf ./docs/_build
-rm -rf ./docs/autoapi/
docs:
tox -e sphinx
spelling:
cd docs && sphinx-build -b spelling . _spelling
run_docs:
twistd --nodaemon web --port=tcp:8090 --path=./docs/_build/
clean_wheels:
rm -rf ./.wheels
mkdir -p ./.wheels/
download_wheels:
mkdir -p ./.wheels/
rm -f ./.wheels/*.whl
curl -o ./.wheels/txaio-latest-py2.py3-none-any.whl $(WHEELS)/txaio-latest-py2.py3-none-any.whl
curl -o ./.wheels/zlmdb-latest-py2.py3-none-any.whl $(WHEELS)/zlmdb-latest-py2.py3-none-any.whl
curl -o ./.wheels/xbr-latest-py2.py3-none-any.whl $(WHEELS)/xbr-latest-py2.py3-none-any.whl
curl -o ./.wheels/autobahn-latest-py2.py3-none-any.whl $(WHEELS)/autobahn-latest-py2.py3-none-any.whl
ls -la ./.wheels
build_this_wheel:
mkdir -p ./.wheels/
rm -f ./.wheels/autobahn*.whl
pip3 wheel --no-deps --wheel-dir=./.wheels .
mv .wheels/autobahn*.whl .wheels/autobahn-latest-py2.py3-none-any.whl
ls -la ./.wheels
download_exe:
curl -o $(XBRNETWORK) \
https://download.crossbario.com/xbrnetwork/linux-amd64/xbrnetwork-latest
chmod +x $(XBRNETWORK)
$(XBRNETWORK) version
build_exe:
tox -e buildexe
upload_exe:
aws s3 cp --acl public-read \
./dist/xbrnetwork \
s3://download.crossbario.com/xbrnetwork/linux-amd64/${XBRNETWORK_EXE_FILENAME}
aws s3 cp --acl public-read \
./dist/xbrnetwork \
s3://download.crossbario.com/xbrnetwork/linux-amd64/xbrnetwork-latest
# aws s3api copy-object --acl public-read --copy-source \
# download.crossbario.com/xbrnetwork/linux-amd64/${XBRNETWORK_EXE_FILENAME} \
# --bucket download.crossbario.com \
# --key xbrnetwork/linux-amd64/xbrnetwork-latest
aws cloudfront create-invalidation \
--distribution-id E2QIG9LNGCJSP9 --paths "/xbrnetwork/linux-amd64/*"
mypy:
mypy --install-types --non-interactive autobahn
# WEB3_INFURA_PROJECT_ID must be defined for this
test_infura:
time -f "%e" python -c "from web3.auto.infura import w3; print(w3.isConnected())"
test_xbr:
USE_TWISTED=1 trial autobahn.xbr
test_xbr_cli:
xbrnetwork
xbrnetwork version
xbrnetwork get-member
xbrnetwork get-market --market=1388ddf6-fe36-4201-b1aa-cb7e36b4cfb3
xbrnetwork get-actor
xbrnetwork get-actor --market=1388ddf6-fe36-4201-b1aa-cb7e36b4cfb3
test_wamp_serializer:
-USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_serializer
-USE_ASYNCIO=1 pytest autobahn/wamp/test/test_wamp_serializer.py
test_xbr_schema:
USE_TWISTED=1 trial autobahn.xbr.test.schema
USE_ASYNCIO=1 pytest autobahn/xbr/test/schema
test_mnemonic:
# python -m pytest -rsx autobahn/xbr/test/test_mnemonic.py
USE_TWISTED=1 trial autobahn.xbr.test
test_nvx:
python -m pytest -rsx autobahn/nvx/test
USE_TWISTED=1 trial autobahn.nvx.test.test_utf8validator
test_styleguide:
flake8 --statistics --max-line-length=119 -qq autobahn
# direct test via pytest (only here because of setuptools test integration)
test_pytest:
USE_ASYNCIO=1 python -m pytest -c setup.cfg -rsvx autobahn/
# test via setuptools command
test_setuptools:
python setup.py test
test:
tox -e flake8,py37-twtrunk,py37-asyncio
#test: flake8 test_twisted test_asyncio
# test under Twisted
test_twisted:
USE_TWISTED=1 trial autobahn
# WAMP_ROUTER_URL="ws://127.0.0.1:8080/ws" USE_TWISTED=1 trial autobahn
test_application_runner:
USE_TWISTED=1 trial autobahn.twisted.test.test_tx_application_runner
test_util:
USE_TWISTED=1 trial autobahn.test.test_util
test_rng:
USE_TWISTED=1 trial autobahn.test.test_rng
test_serializer:
USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_serializer
test_wamp_identifiers:
USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_identifiers
test_tx_cryptobox:
USE_TWISTED=1 trial autobahn.wamp.test.test_cryptobox
test_tx_choosereactor:
USE_TWISTED=1 trial autobahn.twisted.test.test_choosereactor
test_cryptosign:
# USE_ASYNCIO=1 trial autobahn.wamp.test.test_wamp_cryptosign
USE_ASYNCIO=1 pytest -s -v -rfA --ignore=./autobahn/twisted autobahn/wamp/test/test_wamp_cryptosign.py
USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_cryptosign
test_xbr_web3:
# pytest -s -v -rfA autobahn/xbr/test/test_xbr_web3.py
trial autobahn/xbr/test/test_xbr_web3.py
test_xbr_frealm:
# pytest -s -v -rfA autobahn/xbr/test/test_xbr_frealm.py
trial autobahn/xbr/test/test_xbr_frealm.py
test_wamp_scram:
USE_ASYNCIO=1 trial autobahn.wamp.test.test_wamp_scram
USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_scram
test_xbr_argon2:
USE_ASYNCIO=1 trial autobahn.xbr.test.test_xbr_argon2
USE_TWISTED=1 trial autobahn.xbr.test.test_xbr_argon2
test_xbr_config:
USE_TWISTED=1 trial autobahn.xbr.test.test_xbr_config
test_transport_details:
USE_ASYNCIO=1 trial autobahn.wamp.test.test_wamp_transport_details
USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_transport_details
test_session_details:
USE_ASYNCIO=1 trial autobahn.wamp.test.test_wamp_session_details
USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_session_details
test_tx_protocol:
USE_TWISTED=1 trial autobahn.twisted.test.test_tx_protocol
test_asyncio:
USE_ASYNCIO=1 pytest -s -v -rfP --ignore=./autobahn/twisted autobahn
# USE_ASYNCIO=1 pytest -s -v -rA --ignore=./autobahn/twisted ./autobahn/asyncio/test/test_aio_websocket.py
# USE_ASYNCIO=1 pytest -s -v -rA --log-cli-level=info --ignore=./autobahn/twisted ./autobahn/asyncio/test/test_aio_websocket.py
test_cs1:
USE_ASYNCIO=1 python -m pytest -s -v autobahn/wamp/test/test_cryptosign.py
test1:
USE_TWISTED=1 trial autobahn.wamp.test.test_wamp_uri_pattern
# USE_TWISTED=1 trial autobahn.wamp.test.test_auth
# USE_TWISTED=1 python -m pytest -s -v autobahn/wamp/test/test_auth.py
# USE_TWISTED=1 python -m pytest -s -v autobahn/wamp/test/test_router.py
# USE_ASYNCIO=1 python -m pytest -s -v autobahn/wamp/test/test_router.py
test2:
# USE_TWISTED=1 python -m pytest -s -v autobahn/wamp/test/test_router.py
USE_ASYNCIO=1 python -m pytest -s -v autobahn/wamp/test/test_router.py
# trial autobahn
# trial autobahn.websocket.test
# trial autobahn.wamp.test
# trial autobahn.wamp.test.test_component
# trial autobahn.wamp.test.test_message
# trial autobahn.wamp.test.test_protocol
# trial autobahn.wamp.test.test_protocol_peer
# trial autobahn.wamp.test.test_serializer
# trial autobahn.wamp.test.test_uri_pattern
pyflakes:
pyflakes .
# run PEP8 check and print statistics
pep8:
pep8 --statistics --ignore=E501 -qq autobahn
# run PEP8 check and show source for offending code
pep8show:
pep8 --show-source --ignore=E501 autobahn
# run autopep8 to automatically transform offending code
autopep8:
autopep8 -ri --aggressive autobahn
# This will run pep8, pyflakes and can skip lines that end with # noqa
flake8:
tox -c tox.ini -e flake8
# run PyLint
pylint:
pylint -d line-too-long,invalid-name autobahn
# on Unix, check for files with Windows line endings
find_windows_files:
find . -name "*" -exec file {} \; | grep "CRLF"
# on Windows (Git Bash), check for files with Unix lines endings
find_unix_files:
find . -name "*" -exec dos2unix -tv {} \; 2>&1 | grep "Unix"
# sudo apt install gource ffmpeg
gource:
gource \
--path . \
--seconds-per-day 0.15 \
--title "autobahn-python" \
-1280x720 \
--file-idle-time 0 \
--auto-skip-seconds 0.75 \
--multi-sampling \
--stop-at-end \
--highlight-users \
--hide filenames,mouse,progress \
--max-files 0 \
--background-colour 000000 \
--disable-bloom \
--font-size 24 \
--output-ppm-stream - \
--output-framerate 30 \
-o - \
| ffmpeg \
-y \
-r 60 \
-f image2pipe \
-vcodec ppm \
-i - \
-vcodec libx264 \
-preset ultrafast \
-pix_fmt yuv420p \
-crf 1 \
-threads 0 \
-bf 0 \
autobahn-python.mp4
#
# generate (a special set of) WAMP message classes from FlatBuffers schema
#
# To build flatc from sourcces:
#
# git clone https://github.com/google/flatbuffers.git
# cd flatbuffers
# git checkout v22.12.06
# cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
# make
# sudo cp ./flatc /usr/local/bin/flatc
# input .fbs files for schema
FBSFILES=./autobahn/wamp/flatbuffers/*.fbs
# flatc compiler to use
FLATC=flatc
clean_fbs:
-rm -rf ./autobahn/wamp/gen/
build_fbs:
# generate schema binary type library (*.bfbs files)
$(FLATC) -o ./autobahn/wamp/gen/schema/ --binary --schema --bfbs-comments --bfbs-builtins $(FBSFILES)
@find ./autobahn/wamp/gen/schema/ -name "*.bfbs" | wc -l
# generate schema Python bindings (*.py files)
$(FLATC) -o ./autobahn/wamp/gen/ --python $(FBSFILES)
@touch ./autobahn/wamp/gen/__init__.py
@find ./autobahn/wamp/gen/ -name "*.py" | wc -l
build_fbs_cpp:
# generate schema C++ bindings (*.cpp/hpp files)
$(FLATC) -o /tmp/gen-cpp/ --cpp $(FBSFILES)
@find /tmp/gen-cpp/
build_fbs_rust:
# generate schema Rust bindings (*.rs files)
$(FLATC) -o /tmp/gen-rust/ --rust $(FBSFILES)
@find /tmp/gen-rust/
fix_copyright:
find . -type f -exec sed -i 's/Copyright (c) Crossbar.io Technologies GmbH/Copyright (c) typedef int GmbH/g' {} \;
|