Optimize build: check flake8 before installing dependencies.