{ "info": { "author": "Austin Bingham", "author_email": "austin@sixty-north.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only" ], "description": "|Python version| |Build Status|\n\n=========================================\n kfg: A configuration library for Python\n=========================================\n\n``kfg`` provides a ``Config`` class which contains your program's configuration\ndata. It lets you access, manipulate, and validate this data in a\nstraightforward way. It also provides a means to de/serialize the data.\n\nBasic usage\n===========\n\nSetting and retrieving configuration values\n-------------------------------------------\n\nGetting and setting configuration values is simple:\n\n.. code-block:: python\n\n from kfg.config import Config\n\n # construct a Config\n c = Config()\n\n # set the ('ui', 'font-color') value to 'blue'\n c['ui', 'font-color'] = 'blue'\n\n # retreive the value\n font_color = c['ui', 'font-color']\n\nUniform exceptions\n------------------\n\n``kfg`` provides a uniform set of exceptions that are used to signal configuration\nproblems. This means that your program can catch these exceptions and know that\nthey only ever indicate configuration problems. For example:\n\n.. code-block:: python\n\n c = Config()\n\n # kfg throws ConfigKeyError on missing keys.\n try:\n x = c['foo']\n except ConfigKeyError:\n print('foo not in the config')\n\nTransforms and validation\n-------------------------\n\n``kfg`` lets you associate a \"transform\" with a key. This transform is a 1-arity\ncallable that will be passed the stored value of the configuration option, and\n``kfg`` will pass the return value of the transform to the user when they access\nthe value. If a transform fails, ``kfg`` will raise a ``ConfigValueError``.\n\nThis lets you do two things. First, you can construct arbitrary values from\nstored configuration information in a centralized way, i.e. mediated by the\nconfiguration. Second, it let's you validate configuration values. For example:\n\n.. code-block:: python\n\n c = Config()\n c['processing', 'timeout'] = \"10 seconds\"\n c.set_transform(('processing', 'timeout'),\n float)\n\n c['processing', 'timeout'] # Raises ConfigValueError because ``float``\n # can't parse \"10 seconds\"\n\nThis system is intentionally low-powered and simple. For example, ``kfg`` allows\nyou to *set* values which violate the transform. The goal is not to create\ncompletely water-tight configurations, but rather to create systems which are\neasy to get right and which warn you when you might be using an invalid value.\n\n\nRationale\n=========\n\nThere's no real rocket science in ``kfg``, and you can get most of its features\njust by using dictionaries, lists, tuples, etc. There are a few problems with\nusing \"raw\" data structures like that for configuration, though.\n\nFirst, you'll get standard exceptions like ``KeyError`` and ``IndexError`` when you\ntry to access missing values. Since these kinds of errors can come from almost\nanywhere in a system, it's not easy to differentiate between those that come\nfrom configuration problems and the others. By providing specialized\n\"configuration\" errors, you can catch ``kfg`` exceptions and be confident that\nthey point to configuration errors.\n\nSecond, ``kfg`` lets you centralize the basic configuration\nvalidation/transformations. Configuration values may be used in many places in a\nsystem, so it's often helpful to have a single point of validation for them.\n\n\n.. |Python version| image:: https://img.shields.io/badge/Python_version-3.4+-blue.svg\n :target: https://www.python.org/\n.. |Build Status| image:: https://travis-ci.org/abingham/kfg.png?branch=master\n :target: https://travis-ci.org/abingham/kfg\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/abingham/kfg", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "kfg", "package_url": "https://pypi.org/project/kfg/", "platform": "any", "project_url": "https://pypi.org/project/kfg/", "project_urls": { "Homepage": "http://github.com/abingham/kfg" }, "release_url": "https://pypi.org/project/kfg/2.0.0/", "requires_dist": [ "pyyaml", "hypothesis ; extra == 'test'", "pytest ; extra == 'test'", "tox ; extra == 'test'" ], "requires_python": "", "summary": "A configuration library for Python", "version": "2.0.0" }, "last_serial": 4627771, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "b5b8fff9899eb3beea19b87a798336d1", "sha256": "a63aa2296e1202dc6271cb0615ff158ed9d13b28441bfd44f213b1cdb0ff9894" }, "downloads": -1, "filename": "kfg-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b5b8fff9899eb3beea19b87a798336d1", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 3171, "upload_time": "2018-06-29T09:24:22", "url": "https://files.pythonhosted.org/packages/1c/12/e109490012c4e38ee96557e8966250df0cbdb0eef4a921c47b83ac6fd6e5/kfg-1.0.0-py3-none-any.whl" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "49613b24866428184f2a26d231824cb2", "sha256": "388ea36c2afd03895a35f684de4be3ed764a779a7c4fffaa5c85169784d62adc" }, "downloads": -1, "filename": "kfg-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "49613b24866428184f2a26d231824cb2", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 5694, "upload_time": "2018-06-29T12:12:40", "url": "https://files.pythonhosted.org/packages/2f/87/137ecf7d22edba45cad9a3172eebce81911cd2198fbe3453b34557779e02/kfg-1.1.0-py3-none-any.whl" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "3905b7b2f94553a2f43ed7151b10b1f9", "sha256": "2fd1dc81ba2740dc2567b41f984f3e3d4e6bccde5d4096e52e147aade4b1d7e4" }, "downloads": -1, "filename": "kfg-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3905b7b2f94553a2f43ed7151b10b1f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6508, "upload_time": "2018-12-22T14:00:29", "url": "https://files.pythonhosted.org/packages/99/42/1be913146ef9900346c44814982f29cd297e2e180295c8ad1639182a508b/kfg-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "385fb0281a363732744c34e04ab1b5ee", "sha256": "0b0d8b76bd9cf3e970949fde7241361f31a7551c9355725f6fc3dc15834ed915" }, "downloads": -1, "filename": "kfg-2.0.0.tar.gz", "has_sig": false, "md5_digest": "385fb0281a363732744c34e04ab1b5ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5737, "upload_time": "2018-12-22T14:00:30", "url": "https://files.pythonhosted.org/packages/23/f4/7005c34e0f21c81b3192b4fba46b09953020f1e603e8c3d32a3a3b0b449c/kfg-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3905b7b2f94553a2f43ed7151b10b1f9", "sha256": "2fd1dc81ba2740dc2567b41f984f3e3d4e6bccde5d4096e52e147aade4b1d7e4" }, "downloads": -1, "filename": "kfg-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3905b7b2f94553a2f43ed7151b10b1f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6508, "upload_time": "2018-12-22T14:00:29", "url": "https://files.pythonhosted.org/packages/99/42/1be913146ef9900346c44814982f29cd297e2e180295c8ad1639182a508b/kfg-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "385fb0281a363732744c34e04ab1b5ee", "sha256": "0b0d8b76bd9cf3e970949fde7241361f31a7551c9355725f6fc3dc15834ed915" }, "downloads": -1, "filename": "kfg-2.0.0.tar.gz", "has_sig": false, "md5_digest": "385fb0281a363732744c34e04ab1b5ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5737, "upload_time": "2018-12-22T14:00:30", "url": "https://files.pythonhosted.org/packages/23/f4/7005c34e0f21c81b3192b4fba46b09953020f1e603e8c3d32a3a3b0b449c/kfg-2.0.0.tar.gz" } ] }