rlcompleter2
home issues mailman

V0.95 - Python command line completion - Holger Krekel

One of the best features of python is that you can use and learn it interactively. rlcompleter2 enhances this interactive experience. It is a major improvement over the rlcompleter module in the 2.2 standard lib. I recommend that you simply install it and see if you like it. User interface is simple: hit <tab> one or more times during typing your python statements. If you sometimes use python interactively you will certainly enjoy it. If you don't work interactively then you should :-)

Quick start

requirements: Python-2.2.x (2.2.2 recommended) with working readline module.

  • make sure that you have the readline module installed, i.e. import readline works without errors. Readline support is available on a wide range of unix/linux platforms and within the Windows CYGWIN environment.
  • download rlcompleter2-0.94.tgz
  • unpack with e.g. tar zxvf rlcompleter2-0.94.tgz
  • change into unpacked directory and execute python -i rlcompleter2.py

Permanent install with distutils

There is only one module which needs to be installed but for your convenience you can use distutils:

  • install rlcompleter2.py into your site-packages directory: python setup.py install
  • set your environment variable PYTHONSTARTUP to a file which contains
       import rlcompleter2
       rlcompleter2.setup()
       del rlcompleter2 
    
    you want to set PYTHONSTARTUP permanently in your shell startup such as e.g. .bash_profile
  • now simply invoke python and the completer will be there.

list of features

  • completion on any valid Python statement/expression
  • many convenient completions, for example
    
      func(<tab>   presents function signatures and docs
      module.<tab> presents module docstring
      func<tab>    completes '(' or '()' 
      obj<tab>     completes '.' if obj is module or instance
    
  • when you hit multiple times you will get increasing details about multiple completions
  • the completer tries to autodetect your terminal height and width.
  • shows type information for multiple matches. types are abbreviated by three characters.
  • customaizable via the config class which you can inherit read the source of the Config class.

consult the README for further information.

have fun, holger krekel <hpk at trillke net>, 18th January 2003