[Announce] tabhistory - tab completion and command history

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Sep 1 10:44:59 EDT 2014


I am happy to announce an upgrade to the tabhistory module, which brings
advanced tab completion and command history to Python 2.4 through 3.3 and
beyond.

========
Features
========

Tab completion
--------------

* At the beginning of lines, pressing the TAB key indents the line.

* Inside strings, pressing TAB performs filename completion of the string.

* Following the "import" and "from" keywords, pressing TAB completes on
  modules and module attributes. For security, module attributes are only
  checked if the module has already been imported and is in the sys.modules
  cache.

* Everywhere else, pressing TAB completes on keywords, built-ins, globals,
  and references of the form "name.name".

* Supports readline key binding and editing commands.


Command history
---------------

* Save command line history during interactive sessions, and automatically
  restore that history when you start up again.

* Use the up-arrow to call up previous commands, and down-arrow for 
  more recent ones.

* Display the last N command lines.


===============
Where to get it
===============

Clone the Mercurial repository:

hg clone https://code.google.com/p/tabhistory/

There is a single Python file, tabhistory.py. Put it somewhere on your
Python path, launch the interactive interpreter, and run:

import tabhistory

and it will be enabled.

If you don't have Mercurial, you can download the source code from here:

http://code.google.com/p/tabhistory/


===========
Limitations
===========

* This may not work on Windows at all. In theory, it might work if you
install the pyreadline third-party module, but I have no way of testing
this. Feedback from Windows users will be gratefully accepted.

* There may be some issues on Mac OS X or other Unixes which use libedit
instead of libreadline. I will be grateful for comments and bug fixes from
any libedit users.

* Python 3.0 is not officially supported (but it probably will work).



Bug reports, feature requests and other comments are welcome.

-- 
Steven




More information about the Python-list mailing list