There are existing scripts out there that will run flake8 against a python file in BBEdit, but none of them worked quite the way I wanted. So here is mine:
Before you can run this, you need to install flake with sudo easy_install flake8
. Then you need to drop this script in ~/Library/Application Support/BBEdit/Scripts
. You can launch it from the menu with the script icon.