[IPython-user] cluster file syntax
Fernando.Perez at colorado.edu
Thu Mar 16 15:20:00 CST 2006
Brian Granger wrote:
> While we are making this change, do we want to also change the format
> of this file? It would be nice to have it be human readable/editable.
> My preference would have it be a valid python file, but I am not sure
> of the best way of doing this. You have thought a lot more about
> config files than I have. Any thoughts?
Well, the big question with config files is whether to use python itself as
the language, or something else and parse it. Brief comparison:
1. Use python.
Pros: no parsing required (well, we get it for free from python itself),
extremely flexible for the users, they can put any logic they want.
Cons: security, mostly: arbitrary code can execute there. And a little bit of
potential complexity, as variables need to be declared in the file.
2. Use something else.
The easiest in terms of dependencies is the basic ConfigParser format:
Pros: safe, easy to read and write. Security is really the big plus.
Cons: more parsing involved, and more work to transform values defined in the
file into python objects we need. Less flexibility for users (it's a
key/value file, not a programming language, so no logic allowed).
In this particular case, I'm not sure the security issue is that big of a
deal, since this is a system to execute arbitrary python code anyway. But
given how paranoid one may want to be...
For ipython itself, I'm /definitely/ going with (1) in the future, but that's
an easy one. People load arbitrary code in their rc file anyway, it's just
that today's system makes it inconvenient; I want it to be easy.
For the cluster config format, we could certainly go with (2) if you prefer to
play it safe, even though it will be a tiny bit more work for us, and less
flexible for users.
More information about the IPython-user