How can I use configured virtualenv and flake8 settings file (setup.cfg in root of project), for flycheck in emacs?
There are a number of plugins for working with virtualenvs. For example, with pyvenv installed I can use the pyvenv-workon command to select a virtualenv from $WORKON_HOME.
virtualenvwrapper and python-environment provide similar support, and all three are available on MELPA.
Flycheck has an option flycheck-flake8rc:
Configuration file for
`python-flake8'.
If you have per-project configuration files, it might be easiest to create .dir-locals.el files in the root of each project that sets flycheck-flake8rc to the appropriate value, e.g.
((python-mode
(flycheck-flake8rc . "/path/to/setup.cfg")))
I would advise not tracking .dir-locals.el in whatever version control system you are using, though of course that is up to you.
I spent some time to find right solution and decided to implement my own:
flycheck-local-flake8
This is plugin for flycheck-flake8 checker, simply uses flake8 from required virtualenv and setup.cfg from root of the python project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With