GithubHelp home page GithubHelp logo

lamehost / schemed-yaml-config Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 156 KB

Validates YAML/TOML based configuration files against JSON Schema specifications

License: MIT License

Python 100.00%
yaml-configuration json-schema python toml-validation yaml-validator yaml toml configuration

schemed-yaml-config's Introduction

Schemed YAML Config

Schemed YAML Config is a library to read and validate YAML based configuration files against JSON Schema specifications.

Branches

The project is transitioning from v0.x to v1.x and master branch is used to develop the latter.
There's significant changes between v0.x and v1.x. And, while new user are encouraged to look into v1.x, that might be troublesome for those who have developed code around v0.x

Install

Schemed-yaml-config can be installed via PIP

# pip install schemed-yaml-config

Under the hood

Schemed YAML Config works by converting YAML files into a dictionarie by mean of the well known PyYAML framework and then by applying JSON Schema specifications before of returning it to rest of the script.
The beauty of this approach is it combines the human friendly serialization of YAML with the power of JSON Schema.

A few tricks has been added to make the library even more human friendly. For instance when the a configuration file is missing and a default is created, order and comments of the keys from the schema are borrowed to the YAML file.

Syntax

Python 3.7.4 (default, Aug 21 2019, 16:01:23)
[GCC 9.2.1 20190813] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from schemed_yaml_config import get_config
>>> config = get_config('config.yml', 'schema.yml')
>>> print(config.config)
{'listen': {'host': 'localhost', 'port': 8080}, 'tmpdir': '/tmp/'}
>>>

TOML

Despite its name Schemed YAML Config also supports TOML. TOML schemas are not supported yet!

schemed-yaml-config's People

Contributors

lamehost avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.