Opened 15 years ago
Last modified 13 years ago
#565 new defect
Provide alternative recipe serialization formats in addition to XML
Reported by: | anatoly techtonik <techtonik@…> | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.6.1 |
Component: | Recipe commands | Version: | 0.6b2 |
Keywords: | Cc: | ||
Operating System: | BSD |
Description
XML is not suitable for writing configurations. All these closing tags are unpythonic, and quoting is absolutely non-user friendly. Yes, it allows parsing and transformation, but it appears that it is less readable, the parsers are complicated and XSLT transformers are heavyweight.
I propose to provide alternative, less verbose and more user friendly formats for Bitten recipes (YAML, JSON?) and serializers/unserializers for them.
Grep Joel also http://www.joelonsoftware.com/articles/fog0000000319.html
Attachments (1)
Change History (4)
comment:1 Changed 15 years ago by hodgestar
comment:2 Changed 15 years ago by anatoly techtonik <techtonik@…>
Can serializer/unserializer logic be factored out into interchangeable component? XML is an intermediate format and I can't see any problem in using any other intermediate format. The XML is no less obscure that YAML if you don't kwno either. YAML can be limited to useful subset and explained. I don't think somebody will care to explain XML proper quoting rules and why namespaces are so strange looking in XML, why can't you use import statements like in Python itself.
I've seen Ruby Cucumber used for Behavior Driven Development and was really impressed by their "recipes". This is the way of the future, not XML. Bitten should at be extensible to allow that support in future.
comment:3 Changed 13 years ago by Emmanuel BOUAZIZ <ebouaziz@…>
Hi,
I've made a modification to Bitten so that it accepts recipes written in YAML with a specific structure. The recipe is stored in YAML. XML recipes still work of course.
It's mainly a function that converts the YAML recipe in XML using the PyYaML module and the Element class from xmlio.py and couple of lines changed in admin.py and master.py to make the conversion when needed.
A step looks like this:
id: checkout description: Checkout source from repository action: command: svn:checkout parameters: url: svn://svn.mydomain.tld/sdk path: ${path} revision: ${revision}
A recipe is just a sequence of steps.
Also actions can be used instead of action and contain a sequence of command/parameters maps.
diff with Bitten:trunk@1006 attached.
Is simple XML really that hard?
I'm not really an XML fan either but this seems like a lot of work for little if any gain. Bitten already uses XML in other places (notably communicating with the slave) and even in configuration files makes use of XML features that I don't think are present in JSON (e.g. namespaces). YAML is too obscure.
XML also has the advantage of looking a lot like HTML which means straight forward recipes are likely to be understandable by anyone who has a passing familiarity with HTML.
Joel is a cool guy, but I don't think Bitten recipes are going to get large enough to trouble typical XML parsers any time soon.
If you are really against XML I think the first place we need to switch from XML to something else is attachment uploads from slaves. :)