This week, we're going to look at my setup for Python programming.
I'm an educator, not a professional developer so I'm not working in huge code bases with dozens or more files at a time. I do periodically work in medium size code bases and will talk about cross file navigation and project management later on. There are also more powerful emacs Python packages. One being elpy. Elpy looks pretty cool but for me, it's overkill.
Today's about the basics.
The first tool I show is flycheck. It does code checking on the fly and supports tons of languages. You might have to install some external checkers though. For instance, I installed pylint for python syntax checking with:
sudo pip install pylint
Cofiguring flycheck is as easy as:
(use-package flycheck :ensure t :init (global-flycheck-mode t))
The video all shows how I like to run Python from within emacs.
The other tool I use is Jedi. It provides more extensive completion for Python.
Here's the setup:
(use-package jedi :ensure t :init (add-hook 'python-mode-hook 'jedi:setup) (add-hook 'python-mode-hook 'jedi:ac-setup))
The last hook sets up the autocomplete.
For jedi to work, you'll need to install the jedi server which is done in emacs by running M-x jedi:install-server. For that to work, though, you'll need to have Python Virtualenv istalled. I did that with:
EDIT: I just got a report that you might need to also install epc (sudo pip install epc).
sudo pip install virtualenv
Here's the video:
- Flycheck home page
- Video series overview page: