{ "info": { "author": "Roman Rader", "author_email": "antigluk@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": ".. image:: https://img.shields.io/pypi/v/aio_yamlconfig.svg\n :target: https://pypi.org/project/aio_yamlconfig\n\n.. image:: https://img.shields.io/travis/rrader/aio_yamlconfig/master.svg\n :target: http://travis-ci.org/rrader/aio_yamlconfig\n\n.. image:: https://img.shields.io/pypi/pyversions/aio_yamlconfig.svg\n\n.. image:: https://img.shields.io/pypi/dm/aio_yamlconfig.svg\n\n\naio_yamlconfig\n========\n\nQuick Start\n------------------\n\nInstall from PYPI:\n\n.. code:: shell\n\n pip install aio_yamlconfig\n\nOR (less popular) via setup.py:\n\n.. code:: shell\n\n python -m setup install\n\nYAML configuration parser with validation using `Trafaret `_.\n\nIn the easiest setup without config validation, configure your ``aiohttp`` application with:\n\n.. code:: python\n :number-lines:\n\n CONFIG_FILE = os.path.join(os.path.dirname(__file__), \"config.yaml\")\n loop.run_until_complete(aio_yamlconfig.setup(app,\n config_files=[CONFIG_FILE],\n base_dir=os.path.dirname(__file__)))\n\nAssume you have ``config.yaml``:\n\n.. code:: yaml\n :number-lines:\n\n DEBUG: True\n TEMPLATES_DIR: !BaseDir path/to/templates\n\nThen you can access your config as:\n\n.. code:: python\n :number-lines:\n\n if app.config['DEBUG']:\n print('some debug information')\n\nNotice the ``!BaseDir`` tag. ``aio_yamlconfig`` can do some config transformations for you, in this case it will prepend\nthe base directory (passed as ``base_dir`` to ``setup()``) to your path. The variable ``app.config['TEMPLATES_DIR']`` will contain\nthe full path to directory with your templates.\n\nValidation\n--------------------\n\nTo validate your config we use the great library Trafaret. You can read more about it `in the docs `_.\nHere I'll give you a simple example of its usage.\n\nLet's write the validator for ``config.yaml`` above. We'd like to ensure that ``DEBUG`` value is boolean, and that\ndirectory of the path ``TEMPLATES_DIR`` really exists:\n\n.. code:: python\n :number-lines:\n\n import trafaret as t\n from aio_yamlconfig.trafarets import ExistingDirectory\n\n CONFIG_TRAFARET = t.Dict({\n t.Key('TEMPLATES_DIR'): ExistingDirectory,\n t.Key('DEBUG'): t.Bool\n })\n\n\nTo enable such validation pass the ``trafaret_validator`` to ``setup()`` function:\n\n.. code:: python\n :number-lines:\n\n loop.run_until_complete(aio_yamlconfig.setup(app,\n config_files=[CONFIG_FILE],\n trafaret_validator=CONFIG_TRAFARET,\n base_dir=os.path.dirname(__file__)))", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rrader/aio_yamlconfig", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "aio_yamlconfig", "package_url": "https://pypi.org/project/aio_yamlconfig/", "platform": "POSIX", "project_url": "https://pypi.org/project/aio_yamlconfig/", "project_urls": { "Homepage": "https://github.com/rrader/aio_yamlconfig" }, "release_url": "https://pypi.org/project/aio_yamlconfig/0.2.0/", "requires_dist": [ "PyYAML", "trafaret" ], "requires_python": "", "summary": "YAML configuration parser with validation.", "version": "0.2.0" }, "last_serial": 2557575, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3b237538677eed51426a06e968e3f217", "sha256": "700d5f9a0f02ae1be84c841b9063772c6e352b48ed9d1d35f6ef497ea7fcf79c" }, "downloads": -1, "filename": "aio_yamlconfig-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3b237538677eed51426a06e968e3f217", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2953, "upload_time": "2016-04-19T15:47:28", "url": "https://files.pythonhosted.org/packages/6c/31/af045fad46a371e3e2aa1ac26c44fd1a85bc3b7756022bc152344c05eaa1/aio_yamlconfig-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "181938c1154af1b29d419a9da30ee36b", "sha256": "19f12427319c464c7548b91bc8c5207586b4d31bc4c19d9449f798c712196866" }, "downloads": -1, "filename": "aio_yamlconfig-0.1.1.tar.gz", "has_sig": false, "md5_digest": "181938c1154af1b29d419a9da30ee36b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3010, "upload_time": "2016-04-19T16:54:52", "url": "https://files.pythonhosted.org/packages/84/d1/32f5a7db771cf4f6cfc226e1e6bdcc9b309eedc11a43a9603c476c56dbb2/aio_yamlconfig-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "7a36be9cae14e66b9ddae80386d8c72e", "sha256": "69d034a4f8e68d2c2e1413bba266752e691ccf671ef3b9edf8990b79f11eb613" }, "downloads": -1, "filename": "aio_yamlconfig-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7a36be9cae14e66b9ddae80386d8c72e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5844, "upload_time": "2017-01-06T10:54:52", "url": "https://files.pythonhosted.org/packages/d0/d5/cb4ca872e8bc0330674e200454b6980dfd3dd63a4676f52aef5d5cc70636/aio_yamlconfig-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb038b1e70cae09410755d4f28bdca98", "sha256": "e5812675c2c9003b84940d84721a0267e29673c41234de6513f9e766c8cf06ea" }, "downloads": -1, "filename": "aio_yamlconfig-0.2.0.tar.gz", "has_sig": false, "md5_digest": "eb038b1e70cae09410755d4f28bdca98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3440, "upload_time": "2017-01-06T10:54:54", "url": "https://files.pythonhosted.org/packages/fe/f2/e6650a5eac42893eb0d68bc9fe91283c4d0dee5535d446b91f2064e7dc28/aio_yamlconfig-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7a36be9cae14e66b9ddae80386d8c72e", "sha256": "69d034a4f8e68d2c2e1413bba266752e691ccf671ef3b9edf8990b79f11eb613" }, "downloads": -1, "filename": "aio_yamlconfig-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7a36be9cae14e66b9ddae80386d8c72e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5844, "upload_time": "2017-01-06T10:54:52", "url": "https://files.pythonhosted.org/packages/d0/d5/cb4ca872e8bc0330674e200454b6980dfd3dd63a4676f52aef5d5cc70636/aio_yamlconfig-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb038b1e70cae09410755d4f28bdca98", "sha256": "e5812675c2c9003b84940d84721a0267e29673c41234de6513f9e766c8cf06ea" }, "downloads": -1, "filename": "aio_yamlconfig-0.2.0.tar.gz", "has_sig": false, "md5_digest": "eb038b1e70cae09410755d4f28bdca98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3440, "upload_time": "2017-01-06T10:54:54", "url": "https://files.pythonhosted.org/packages/fe/f2/e6650a5eac42893eb0d68bc9fe91283c4d0dee5535d446b91f2064e7dc28/aio_yamlconfig-0.2.0.tar.gz" } ] }