Using Emacs As A Python Ide

  • Published: July 10, 2017

Overview

This is a collection of task I find useful when working with Python projects.

Common workflow

Set up

Generate TAGS table

Create a TAGS file that include Python’s library definitions, your current project identifiers and site packages definitions.

For example to create them in a Makefile:

PYTHONPATH:=/usr/lib/python3.6/
VIRTUALENV_PATH:=~/.virtualenvs/myproject
SITEPACKAGES:=$(VIRTUALENV_PATH)/lib/python3.6/site-packages/
tags:
	rm -f TAGS
	find $(PYTHONPATH) -type f -name '*.py' -print0 | xargs -0 etags -a	
	find . -type f -name '*.py' -print0 | xargs -0 etags --append
	find $(SITEPACKAGES) -type f -name '*.py' -print0 | xargs -0 etags -a

Virtualenv

  • Activate the virtual environment

    (pyvenv-workon)

Python process

Run an inferior Python process to send buffers and defuns.

(run-python)

Developing

Completion

Two ways to complete text in Emacs:

  • After visiting a TAGS table:

    helm-etags-select
  • Start writing a variable and complete its name:

    C-M-i       completion-at-point
Uruguay
Marcelo Canina
I'm Marcelo Canina, a developer from Uruguay. I build websites and web-based applications from the ground up and share what I learn here.
comments powered by Disqus
Except as otherwise noted, the content of this page is licensed under CC BY-NC-ND 4.0 ·