{ "info": { "author": "Christian Kampka", "author_email": "christian@kampka.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development" ], "description": "yconf\n=====\n|Travis|_ |Pypi|_\n\nA wrapper for combining yaml configuration files and command line argument parsing.\nIt builds upon PyYAML_ for parsing yaml config files and argparse_ for handling command line arguments and adds the clue produce one unified program configuration.\n\n\nRequirements\n------------\n\n - Python 2.7+ or 3.2+\n - PyYAML >= 3.1\n\nConfiguration Environments\n--------------------------\n\nBecause configuration often differs depending on the environment, e.g. production and testing settings, yconf allows you to define multiple environments in a single configuration.\nThe current supported environemts are `production`, `staging` and `development`. For convenience, yconf is able to merge environment configuration to reduce redundancy, meaning that if the environment is set to `staging`, the configuration will inherit all settings available in a `production` environment and override them with `staging` values where neseccary.\n\nExample\n```````\n\nconfig.yml\n\n::\n\n production:\n rundir: /var/run/example\n database: /var/lib/example/db.sqlite\n loglevel: warning\n\n staging:\n database: :memory:\n\n development:\n loglevel: debug\n\nConfiguration\n\n::\n\n # production environment\n config.rundir: /var/run/example\n config.database: /var/lib/example/db.sqlite\n config.loglevel: warning\n\n # staging environment\n config.rundir: /var/run/example\n config.database: :memory:\n config.loglevel: warning\n\n # development environment\n config.rundir: /var/run/example\n config.database: :memory:\n config.loglevel: debug\n\nBoth `staging` and `development` environments are optional.\n\nIf a directory is specified instead of a configuration file, yconf will\nlook for configuration files by convention of .yml in that\ndirectory and merge them accordingly if possible.\n\n\nCommand Line Arguments\n----------------------\n\nExtending the argument list supported by a configuration will require subclassing `yconf.BaseConfiguration` and overriding the `makeParser` method.\n\nExample\n\n::\n\n import sys\n from yconf import BaseConfiguration\n\n class MyConfig(BaseConfiguration):\n\n def makeParser(self):\n parser = super(MyConfig, self).makeParser()\n parser.add_argument(\"-f\", \"--foo\", dest=\"foo\")\n return parser\n\n\n config = MyConfig()\n config.parse(sys.argv[1:])\n\n\nThe following configuration arguments are already preset:\n\n - `-c` Path to configuration file or directory\n - `-e` The environment used for configuration (default: production)\n\nWhen present, command line argument always take precedent over configuration settings. To override nested yaml values, a dotted destination path can be set for the argument.\n\nconfig.yml\n\n::\n\n logging:\n loglevel: debug\n\nArgument\n\n::\n\n parser.add_argument(\"--log-level\", dest=\"logging.loglevel\")\n\n\nAccessing Configuration\n-----------------------\n\nConfiguration can be accessed either by attribute or by key.\n\n::\n\n config = MyConfig()\n config.parse(args)\n\n config.foo == config['foo']\n config.foo.bar == config['foo']['bar']\n\n\n\n.. _PyYAML: http://pyyaml.org/\n.. _argparse: http://pypi.python.org/pypi/argparse\n.. |Travis| image:: https://travis-ci.org/kampka/yconf.png?branch=master\n.. _Travis: https://travis-ci.org/kampka/yconf/jobs/167164716#\n.. |Pypi| image:: https://badge.fury.io/py/yconf.svg\n.. _Pypi: https://badge.fury.io/py/yconf", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kampka/yconf", "keywords": "", "license": "BSD-3", "maintainer": "", "maintainer_email": "", "name": "yconf", "package_url": "https://pypi.org/project/yconf/", "platform": "", "project_url": "https://pypi.org/project/yconf/", "project_urls": { "Homepage": "https://github.com/kampka/yconf" }, "release_url": "https://pypi.org/project/yconf/0.4/", "requires_dist": null, "requires_python": "", "summary": "Wrapper that combines argparse with yaml config files.", "version": "0.4" }, "last_serial": 5399783, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "0eb16484fb41931860c602842c86f261", "sha256": "1e1d3f189031e9c3b2c5d09732db3a9e987f5205ca4e424ab1b9306f9388c48b" }, "downloads": -1, "filename": "yconf-0.3.1.tar.gz", "has_sig": false, "md5_digest": "0eb16484fb41931860c602842c86f261", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7320, "upload_time": "2013-02-04T14:57:24", "url": "https://files.pythonhosted.org/packages/ca/2c/39fb5c239fed9bef025e7fd3ab0d016daafd521d5eebd4ca9846c6a69647/yconf-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "45fb2bb0414c7d8613bf7a99f2d5f407", "sha256": "8bf53b9917ee6d3315734dffd6e9d459e4f02684ade6e773ce6901b489fd2519" }, "downloads": -1, "filename": "yconf-0.3.2.tar.gz", "has_sig": false, "md5_digest": "45fb2bb0414c7d8613bf7a99f2d5f407", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7580, "upload_time": "2013-03-12T21:16:40", "url": "https://files.pythonhosted.org/packages/25/4b/45a37f6a5d4a9ce065ca33ae06e5ffbadddbb01beb43c18024133d12eaeb/yconf-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "fc9afd8f7b285e6623d406dcf7107e3b", "sha256": "ac21c07567a777891268317480bbe94757f25b0a9fbd51aebd1991d77810df62" }, "downloads": -1, "filename": "yconf-0.3.3.tar.gz", "has_sig": false, "md5_digest": "fc9afd8f7b285e6623d406dcf7107e3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7560, "upload_time": "2014-05-17T08:07:38", "url": "https://files.pythonhosted.org/packages/2d/6f/859b1b69aebea3ac68af62e63fc4e40d8d1e9e66bf2c92ae055680294efb/yconf-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "12d3835de987f05cfce15e2e9d847022", "sha256": "c502cd49b8d66a024be2fc11de2661744deae438e44a2bad9f440fb67a0391d6" }, "downloads": -1, "filename": "yconf-0.3.4.tar.gz", "has_sig": false, "md5_digest": "12d3835de987f05cfce15e2e9d847022", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7926, "upload_time": "2017-04-23T10:07:04", "url": "https://files.pythonhosted.org/packages/cd/dc/c745bd588b2b7e8873dc618a6849f64c1e6d30a9e4a262a75886b0d994ea/yconf-0.3.4.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "ad49be187e741865bbb7361838b5aa7d", "sha256": "e9e81184915807a4327fe835837534ad606f1d8d5635b321f8ca961d139abcab" }, "downloads": -1, "filename": "yconf-0.4.tar.gz", "has_sig": false, "md5_digest": "ad49be187e741865bbb7361838b5aa7d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7978, "upload_time": "2019-06-14T09:28:38", "url": "https://files.pythonhosted.org/packages/23/40/eb5be1f2d54b12b60b79312d1f20b3e89d20feb6914506403cef97b081cd/yconf-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad49be187e741865bbb7361838b5aa7d", "sha256": "e9e81184915807a4327fe835837534ad606f1d8d5635b321f8ca961d139abcab" }, "downloads": -1, "filename": "yconf-0.4.tar.gz", "has_sig": false, "md5_digest": "ad49be187e741865bbb7361838b5aa7d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7978, "upload_time": "2019-06-14T09:28:38", "url": "https://files.pythonhosted.org/packages/23/40/eb5be1f2d54b12b60b79312d1f20b3e89d20feb6914506403cef97b081cd/yconf-0.4.tar.gz" } ] }