PySmell


Ⅰ. 插件描述

PySmell is an attempt to create an IDE completion helper for python.

Ⅱ. 基本信息

创建日期:  2008-08-25
使用用户:  4
Github星:  264
插件作者:  Orestis Markou

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'orestis/pysmell'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'orestis/pysmell'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'orestis/pysmell'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/orestis/pysmell

Ⅳ. 文档说明

#PySmell

PySmell is a python IDE completion helper.

It tries to statically analyze Python source code, without executing it,
and generates information about a project's structure that IDE tools can
use.

There is currently support for Vim, Emacs and TextMate. Feel free to contribute
your own favourite editor bindings, or to improve the existing ones.

Download and Installation

PySmell is available at PyPI. The best
way to install PySmell is by downloading the source distribution and doing
python setup.py install. While easy_install pysmell also works, I haven't
yet found a way of distributing the editor scripts with it (suggestions welcome).

You should be able to import pysmell inside your Python interpreter and invoke
pysmell at the command line.

You can track the development of PySmell by visiting
GitHub. You can click 'Download'
to get it as a zip/tar if you don't have git installed. `python setup.py
develop` will setup your enviroment.

Usage

Before you invoke PySmell, you need to generate a PYSMELLTAGS file:

cd /root/of/project
pysmell .

If you want to specifically include or exclude some files or directories
(eg. tests), you can use:

pysmell [Package Package File File ...] [-x Excluded Excluded ...]

Check for more options by invoking pysmell without any arguments

Using external libraries

PySmell can handle completions of external libraries, like the Standard
Library and Django.

To use external libraries, you have to first analyze the libraries you
want, eg. for stdlib:

pysmell . -x site-packages test -o ~/PYSMELLTAGS.stdlib

This will create PYSMELLTAGS.stdlib in your HOME. Copy that in the root
of your project, and repeat for other libraries by changing the

  1. Note that you still have to have a root PYSMELLTAGS file with
  2. extension at the very root of your project.

Partial tags

Sometimes it's useful to not pollute global namespaces with tags of
sub-projects. For example, assume that there is a Tests package, which
has hundreds of tests, together with a few testing-related modules. You
only want to see these completions when working on test file.

To accomplish that, you can put PYSMELLTAGS.* files inside
subdirectories, and they will be used only when you're working on a file
somewhere in that directory or its children.

pysmell Tests/FunctionalTest.py Tests/UndoTestCase.py -o Tests/PYSMELLTAGS.Tests

The information in FunctionalTest and UndoTestCase will only be
accessible when editing a file inside the Tests package.

Vim

To use PySmell omnicompletion from inside Vim, you have to have:

  1. Python support in vim (:echo has('python'))
  2. The pysmell package in the PYTHONPATH that Vim uses: python import pysmell should work.
  3. Drop pysmell.vim in ~/.vim/plugin
  4. :setlocal omnifunc=pysmell#Complete Note: If you want to always use pysmell for
    python, do: autocmd FileType python setlocal omnifunc=pysmell#Complete
  5. [OPTIONAL] Select a matcher of your liking - look at pysmell.vim for
  6. Eg: :let g:pysmell_matcher='camel-case'

You can then use ^X^O to invoke Vim's omnicompletion.

You can generate debugging information by doing:

:let g:pysmell_debug=1
:e PYSMELL_DEBUG

Debug information will be appended in that buffer, copy and paste it
into the report.

TextMate

Double-click PySmell.tmbundle :)

Complete with alt-esc - look into the bundle for more commands.

You can find the bundle in the source distribution - it's not installed
with the egg, because it's too much trouble.

Set TM_PYTHON in your Shell Variables to point to the Python where you
installed PySmell.

Emacs

Put pysmell.el into your load-path, and inside your .emacs file put:

(require 'pysmell)
(add-hook 'python-mode-hook (lambda () (pysmell-mode 1)))

Complete with M-/, create tags with M-x pysmell-make-tags

Pymacs is required as well.

Reporting issues

PySmell is hosted at Google Code.

Look in the issues list first.
Star issues that you feel strongly about, or create your own.

If you can create a unit test that exposes that behaviour, it'd be great!

添加新评论