diff --git a/makefile b/makefile --- a/makefile +++ b/makefile @@ -50,14 +50,11 @@ tkdnd_build: coffee: zsh -c 'cd light9/web; ../../node_modules/coffeescript/bin/coffee --map -cw {.,live,timeline,paint,effects}/*.coffee' -mypy-collector: - env/bin/mypy --ignore-missing-imports --strict-optional --custom-typeshed-dir stubs --html-report /tmp/rep bin/collector light9/collector/*.py - -mypy-paint: - env/bin/mypy --ignore-missing-imports --strict-optional --custom-typeshed-dir stubs --html-report /tmp/rep light9/paint/*.py +mypy: + inv mypy reformat: - env/bin/yapf --verbose --parallel --in-place --style google light9/**/*.py `file --no-pad bin/* | grep 'Python script' | perl -lpe 's/:.*//'` + inv reformat ### show ### diff --git a/requirements.txt b/requirements.txt --- a/requirements.txt +++ b/requirements.txt @@ -2,14 +2,10 @@ Pillow==4.0.0 Twisted==19.2.0 coloredlogs==6.0 colormath==3.0.0 -coverage==4.3.4 freezegun==0.3.8 genshi==0.7 -ipdb==0.10.2 -ipython==5.3.0 klein==17.2.0 mock==2.0.0 -mypy==0.701 noise==1.2.2 nose-watcher==0.1.3 nose==1.3.7 @@ -30,12 +26,16 @@ watchdog==0.8.3 webcolors==1.7 yapf==0.27.0 +coverage==4.3.4 +ipdb==0.10.2 +ipython==5.3.0 +mypy==0.701 +flake8 + git+http://github.com/drewp/scales.git@448d59fb491b7631877528e7695a93553bfaaa93#egg=scales git+http://github.com/11craft/louie.git@f18bb71010c114eca9c6b88c96453340e3b39454#egg=louie git+http://github.com/webpy/webpy@ace0f8954c28311004b33c7a513c6e40a3c02470#egg=web https://github.com/drewp/cyclone/archive/python3.zip#egg=cyclone cycloneerr==0.3.0 -rdfdb==0.11.0 - - +rdfdb==0.13.0 diff --git a/tasks.py b/tasks.py new file mode 100644 --- /dev/null +++ b/tasks.py @@ -0,0 +1,54 @@ +from invoke import task +import glob + +bin_sources = [ + 'bin/ascoltami2', + 'bin/captureDevice', + 'bin/collector', + 'bin/collector_loadtest.py', + 'bin/effecteval', + 'bin/effectsequencer', + 'bin/homepageConfig', + 'bin/inputdemo', + 'bin/inputquneo', + 'bin/keyboardcomposer', + 'bin/listsongs', + 'bin/musicPad', + 'bin/musictime', + 'bin/paintserver', + 'bin/picamserve', + 'bin/rdfdb', + 'bin/run_local.py', + 'bin/subcomposer', + 'bin/subserver', + 'bin/vidref', + 'bin/vidrefsetup', + 'bin/wavecurve', + ] +def pkg_sources(): + return glob.glob('light9/**/*.py', recursive=True) + +@task +def mypy(ctx): + def run(sources): + ss = ' '.join(sources) + ctx.run(f'MYPYPATH=stubs env/bin/mypy --check-untyped-defs {ss}', + pty=True, warn=True) + + sources = ' '.join(bin_sources + pkg_sources()) + 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) + + sources = ' '.join(pkg_sources()) + for src in bin_sources: + print(f"mypy {src}") + run([src])# + pkg_sources()) +@task +def reformat(ctx): + ctx.run("env/bin/yapf --verbose --parallel --in-place --style google light9/**/*.py `file --no-pad bin/* | grep 'Python script' | perl -lpe 's/:.*//'`") + +@task +def test(ctx): + ctx.run('docker build -f Dockerfile.build -t light9_build:latest .') + ctx.run('docker run --rm -it -v `pwd`:/opt light9_build:latest' + ' nose2 -v light9.currentstategraphapi_test light9.graphfile_test', + pty=True)