{ "info": { "author": "Les Aker", "author_email": "me@lesaker.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "conflib\n=========\n\n[![Latest Version](https://img.shields.io/pypi/v/conflib.svg)](https://pypi.python.org/pypi/conflib/)\n[![Coverage Status](https://img.shields.io/coveralls/akerl/conflib.svg)](https://coveralls.io/r/akerl/conflib)\n[![Build Status](https://img.shields.io/travis/akerl/conflib.svg)](https://travis-ci.org/akerl/conflib)\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)\n\nSimplifies configuration stacking. Primarily, this was written to allow stacking of default, global, and local settings. It allows for validation so that you can enforce contraints on supplied options.\n\n## Usage\n\nUsing conflib is just a matter of importing it and giving it some dictionaries to stack:\n\n```\n>>> import conflib\n>>> Default = {'hello': 'world', 'alpha': 5}\n>>> Global = {'wat': 'wut', 'fancy': (20, 'fish')}\n>>> Local = {'hello': 'everybody', 'beta': 'qwerty'}\n>>> Config = conflib.Config(Default, Global, Local)\n>>> print(Config.options)\n{'alpha': 5, 'wat': 'wut', 'beta': 'qwerty', 'hello': 'everybody', 'fancy': (20, 'fish')}\n```\n\nIf you need to stack on new configs later, go for it:\n\n```\n>>> Config.stack({'wat': 'new_value', 'extra': 10})\n>>> print(Config.options)\n{'alpha': 5, 'wat': 'new_value', 'beta': 'qwerty', 'hello': 'everybody', 'fancy': (20, 'fish'), 'extra': 10}\n```\n\nPass in a validation dictionary if you want to check the provided arguments:\n\n```\nValidator = {\n 'alpha': lambda x: x < 10,\n 'fancy': tuple,\n 'beta': [('asdf', 'qwerty'), ('fizz','buzz')]\n}\nConfig.validate(Validator)\n```\n\nAlternately, you can pass in a validation\\_dict when creating a Config object. Validation failures raise ValueError with a message indicating the specific failure. There are several available options for the Validation dictionary:\n\n* `bool`: Converts 'y', 'yes', '1', 1, and True to True, and 'n', 'no', '0', 0 and False to False\n* `int`: Casts provided value as an integer\n* A list of tuples: looks for the provided value as a member of any of the tuples, and returns the first item in that tuple\n* A list: looks for the provided value in the list\n* Any type (`str`, `float`, etc): validates that the provided value is of the specified type (does not try to cast it)\n* A callable: Runs the provided function, which should either return the validated value or raise TypeError\n\n## Installation\n\n pip install conflib\n\n## License\n\nconflib is released under the MIT License. See the bundled LICENSE file for details.\n\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/akerl/conflib", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "conflib", "package_url": "https://pypi.org/project/conflib/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/conflib/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/akerl/conflib" }, "release_url": "https://pypi.org/project/conflib/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "Manage configuration hierarchies", "version": "1.0.0" }, "last_serial": 1388718, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "9cae630bdadf648e6377ecfe0eaf50d6", "sha256": "d551162d12ba7fcf0dcf5e6e8528b3f211dee92103dfe04c44d6d6109300e144" }, "downloads": -1, "filename": "conflib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "9cae630bdadf648e6377ecfe0eaf50d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2046, "upload_time": "2013-06-02T16:09:12", "url": "https://files.pythonhosted.org/packages/4f/c0/86f74d3879c05626be154b329a9ddb2e2967523399bf15dd5b1b242b34ef/conflib-0.1.0.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "4a359db528d7683e444cec785af06161", "sha256": "a8983c7dc10f5d9c0b3a0013e31a5bca2c55a52515a50d38fb1d612cb9865412" }, "downloads": -1, "filename": "conflib-0.1.2.tar.gz", "has_sig": false, "md5_digest": "4a359db528d7683e444cec785af06161", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2778, "upload_time": "2013-07-11T01:13:20", "url": "https://files.pythonhosted.org/packages/8b/b1/4520fa1ad973fbf7a830ff025308cb5dae841cbbd8cf6c0c050461dc3b54/conflib-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "46c71854df6b4e5d2cc0436322393235", "sha256": "4ed201beb128e5fd2fc63b17848470a758254e3679e08a54308cb6ad88fbcf09" }, "downloads": -1, "filename": "conflib-0.1.3.tar.gz", "has_sig": false, "md5_digest": "46c71854df6b4e5d2cc0436322393235", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2776, "upload_time": "2013-07-11T01:13:44", "url": "https://files.pythonhosted.org/packages/bc/7e/8ea20d4f3dcdaaf3ddb6193608a3537b3e019d75e27dea4406cd9c11d152/conflib-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "57e0ce473d3fe49ea7d49223a3c005e2", "sha256": "64bd197127bcb1b22899b21186a729fd60863e03ce32ab89093a4c99b61d2328" }, "downloads": -1, "filename": "conflib-0.1.4.tar.gz", "has_sig": false, "md5_digest": "57e0ce473d3fe49ea7d49223a3c005e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2758, "upload_time": "2013-07-15T21:03:33", "url": "https://files.pythonhosted.org/packages/c9/a8/3df377c50eff047537cb3e76f69d27be3f84d7ab6fe989dd91155fe6653a/conflib-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "8dc71b185f618a2c55b08341a6ebaa40", "sha256": "e7d5e96d55899f82358c6001c153ac3aaed0d21b24271617e4f654844edcf8e9" }, "downloads": -1, "filename": "conflib-0.1.5.tar.gz", "has_sig": false, "md5_digest": "8dc71b185f618a2c55b08341a6ebaa40", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1748, "upload_time": "2014-02-16T15:00:50", "url": "https://files.pythonhosted.org/packages/67/81/13dfe1193f201be9f2d7ca4200c424157742a03ed9d2d2137af2e75f5ef0/conflib-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "f6e0808f755bf1018dde258d58b912fb", "sha256": "0b3ebbf490fb925044f6778ec233d7af454d2cdc60aa3a068409933b7368a0e5" }, "downloads": -1, "filename": "conflib-0.1.6.tar.gz", "has_sig": false, "md5_digest": "f6e0808f755bf1018dde258d58b912fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3086, "upload_time": "2014-03-24T22:19:08", "url": "https://files.pythonhosted.org/packages/c2/a5/a25eaf6921fce8f5340ba829cb9ac779e3e62558b7cc72201e94e0f10c1c/conflib-0.1.6.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "a42c1b8fdf1bf7a0f0180469c5256a67", "sha256": "bcafdf3c54b47e807cbe96c296b022119e3ee8e03612bb5588beb42ca2ed8466" }, "downloads": -1, "filename": "conflib-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a42c1b8fdf1bf7a0f0180469c5256a67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3642, "upload_time": "2015-01-20T04:29:40", "url": "https://files.pythonhosted.org/packages/da/0f/1f7cb2e31ecc17f11e9f788fe3ac784831b177c318a6409c1e683f8c064b/conflib-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a42c1b8fdf1bf7a0f0180469c5256a67", "sha256": "bcafdf3c54b47e807cbe96c296b022119e3ee8e03612bb5588beb42ca2ed8466" }, "downloads": -1, "filename": "conflib-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a42c1b8fdf1bf7a0f0180469c5256a67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3642, "upload_time": "2015-01-20T04:29:40", "url": "https://files.pythonhosted.org/packages/da/0f/1f7cb2e31ecc17f11e9f788fe3ac784831b177c318a6409c1e683f8c064b/conflib-1.0.0.tar.gz" } ] }