5

I want to highlight unused Python imports as Python syntax errors.

For example, I sometimes forget to remove some packages used for debugging such as time, ipdb. It would be great to see warnings or even errors for the unused imports.

I use Syntastic plugin, but it does not highligh the unused imports or I don't know how to configure it. I have this Syntastic setting set:

let g:syntastic_python_checkers = ['python', 'flake8']
2
  • You would need to configure a tool that checks for unused imports and integrate it syntastic. According to this flake8 should provide such detection
    – D. Ben Knoble
    Commented Apr 8, 2019 at 12:45
  • You are right, the checks for unused imports are part of flake8. The problem was, that I forgot to install flake8 package into my virtual environment.
    – niekas
    Commented Apr 8, 2019 at 13:41

1 Answer 1

4

Flake8 already supports checking for unused imports and is integrated with Syntastic.

Python developers should make sure to install flake8 into their user or virtual environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.