DISPATCH-1974 Create initial flake8 configuration w/ fewer ignores (#1055)

diff --git a/tests/tox.ini.in b/tests/tox.ini.in
index b90317a..6a86818 100644
--- a/tests/tox.ini.in
+++ b/tests/tox.ini.in
@@ -25,8 +25,6 @@
 skip_install = True
 
 [testenv]
-# we ignore lots of errors/warnings we probably should not,
-# but it will take a lot of effort to make the code PEP8 compliant...
 commands = flake8 --count --show-source \
   ${CMAKE_SOURCE_DIR}/python \
   ${CMAKE_SOURCE_DIR}/console \
@@ -34,8 +32,7 @@
   ${CMAKE_SOURCE_DIR}/tests \
   ${CMAKE_SOURCE_DIR}/tools \
   ${CMAKE_SOURCE_DIR}/tools/qdstat \
-  ${CMAKE_SOURCE_DIR}/tools/qdmanage \
-  --ignore=E111,E114,E121,E122,E123,E124,E126,E127,E128,E129,E131,E201,E202,E203,E211,E221,E222,E225,E226,E228,E231,E241,E251,E261,E266,E265,E271,E272,E301,E302,E303,E305,E306,E401,E402,E501,E502,E701,E702,E703,E704,E711,E712,E713,E714,E731,E722,E741,F401,F403,F405,F811,F841,H101,H102,H104,H201,H202,H234,H237,H238,H301,H306,H401,H403,H404,H405,W291,W292,W293,W391,W503,W504
+  ${CMAKE_SOURCE_DIR}/tools/qdmanage
 deps = hacking>=1.1.0
 
 [testenv:py27]
@@ -52,3 +49,77 @@
 
 [testenv:py39]
 basepython = python3.9
+
+[flake8]
+# TODO(DISPATCH-1974) decrease the limit
+max-line-length = 464
+
+# TODO(DISPATCH-1974) re-enable all these warnings
+ignore =
+    # H238: old style class declaration, use new style (inherit from `object`)
+    H238,
+    # E704 multiple statements on one line (def)
+    E704,
+    # E241 multiple spaces after ','
+    E241,
+    # E203 whitespace before ':'
+    E203,
+    # H101: Use TODO(NAME)
+    H101,
+    # H202: assertRaises Exception too broad
+    H202,
+    # H234: assertEquals is deprecated, use assertEqual
+    H234,
+    # H401: docstring should not start with a space
+    H401,
+    # H403: multi line docstrings should end on a new line
+    H403,
+    # H404: multi line docstring should start without a leading new line
+    H404,
+    # H405: multi line docstring summary not separated with an empty line
+    H405,
+    # E265 block comment should start with '# '
+    E265,
+    # E266 too many leading '#' for block comment
+    E266,
+    # E221 multiple spaces before operator
+    E221,
+    # E222 multiple spaces after operator
+    E222,
+    # do not use bare 'except'
+    E722,
+    # H201: no 'except:' at least use 'except Exception:'
+    H201,
+    # H104: File contains nothing but comments
+    H104,
+    # H301: one import per line
+    H301,
+    # H306: imports not in alphabetical order
+    H306,
+    # imported but unused
+    F401,
+    # 'from proton import *' used; unable to detect undefined names
+    F403,
+    # F811 redefinition of unused 'Timeout' from line 29
+    F811,
+    # E712 comparison to True should be 'if cond is not True:' or 'if not cond:'
+    # E712 comparison to False should be 'if cond is False:' or 'if not cond:'
+    E712,
+    # E402 module level import not at top of file
+    E402,
+    # may be undefined, or defined from star imports: datetime
+    F405,
+    # ambiguous variable name 'l'
+    E741,
+    # local variable 'int_nodes' is assigned to but never used
+    F841,
+    # TODO(DISPATCH-1974) decide which of these two warnings we want disabled
+    #  _transport.py:908:21: W503 line break before binary operator
+    #  _transport.py:907:56: W504 line break after binary operator
+    W503,
+    W504,
+
+exclude =
+    # TODO(DISPATCH-1974) generated by gRPC tooling
+    friendship_pb2.py,
+    friendship_pb2_grpc.py,