PyFlakes installation and TextMate integration


Go to Frontpage Next Article

PyFlakes is a tool to identify common mistakes in Python source-code. This includes:

Installation

Because of a few noteable fixes over the latest stable release (0.2.1) from October 2005, I'm going to describe how to install the latest trunk from the Subversion repository.

The first thing we're going to do is a checkout in a directory called pyflakes:

svn co http://divmod.org/svn/Divmod/trunk/Pyflakes pyflakes

After that, we create the symbolic links to the Python site-packages directory and a binary path (here: /usr/local/bin).

ln -s `pwd`/pyflakes/pyflakes SITE-PACKAGES-DIR/pyflakes
ln -s `pwd`/bin/pyflakes /usr/local/bin

The Python site-packages directory can be found by invoking the following command:

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

TextMate integration

The Python bundle for TextMate includes the PyCheckMate script which has support for PyChecker, PyLint and PyFlakes. The bundle is installed in a default TextMate installation.

PyCheckMate automatically checks for and chooses one of the supported programs mentioned above. To change this, we can modify the TM_PYCHECKER variable in ~/.bash_profile:

export TM_PYCHECKER=pylint

The supported values are:

Setting the variable is not needed when only PyFlakes is installed.

To perform the check in TextMate, go to Bundles -> Python -> Validate Syntax (PyCheckMate) or press the shortcut Ctrl-Shift-V.


Published June 28, 2008 • Tagged as pyflakes, python, textmate


Comments

blog comments powered by Disqus