annotate tasks.py @ 2035:f9faa2ec824f

WIP collector using starlette and vite
author drewp@bigasterisk.com
date Sat, 09 Apr 2022 02:49:14 -0700
parents 82e98aa4d159
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1864
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
1 from invoke import task
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
2 import glob
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
3
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
4 bin_sources = [
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
5 'bin/ascoltami2',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
6 'bin/captureDevice',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
7 'bin/collector',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
8 'bin/collector_loadtest.py',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
9 'bin/effecteval',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
10 'bin/effectsequencer',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
11 'bin/homepageConfig',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
12 'bin/inputdemo',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
13 'bin/inputquneo',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
14 'bin/keyboardcomposer',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
15 'bin/listsongs',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
16 'bin/musicPad',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
17 'bin/musictime',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
18 'bin/paintserver',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
19 'bin/picamserve',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
20 'bin/rdfdb',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
21 'bin/run_local.py',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
22 'bin/subcomposer',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
23 'bin/subserver',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
24 'bin/vidref',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
25 'bin/vidrefsetup',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
26 'bin/wavecurve',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
27 ]
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
28 def pkg_sources():
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
29 return glob.glob('light9/**/*.py', recursive=True)
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
30
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
31 @task
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
32 def mypy(ctx):
1873
f001d689b3e2 more py3 and typing fixes
Drew Perttula <drewp@bigasterisk.com>
parents: 1864
diff changeset
33 print('\n\n')
1864
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
34 def run(sources):
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
35 ss = ' '.join(sources)
1873
f001d689b3e2 more py3 and typing fixes
Drew Perttula <drewp@bigasterisk.com>
parents: 1864
diff changeset
36 ctx.run(f'MYPYPATH=stubs:/my/proj/rdfdb env/bin/mypy --check-untyped-defs {ss}',
1864
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
37 pty=True, warn=True)
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
38
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
39 sources = ' '.join(bin_sources + pkg_sources())
1930
d40a653f2bfd turn off flake8 warnings for some things the autoformatter is doing
Drew Perttula <drewp@bigasterisk.com>
parents: 1918
diff changeset
40 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,E131,E125 {sources}', warn=True)
1864
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
41
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
42 sources = ' '.join(pkg_sources())
1891
36849634d50b mymy on collector
Drew Perttula <drewp@bigasterisk.com>
parents: 1883
diff changeset
43 run(['bin/collector'])
1873
f001d689b3e2 more py3 and typing fixes
Drew Perttula <drewp@bigasterisk.com>
parents: 1864
diff changeset
44 run(['bin/rdfdb'])
f001d689b3e2 more py3 and typing fixes
Drew Perttula <drewp@bigasterisk.com>
parents: 1864
diff changeset
45 run(['bin/keyboardcomposer'])
1918
ddc9a5ef213a type hints
Drew Perttula <drewp@bigasterisk.com>
parents: 1891
diff changeset
46 run(['bin/effectsequencer'])
ddc9a5ef213a type hints
Drew Perttula <drewp@bigasterisk.com>
parents: 1891
diff changeset
47 run(['bin/ascoltami2'])
1942
82e98aa4d159 reformatting and typing
drewp@bigasterisk.com
parents: 1930
diff changeset
48 run(['bin/vidref'])
1873
f001d689b3e2 more py3 and typing fixes
Drew Perttula <drewp@bigasterisk.com>
parents: 1864
diff changeset
49 #for src in bin_sources:
f001d689b3e2 more py3 and typing fixes
Drew Perttula <drewp@bigasterisk.com>
parents: 1864
diff changeset
50 # print(f"mypy {src}")
f001d689b3e2 more py3 and typing fixes
Drew Perttula <drewp@bigasterisk.com>
parents: 1864
diff changeset
51 # run([src])# + pkg_sources())
1864
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
52 @task
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
53 def reformat(ctx):
1883
17bee25a20cb reformat
Drew Perttula <drewp@bigasterisk.com>
parents: 1873
diff changeset
54 ctx.run("env/bin/yapf --verbose --parallel --in-place --style google light9/*.py light9/*/*.py `file --no-pad bin/* | grep 'Python script' | perl -lpe 's/:.*//'`")
1864
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
55
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
56 @task
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
57 def test(ctx):
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
58 ctx.run('docker build -f Dockerfile.build -t light9_build:latest .')
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
59 ctx.run('docker run --rm -it -v `pwd`:/opt light9_build:latest'
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
60 ' nose2 -v light9.currentstategraphapi_test light9.graphfile_test',
375f48d1518a mypy, flake8 setups
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
61 pty=True)