[Twisted-Python] Twisted Plugins - Implementation Discussion

Stefano Debenedetti ste at demaledetti.net
Thu Apr 7 08:56:59 EDT 2011


On Apr 7, 2011, at 1:08 AM, Tim Allen wrote:
> If you need a non-Turing-complete config language and rule out .ini and
> XML, I'm not sure what's left. JSON, perhaps.

I bet a lot of people have a deja-vu feeling about a config file
syntax debate so I'll propose an alternative approach: RDF.

Perhaps most people in this community will not like it, yet some
might find it more fun that revamping their 2002 arguments about
merits and pitfalls of various syntaxes.

One of the reasons why I like RDF so much is that I can focus on
what I need to express and let people pick the serialization syntax
that better suits their mood, habits, tools and use-cases.

I know that the use-case that's being discussed is slightly
different (config files for the plugin system as opposed to config
files for a specific plugin) but as an example: my
twistd-plugin-driven webserver will gladly accept any of the
attached configuration files, they are equivalent and there are
commonly available tools to switch back and forth, including pure
python ones.

It could as well accept any other standard RDF serialization syntax,
for example there are several other XML formats, a line-based
grep-friendly syntax (NTriples) and a JSON format.

The code that parses this and turns it into running twisted Services
and web applications is about the same size of your average TAC
file. If anybody wants to see it please email me privately, I'm not
proud enough of other parts of my open source project containing it
to advertise it on this list.

Other than mentioning that RDF also comes with a standard query and
update language and protocol (SPARQL), I won't enumerate other
advantages here so let's see what some of drawbacks (and their
counter-arguments) are:

1) it's not widely known yet (but so was XML in 2000 and JSON in
2002 and INI in 2011)

2) it would require to add a dependency for an RDF parser (people
often argued the same way about XML, remember when libxml2 became a
Gnome dependency? RDF is now becoming a requirement of Gnome and KDE...)

3) it's not python (yet the several python object-RDF-mapper
libraries available seem to me much easier to use and way more
simple than SQLAlchemy so I already switched from pickle to RDF
whenever I want to serialize some object graph, BTW it's also safer
and hand-editable)

Sorry if I went too off-topic, ciao
ste


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: config.n3
Url: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110407/3ec2e941/attachment.txt 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.xml
Type: text/xml
Size: 1442 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20110407/3ec2e941/attachment.bin 


More information about the Twisted-Python mailing list