Skip to content

Read data of ANY format in ANY location for moban template rendering

License

Notifications You must be signed in to change notification settings

moremoban/moban-anyconfig

Repository files navigation

moban-anyconfig

https://codecov.io/github/moremoban/moban-anyconfig/coverage.png https://pepy.tech/badge/moban-anyconfig/month https://img.shields.io/github/stars/moremoban/moban-anyconfig.svg?style=social&maxAge=3600&label=Star https://dev.azure.com/moremoban/moban-anyconfig/_apis/build/status/moremoban.moban-anyconfig?branchName=master

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:

Always supported formats, quoting from python-anyconfig
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.

Supported formats by pluggable backend modules
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.

Installation

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

About

Read data of ANY format in ANY location for moban template rendering

Resources

License

Stars

Watchers

Forks

Packages

No packages published