Skip to main content

Python viper

Project description

Python Viper

This project was inspired by spf13/viper.

Installation

pip install py-viper

Usage

Using viper.bind_flags in fire

import fire
import viper


@viper.bind_flags(flags=[
    viper.Flag(name='name', value='foo', usage='Indicate name'),
])
def hello():
    return "Hello %s!" % viper.get('name')


if __name__ == '__main__':
    fire.Fire(hello)

Reading config by viper

import tempfile
import viper

yaml_example = b'''
hello:
  name: foo
'''

if __name__ == '__main__':
    with tempfile.NamedTemporaryFile(suffix='.yaml') as temp:
        temp.write(yaml_example)
        temp.seek(0)
        viper.set_config_path(temp.name)
        viper.read_config()
        assert viper.get('hello.name') == 'foo'

TODO

  • [x] Read remote config
  • [ ] Dumps config to

Project details


Download files

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

Files for py-viper, version 0.1.0.dev2
Filename, size File type Python version Upload date Hashes
Filename, size py-viper-0.1.0.dev2.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page