[IPython-user] pysh variable substituion and scope

Fernando Perez fperez.net at gmail.com
Sun Jun 4 16:47:01 CDT 2006

On 6/4/06, Krishna Mohan Gundu <gkmohan at gmail.com> wrote:


> All I want really is the ability to run shell commands with variable
> substituion from anywhere in the python code. I am not thinking big
> now.


I appreciate your efforts, so I'll just give you a few suggestions to
ensure you don't waste time unnecessarily:

Prepare these ideas as an ipython profile, for testing and evaluation.
 This stuff is doing things nasty enough that it will be a /lot/
better to play with them without patching iplib directly.  You can
start by copying the sh profile from the distro (call yours sh2 or
whatever), and add your modifications there.  You can monkeypatch the
ipython object to inject your enhanced ipsystem() method, as well as
doing anything else you want to propose.

With this as a user extension, it becomes trivial for others to
download and test your idea within their system-installed ipython (not
everyone runs out of SVN).  If some usage proves that everything does
work correctly, and that it really offers real-world benefits in the
long run, it won't be a problem to fold this back into the core
ipython code.  But if problems appear, no harm was done and we won't
have to disentangle changes into thte core later on.

It's natural for new users, when wanting to extend ipython for their
needs, to reach directly into the core.  But you should realize that
ipython is meant to be extensible 'from the outside', and in general
that's how it should be done, at least until the benefits of an
internal modification are clear and their safety is established.

We'll be tagging 0.7.2 for release in a day or two, and will release
it on Wednesday, so these ideas will obviously be 0.7.3 material.
Since Ville is very interested in shell usage, I'm sure he'll be able
to provide you with good feedback during that cycle.



More information about the IPython-user mailing list