comparison tasks.py @ 1864:375f48d1518a

mypy, flake8 setups Ignore-this: 159ab09780ff33dec508d2d25c1628bf
author Drew Perttula <drewp@bigasterisk.com>
date Sat, 25 May 2019 12:03:26 +0000
parents
children f001d689b3e2
comparison
equal deleted inserted replaced
1863:0f0ff27e55a3 1864:375f48d1518a
1 from invoke import task
2 import glob
3
4 bin_sources = [
5 'bin/ascoltami2',
6 'bin/captureDevice',
7 'bin/collector',
8 'bin/collector_loadtest.py',
9 'bin/effecteval',
10 'bin/effectsequencer',
11 'bin/homepageConfig',
12 'bin/inputdemo',
13 'bin/inputquneo',
14 'bin/keyboardcomposer',
15 'bin/listsongs',
16 'bin/musicPad',
17 'bin/musictime',
18 'bin/paintserver',
19 'bin/picamserve',
20 'bin/rdfdb',
21 'bin/run_local.py',
22 'bin/subcomposer',
23 'bin/subserver',
24 'bin/vidref',
25 'bin/vidrefsetup',
26 'bin/wavecurve',
27 ]
28 def pkg_sources():
29 return glob.glob('light9/**/*.py', recursive=True)
30
31 @task
32 def mypy(ctx):
33 def run(sources):
34 ss = ' '.join(sources)
35 ctx.run(f'MYPYPATH=stubs env/bin/mypy --check-untyped-defs {ss}',
36 pty=True, warn=True)
37
38 sources = ' '.join(bin_sources + pkg_sources())
39 ctx.run(f'env/bin/flake8 --ignore=E115,E123,E124,E126,E225,E231,E261,E262,E265,E301,E302,E303,E305,E306,E401,E402,E501,E701,E731,W291,W293,W391,W504 {sources}', warn=True)
40
41 sources = ' '.join(pkg_sources())
42 for src in bin_sources:
43 print(f"mypy {src}")
44 run([src])# + pkg_sources())
45 @task
46 def reformat(ctx):
47 ctx.run("env/bin/yapf --verbose --parallel --in-place --style google light9/**/*.py `file --no-pad bin/* | grep 'Python script' | perl -lpe 's/:.*//'`")
48
49 @task
50 def test(ctx):
51 ctx.run('docker build -f Dockerfile.build -t light9_build:latest .')
52 ctx.run('docker run --rm -it -v `pwd`:/opt light9_build:latest'
53 ' nose2 -v light9.currentstategraphapi_test light9.graphfile_test',
54 pty=True)