With the power of python-anyconfig, moban-anyconfig allows moban to use more data formats than yaml and json.
Given the following toml file, sample.toml:
title = "TOML Example" [owner] name = "Tom Preston-Werner"
You can do:
$ moban -c sample.toml "{{owner.name}} made {{title}}"
Templating {{owner.na... to moban.output
Templated 1 file.
$ cat moban.output
Tom Preston-Werner made TOML Example
Not limited to toml, you can supply moban with the following data formats:
Format | Type | Requirement |
---|---|---|
JSON | json | json (standard lib) or simplejson |
Ini-like | ini | configparser (standard lib) |
Pickle | pickle | pickle (standard lib) |
XML | xml | ElementTree (standard lib) |
Java properties | properties | None (native implementation with standard lib) |
B-sh | shellvars | None (native implementation with standard lib) |
For any of the following data formats, you elect to install by yourself.
Format | Type | Required backend |
---|---|---|
Amazon Ion | ion | anyconfig-ion-backend |
BSON | bson | anyconfig-bson-backend |
CBOR | cbor | anyconfig-cbor-backend or anyconfig-cbor2-backend |
ConifgObj | configobj | anyconfig-configobj-backend |
MessagePack | msgpack | anyconfig-msgpack-backend |
Or you could choose to install all:
$ pip install moban-anyconfig[all-backends]
Why not to use python-anyconfig itself, but yet another package?
moban-anyconfig gives you a promise of any location which python-anyconfig does not support.
Why do it mean 'any location'?
Thanks to pyfilesystem 2, moban-anyconfig is able to read data back from git repo, pypi package, http(s), zip, tar, ftp, s3 or you name it.
You can install moban-anyconfig via pip:
$ pip install moban-anyconfig
or clone it and install it:
$ git clone https://github.com/moremoban/moban-anyconfig.git
$ cd moban-anyconfig
$ python setup.py install