[IPython-dev] Configuration, hooks and plugins

Robert Kern robert.kern at gmail.com
Tue Jun 30 18:54:42 EDT 2009


On 2009-06-30 17:44, Brian Granger wrote:
>> I like Mercurial's approach. Plugins are just Python packages/modules
>> exposing a
>> particular API. Having those packages installed *does not* enable them. To
>> enable them, you list the ones you want in the configuration file. Truth be
>> told, that's fairly similar to the current situation: you just import the
>> appropriate things in your ipy_user_conf.py and maybe activate them, except
>> that
>> there is no standardized plugin API.
>
> I too like this approach and a definitely think installing and
> enabling should be two different steps.
>
> How does Mercurial declare/discover plugins?  Does it use setuptools?

No. It reads the configuration files (~/.hgrc and the current repo's .hg/hgrc, 
if any) for a section that looks like this:

[extensions]
alias=
mq=
fetch=
bisect=
transplant=
hgk=
extdiff=
record=
purge=
#hgext.forest=/Users/rkern/hg/hgforest/forest.py
#hgext.qct=/Users/rkern/hg/qct/plugins/qct.py
graphlog=

The "foo=" lines are those plugins which are distributed with Mercurial itself, 
so there is a standard place to look for them. You can specify a particular path 
if it is not one of the standard plugins like the ones that I have commented out.

> I will look at this.  Because IPython plugin's are often extremely
> lightweight, it would be nice if users could simply drop them into
> .ipython/plugins for installation.

We already add ~/.ipython to the sys.path. If you want to to stop doing that, 
and only add ~/.ipython/plugins to the sys.path, that might be cleaner.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the IPython-dev mailing list