[IPython-dev] autoload and making %pydb be more ipythonic (was: Extensions/pydb_ipy.py added)
rocky at panix.com
Sat Nov 25 17:06:30 CST 2006
Ville M. Vainio writes:
> Well, this might save us some startup time & memory footprint.
> It should be quite easy to do, esp. for magics (and completers). We can
> easily inject stub callables in place of magics, which 1) import a
> specified module and 2) try to run the magic again.
> I think a good first line of action would be to add an ipapi function
> that permanently registers a magic name / completer trigger (or
> whatever) with ipython.
So this ipapi function doesn't exist yet, right?
> Here's what one could do e.g. in setup.py for pydb:
> import IPython.ipapi
> ip = IPython.ipapi.get()
> ip.register_autoload("%pydb", "pydb.ipy_pydb")
I'm guessing from the above that the ipapi function that needs to get
added is called "register_autoload", correct? (Right now I don't see
"register_autoload" in ipython sources.)
The other thing that is not clear to me where or when this
register_autoload is invoked. It has to have been invoked before
running the first time %pydb is entered by a user since the autoload
indicates what to import. It doesn't make sense to do anything when
installing pydb. And the goal here was to be able to run "%pydb"
without having to run an "import" first. And so it doesn't make sense
to put this as the initialization of an import, either.
The two natural places then would be in ipy_user_conf.py or
ipy_system_conf.py. And it looks like all of the other extensions in
ipython are imported in the latter.
More information about the IPython-dev