Message ID | 20210512231241.2816122-14-jsnow@redhat.com |
---|---|
State | New |
Headers | show |
Series | python: create installable package | expand |
On Wed, May 12, 2021 at 07:12:29PM -0400, John Snow wrote: > Instruct flake8 to avoid certain well-known directories created by > python tooling that it ought not check. > > Note that at-present, nothing actually creates a ".venv" directory; but > it is in such widespread usage as a de-facto location for a developer's > virtual environment that it should be excluded anyway. A forthcoming > commit canonizes this with a "make venv" command. > > Signed-off-by: John Snow <jsnow@redhat.com> > --- > python/setup.cfg | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/python/setup.cfg b/python/setup.cfg > index 9ecb2902006..f21a1c42fc0 100644 > --- a/python/setup.cfg > +++ b/python/setup.cfg > @@ -21,6 +21,8 @@ packages = find_namespace: > > [flake8] > extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's > +exclude = __pycache__, > + .venv, > Given that the default set of exclusions (version control system files) are not expected here, it LGTM to reset it with these. Reviewed-by: Cleber Rosa <crosa@redhat.com>
On 5/25/21 11:50 AM, Cleber Rosa wrote: > On Wed, May 12, 2021 at 07:12:29PM -0400, John Snow wrote: >> Instruct flake8 to avoid certain well-known directories created by >> python tooling that it ought not check. >> >> Note that at-present, nothing actually creates a ".venv" directory; but >> it is in such widespread usage as a de-facto location for a developer's >> virtual environment that it should be excluded anyway. A forthcoming >> commit canonizes this with a "make venv" command. >> >> Signed-off-by: John Snow <jsnow@redhat.com> >> --- >> python/setup.cfg | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/python/setup.cfg b/python/setup.cfg >> index 9ecb2902006..f21a1c42fc0 100644 >> --- a/python/setup.cfg >> +++ b/python/setup.cfg >> @@ -21,6 +21,8 @@ packages = find_namespace: >> >> [flake8] >> extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's >> +exclude = __pycache__, >> + .venv, >> > > Given that the default set of exclusions (version control system > files) are not expected here, it LGTM to reset it with these. > > Reviewed-by: Cleber Rosa <crosa@redhat.com> > Yep. Admittedly, I just excluded things that caused me trouble in practice. I could narrow the flake8 invocation to specify *only* the qemu/ folder, but in the event we added Python tests or other scripts I actually felt like leaving it "open" would be fine. (This way, flake8 runs like how I expect it to by just running "flake8" with no arguments, which I saw as nice.) The goal was something like: the less specific I make the flake8 invocation, the better, even though I expect the linter to be run only by "make check" eventually, as a courtesy to mid-advanced users, keeping those canonical invocations simple felt good. Thanks! --js
diff --git a/python/setup.cfg b/python/setup.cfg index 9ecb2902006..f21a1c42fc0 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -21,6 +21,8 @@ packages = find_namespace: [flake8] extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's +exclude = __pycache__, + .venv, [pylint.messages control] # Disable the message, report, category or checker with the given id(s). You
Instruct flake8 to avoid certain well-known directories created by python tooling that it ought not check. Note that at-present, nothing actually creates a ".venv" directory; but it is in such widespread usage as a de-facto location for a developer's virtual environment that it should be excluded anyway. A forthcoming commit canonizes this with a "make venv" command. Signed-off-by: John Snow <jsnow@redhat.com> --- python/setup.cfg | 2 ++ 1 file changed, 2 insertions(+)