Skip to main content

An extensible config file format

Project description

yay ain't YAML
==============

yay is a configuration file format built on top of YAML based on our experience with the ConfigParser extensions buildout uses. It adds overlays (one config file including and extending another) and variables.

Consider a config file that looks something like this::

foo:
bar:
baz:
- 1
- 2
- 3
qux: wibble.wobble
quux: wobble

goo:
bar:
baz:
- 1
- 2
- 3
- 4
qux: wibble.cobble
quux: cobble

hoo:
bar:
baz:
- 1
- 3
qux: wibble.yobble
quux: yobble

With yay, this might look like this::

foo:
bar:
baz:
- 1
- 2
- 3
qux: wibble.{:quux}
quux: wobble

goo.copy: foo
goo:
bar:
baz.append:
- 4
quux: cobble

hoo.copy: foo
hoo:
bar:
baz.remove:
- 2
quux: yobble

Using yay
---------

To load yay config from a string you can use the 'load' function::

>>> from yay import load
>>> load("""
... foo:
... bar: 1
... """)
{"foo": {"bar": 1}}

If you want to load from a URI (file:// and http:// are supported) then use 'load_uri'::

>>> from yay import load_uri
>>> load_uri("/etc/someconfig.yay")
{"foo": {"bar": 1}}

The return value in both cases is a standard python dictionary.

Changelog for yay
=================

0.0.9 (2011-02-22)
------------------

- Don't chomp whitespace in templated_string


0.0.8 (2011-02-18)
------------------

- Replace 'foreach bar as foo' with 'foreach foo in bar'


0.0.7 (2011-02-16)
------------------

- Numbers starting 0 are treated as base 8.


0.0.6 (2011-02-13)
------------------

- Avoid unicode mapping keys where possible - they break **kwargs in Py2.x


0.0.5 (2011-02-09)
------------------

- Add support for nested foreach

- At least for now, support a ruby style .flatten


0.0.4 (2011-02-04)
------------------

- {foo} can be interpreted as a map by YAML. For now, we will use ${foo} to avoid this

- Function calls to python are implemented - there is now range()

- There is now a foo.select key so switch statements can be used

0.0.3 (2011-01-24)
------------------

- Egg packaging fixes


0.0.2 (2011-01-24)
------------------

- Lots more unittests for expression evaluation and expression parsing

- Drop dependency on OrderedDict

0.0.1
-----

- This is still pre-release, no API or language stability guarantees

- Variable resolving is now done in expression tree without a seperate resolve stage

- Uses pyparsing to parse {foo[bar][@.baz > 5]} type syntax

0.0.0
-----

- This is a pre-alpha release to experiment with what we can and can't do.

- New PyYAML Loader subclass for getting ordered maps without ugly !!omap markup

- Resolves {} markup within YAML nodes

- Lazily evaluates .copy, .append and .remove instructions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yay-0.0.9.tar.gz (49.1 kB view details)

Uploaded Source

File details

Details for the file yay-0.0.9.tar.gz.

File metadata

  • Download URL: yay-0.0.9.tar.gz
  • Upload date:
  • Size: 49.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yay-0.0.9.tar.gz
Algorithm Hash digest
SHA256 b9e05c3da1a91ce91cc163647489df50f90c91a9c4cc3ec57830d7b05e4470c0
MD5 c8f52eca209f0e5c31c36da3fe9693cb
BLAKE2b-256 5bf45a57ea944277f5808e41f7eeb72aebdf3c92e5867253c02e8a2e53c92cef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page