[Zope3-dev] Re: Re: Re: More thoughts on packaging

Jeff Kowalczyk jtk at yahoo.com
Fri Feb 20 14:20:07 EST 2004


(getting one clarification in under the wire, deferring respectfully to
the wise alternatives=temporarilyPointless edict hereafter)

ZCML and ZConfig are the permanent standards, granted. Alternatives
shouldn't distract from necessary tasks, and shouldn't expect to replace
either standard. I suggest YAML as one possibility, when mention is
occasionally made that alternatives are of interest to some.

YAML is only a serialization language. The information model corresponds
to python's native data structures. For reasonable data it has reasonable
line noise, compared to other formats of equivalent capability. Compare
this example and its parsed result in python. Advanced features would add
line noise in exchange for de-serialization directly to specific types
(e.g. classes Invoice, Person, Address and Product, instead of strings).
If using those features, one can simplify or eliminate pre-serialization
and post-parse duties such as iterating over DOM elements or parsing
string values into specfic types.

If YAML had anything to do with packaging, it would be as an expression of
the metadata, not any imperative commands. Some of that metadata could be
(cross-platform) command objects, which could be managed properly by an
improved distutils, then the packaging format wouldn't have any directly
executed imperatives. Sort of like ebuilds, without the bare shell
scripting.

Because the information models are different, a direct YAML-ZCML mapping
is not worthwhile. However, YAML corresponding to parsed ZCML (and
ZConfig) data structures may be interesting, at an appropriate juncture in
Z3 development.

Until then, heeding reasoned warnings of pointlessness...


YAML Source, one unnamed document:

---
invoice: 34843
date   : 2001-01-23
bill-to: &id001
    given  : Chris
    family : Dumars
    address:
        lines: |
            458 Walkman Dr.
            Suite #292
        city    : Royal Oak
        state   : MI
        postal  : 48046
ship-to: *id001
product:
    - sku         : BL394D
      quantity    : 4
      description : Basketball
      price       : 450.00
    - sku         : BL4438H
      quantity    : 1
      description : Super Hoop
      price       : 2392.00
tax  : 251.42
total: 4443.52
comments:
    Late afternoon is best.
    Backup contact is Nancy
    Billsmer @ 338-4338.


Parsed structure using simple types, no explicit typing used, parser set
for no implicit typing (all scalars become strings), mapping order
preserved for readability:

{'invoice': '34843',
 'date': '2001-01-23',
 'bill-to':
    {'given': 'Chris',
     'family': 'Dumars',
     'address':
        {'city': 'Royal Oak',
         'lines': '458 Walkman Dr.\nSuite #292\n',
         'state': 'MI',
         'postal': '48046',}},
 'ship-to':
    {'given': 'Chris',
     'family': 'Dumars',
     'address':
        {'city': 'Royal Oak',
         'lines': '458 Walkman Dr.\nSuite #292\n',
         'state': 'MI',
         'postal': '48046',}},
 'product': [{'sku': 'BL394D',
              'quantity': '4',
              'description': 'Basketball',
              'price': '450.0'},
             {'sku': 'BL4438H',
              'quantity': '1',
              'description': 'Super Hoop',
              'price': '2392.00'}],
 'tax': '251.42',
 'total': '4443.52',
 'comments': 'Late afternoon is best. Backup contact is Nancy Billsmer @
 338-4338.\n'}





More information about the Zope3-dev mailing list