[IPython-dev] Package-specific extensions: an idea
Fri Jun 17 13:26:01 CDT 2011
On 6/17/11 12:04 PM, Brian Granger wrote:
> On Thu, Jun 16, 2011 at 11:45 PM, Fernando Perez<email@example.com> wrote:
>> On Thu, Jun 16, 2011 at 2:16 PM, Robert Kern<firstname.lastname@example.org> wrote:
>>> What would the user experience look like in this scenario?
>> Since the config file is executed when IPython isn't fully up yet,
>> it's not the place to put code that depends on IPython itself, that's
>> why we have the exec_files field. So I have in my config file this:
> But wait, extensions are loaded later when IPython has come up fully.
> Why not put this logic in the extension itself. IOW, have the
> extension call:
> that would fully keep all of the logic localized in the extension as
> it should be.
Except that you don't want to register a separate function for each extension.
You want to have a single function that deals with all of the delayed
activations. And you want to implement this logic exactly once, not reimplement
it in each extension that needs it.
How about this: we implement the logic that goes through the list of
('module_name', 'extension_name') pairs in an
InteractiveShell.check_deferred_extensions() method. We keep the configuration
in c.Global.deferred_extensions as I had it. We make no modifications to the
run_cell() method. Upon configuration, *if* deferred_extensions is not empty,
then the InteractiveShell uses
"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