Re: RFC: new Invenio config file

2008-01-09 Thread Tibor Simko
Hello:

On Tue, 11 Dec 2007, Ferran Jorba wrote:

 The only grip is rather aesthetic; I'm getting tired about so much
 XML everywhere.

FWIW, I don't like XML config files either; I would take the good old
S-expressions any day over XML.  I thought of XML mostly for the two
reasons outlined before: similarity with Indico, plus per-module
dump-edit-load runtime config files (e.g. the collection setup) that
we shall soon have and that are currently XML based.

As for using something more human-oriented, I would prefer even more
compact INI-like format instead of JSON or YAML, since it is even more
readable and nicer to edit, and we already use it to some extent in
Invenio in the BibRank module (e.g. wrd.cfg).

However, this would introduce two different config file formats, one
INI-like for static-like application configuration (e.g. weburl,
dbhost, dbuser, etc), and several XML-like for dynamic-like site
runtime configurations (e.g. collection setup, access control setup,
etc).  This may not be ideal for coherence reasons, although one can
imagine such a split.

Another option would be to abandon XML and introduce an extended
INI-like format, for example with ConfigObj-like or gitconfig-like
constructs, that would be able to cover also the latter runtime
configurations too.

The choice is still open... We have a week or so to decide. ;-)

P.S. BTW, the author of my preferred window manager (=Ion), Tuomo
 Valkonen, has blogged about his config language choice here:
 http://modeemi.fi/~tuomov/b/archives/2007/01/20/T11_58_29/.
 I share his point of view on config formats to a large extent.

Best regards
-- 
Tibor Simko ** CERN Document Server ** http://cds.cern.ch/



Re: RFC: new Invenio config file

2007-12-11 Thread Ferran Jorba
Hi Tibor,

 The next step in the process of removing the dependency on WML is to
 replace the config.wml configuration technique we've been using so
 far.  Here is a brief outline of a schema I've been thinking about.
[...]

I like it; I like specially this magic inveniocfg tool!  I have nothing
to add, really.

