pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
707 stars 87 forks source link

Function Annotations with flycheck #352

Closed silgon closed 5 years ago

silgon commented 5 years ago

I'm having some problems with flycheck while using anaconda mode. I activate my environment with pythonic-activate which some version of python 3, however, I don't seem to be able to use function annotations with flycheck. A simple example:

function_annotations The message in the minibuffer is just invalid syntax.

I'm not sure if it's me who has misconfigured something, but I cannot seem to solve this issue.

proofit404 commented 5 years ago

Hi, thanks for the report.

anaconda-mode has no functionality related to flycheck.

I think you should report it in the flycheck repo.

silgon commented 5 years ago

Thanks for the reply @proofit404 , what do you use to validate your syntax when you're using anaconda-mode?

proofit404 commented 5 years ago

Flycheck flake8 works for me out of the box. I usually install it inside the virtual environment I activate with pythonic.

silgon commented 5 years ago

Sorry for the late response. I use pythonic-activate with my virtual environment and yet flycheck doesn't work. I'm using anaconda to generate my virtual environment though. It should be it I think....

silgon commented 5 years ago

Well... In the end what seems to solve the issue (at least for me) is the following workaround:

(defun my-pythonic-activate (virtualenv)
  "Activate python VIRTUALENV."
  (interactive "DEnv: ")
    (progn
        (setq flycheck-python-pycompile-executable (concat virtualenv "bin/python"))
        (setq flycheck-python-flake8-executable (concat virtualenv "bin/flake8"))
        (setq flycheck-python-pylint-executable (concat virtualenv "bin/pylint"))
        (setq python-shell-virtualenv-root (pythonic-python-readable-file-name virtualenv))
        (flycheck-mode -1)
        (flycheck-mode t)
        ))

I just leave that part of code here to document the problem.