Closed nicain closed 3 years ago
nbqa
will just call python -m flake8
, whatever that points to is what it'll use
Second, you're using a version of nbQA that's pretty old, I'd suggest upgrading
Finally, seeing as you're using nbQA at Google, please consider sponsoring the project
Just checked, and parlai
actually installs a flake8 extension https://github.com/facebookresearch/ParlAI/blob/main/setup.py
That's where the PAI code comes from, and this is working as expected
So, this isn't a bug, and the only deep problem here is that Google is using free tools without contributing a penny back, despite it being one of the richest companies in the world
This is a very strange bug: it appears as if the introspection that allows running flake8 from nbqa is pulling the flake8 module from the wrong location (another project) instead of the flake8 that is installed by pip.
This had me confused for a long time, but I think this is a pretty deep problem with how the CLI is driving flake8
Steps to reproduce from a clean virtualenv:
(1) parlai (at version 1.5.0) has a module called flake8.py; this will be mistaken for the intended flake8 later on, which is why this weird dependency is installed (2) This is the repo that I was working on, when I noticed the issue, so the minimal path to reproducing the problem consistently (3) This repo is under active development, so I am pinning this set of bug-reproduction instructions here so that it doesn't change in the future (4) The result of this run demonstrates the problem. When I execute this line, I see:
The part about "Facebook" had me totally confused, because I couldn't fund any reference to this flake8 directive (PAI201) anywhere except parlai. The flake8 source code has no reference to Facebook either. But the flake8.py module inside of parlai does; this tells me that nbqa is grabbing the wrong flake when it introspects the environment to run the cli command.
Weird. Good luck!