The only grip is rather aesthetic; I'm getting tired about so much XML
everywhere.  And yes, I know that Invenio is heavy consumer and producer
of XML, so...  But if the config file would be written in something
simpler (for example JSON, see http://en.wikipedia.org/wiki/JSON)
instead, I think it would be easier both for humans and programs.

But again, I'd be more than happy if this roadmap gets implemented.

Thanks for asking,

Ferran



Re: RFC: new Invenio config file

2007-12-11 Thread Miguel Moreira

Hi all,

In the same line of thought, take a look at YAML as a possible alternative to 
JSON. A comparison:

http://en.wikipedia.org/wiki/JSON#YAML

YAML has a few extra features and looks more human-friendly than JSON.

Both currently have Python support.

If you decide to stick with XML, I would say that format 6c looks tidier than the other 
two. And actually, that cascading approach can equally be applied with XML, 
JSON or YAML.

Miguel.



On 11/12/2007 11:17, Ferran Jorba wrote:

Hi Tibor,


The next step in the process of removing the dependency on WML is to
replace the config.wml configuration technique we've been using so
far.  Here is a brief outline of a schema I've been thinking about.

[...]

I like it; I like specially this magic inveniocfg tool!  I have nothing
to add, really.

The only grip is rather aesthetic; I'm getting tired about so much XML
everywhere.  And yes, I know that Invenio is heavy consumer and producer
of XML, so...  But if the config file would be written in something
simpler (for example JSON, see http://en.wikipedia.org/wiki/JSON)
instead, I think it would be easier both for humans and programs.

But again, I'd be more than happy if this roadmap gets implemented.

Thanks for asking,

Ferran




RFC: new Invenio config file

2007-12-10 Thread Tibor Simko
Hello gang:

The next step in the process of removing the dependency on WML is to
replace the config.wml configuration technique we've been using so
far.  Here is a brief outline of a schema I've been thinking about.

1. We introduce a config.xml file resembling the WML original, of
   the form like:

  !-- ** SMTP SERVER CONFIGURATION * --
  !--
CFG_MISCUTIL_SMTP_PORT: define which port to use on the
outgoing mail server defined in the previous step.  (example:
25)
  --
  CFG_MISCUTIL_SMTP_PORT25/CFG_MISCUTIL_SMTP_PORT

   and we let admins customize this config.xml file.  It will closely
   resemble config.wml, hence no big change.  It will also resemble
   Indico's config.xml way of doing things, which is good for the CDS
   software house commonality for admins having both Indico and
   Invenio installed.  (We won't use Indico's hidden default
   parameters though.)

2. The autotools-generated variables, such as the location of the
   pdftotext auxiliary program, will still be generated automatically
   during configure-time and stored in some read-only configbis.xml
   independently.

3. During build-time, we shall generate config.py that will be
   identical to what we have now.  It will be constructed out of both
   config.xml and configbis.xml.  The Invenio codebase can therefore
   still do things like from invenio.config import CFG_FOO.  No
   changes are necessary here.

4. Both config.xml and configbis.xml will be installed into
   /opt/cds-invenio/etc place somewhere, so that admins could edit
   them anytime during runtime in order to change some configuration
   parameter.  They would then launch a new command tool such as:

  $ inveniocfg --update-config

   that will take their newly edited config.xml and update config.py.
   As a result, there will be no more need to keep Invenio sources
   hanging around on the disk after the initial Invenio installation
   of the demo site.

5. When upgrading from one Invenio release to another, admins would
   run a command like:

  $ inveniocfg --upgrade-config

   that would try to automatically merge newly distributed demo
   config.xml with their current, locally modified config.py.  The
   upgrade tool would merge silently what can be merged silently, and
   would prompt admins for an action in cases such as (a) a config
   variable made obsoleted or (b) a config variable changed its
   default value in between Invenio releases.

6. As for the format of the config.xml itself:

 a) The config.xml file could be a standalone editable file in a
simple format described above, always containing latest
customized values of users, such as:

   !-- ** SMTP SERVER CONFIGURATION *** --
   !--
 CFG_MISCUTIL_SMTP_PORT: define which port to use on the
 outgoing mail server defined in the previous step.
 (example: 25)
--
   CFG_MISCUTIL_SMTP_PORT/CFG_MISCUTIL_SMTP_PORT

The original Invenio installation would probably install
original files of the form config.xml_default_0.92.1 for
future reference, if admins want to change their config
parameters later during runtime without having to consult the
sources.

 b) The config.xml could possibly contain separate spaces for
default and custom values, such as:

invenio-config-param
   name=CFG_MISCUTIL_SMTP_PORT
   default-value=25
   custom-value=
   help=Defines which port ...

so that admins would have to add custom-value=... lines to
every parameter they would like to customize.  Or we could
have some ithaca.../ithaca conditionals to denote sections
overriding default values for a particular Ithaca
installation, thus keeping one config file for X sites admin
may maintain (DEV, TEST, PROD).

 c) Pushing the b) model further, we could have one generic
config.xml file, and one custom config_ithaca.xml file
where the admins would put only their custom changes, e.g.

   CFG_MISCUTIL_SMTP_PORT/CFG_MISCUTIL_SMTP_PORT

The system would take CFG_FOO parameter from this local file,
if it exists there, otherwise from the default file.

This resembles a bit the technique we currently use for the
style template skins, e.g. (big) webstyle_templates.py file
and (small) webstyle_templates_ithaca.py file that only
overwrites what has to be overwritten.  Thus admins would
basically have to maintain smaller diff files against the
distributed config files.

 (BTW, we plan to enlarge the template skin technique to other
 Invenio config files, e.g. HB.bfo (default) versus HB_ithaca.bfo
 (customized), or wrd.cfg (default) versus wrd_ithaca.cfg
 (customized).  This will