{ "info": { "author": "Mehmet Can Ozdemir", "author_email": "mefu.ozd@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# ConfDict\n\nConfiguration dictionary that extends built-in python dict with recursive access, self references and fallback functionality. There is no extensive documentation yet, you can check out tests to figure out all features.\n\n## Example usage.\n\n```python\n>>> from confdict import ConfDict\n>>> cd = ConfDict(\n # Configuration of ConfDict, these are default values\n __separator = '/',\n __self_key = '.',\n __parent_key = '..',\n __root_key = '...',\n __key_key = '',\n __interpolation_regex = r'({{([^{}]*)}})',\n __fallback_key = 'fallback',\n\n # Remaining arguments will directly be stored in underlying dict\n users = {\n # fallback dict is used when a key is not found at that level\n 'fallback': {\n # is evaluated to key of the current level\n # it is useful when used with fallback\n 'username': '{{}}',\n # you can use self references\n 'ssh_private_key': '/home/{{username}}/.ssh/id_rsa',\n },\n }\n)\n>>> cd\nConfDict\n{ 'users': { 'fallback': { 'ssh_private_key': '/home/{{username}}/.ssh/id_rsa',\n 'username': '{{}}'}}}\n>>> cd['users/john/username']\n'john'\n>>> cd['users/john/ssh_private_key']\n'/home/john/.ssh/id_rsa'\n>>> cd['users/john']\nConfDict\n{'ssh_private_key': '/home/john/.ssh/id_rsa', 'username': 'john'}\n>>> cd['users/jean']\nConfDict\n{'ssh_private_key': '/home/jean/.ssh/id_rsa', 'username': 'jean'}\n>>> cd['users/jean'] = { 'username': 'jeans_custom_username' }\n>>> cd['users/jean/ssh_private_key']\n'/home/jeans_custom_username/.ssh/id_rsa'\n>>> # 'jean' exists now under 'users'\n>>> # there is no partial fallback so there is no 'ssh_private_key'\n>>> cd['users/jean']\nConfDict\n{'username': 'jeans_custom_username'}\n>>> # we can realize fallback as jean to make concrete values\n>>> cd['users/fallback'].realize('jean')\n>>> cd['users/jean']\nConfDict\n{'ssh_private_key': '/home/jeans_custom_username/.ssh/id_rsa', 'username': 'jeans_custom_username'}\n>>> # interpolation still works\n>>> cd['users/jean/username'] = 'jeans_custom_username2'\n>>> cd['users/jean/ssh_private_key']\n'/home/jeans_custom_username2/.ssh/id_rsa'\n```\n\n\n## Installation\n```\n$ pip install confdict\n```\n\n## Development\n\nThere is a `Makefile` to automate commonly used development tasks.\n\n### Environment Setup\n\n```\n### create a virtualenv for development\n\n$ sudo pip install virtualenv # or your preferred way to install virtualenv\n\n$ make virtualenv # will also install dependencies\n\n$ source env/bin/activate\n\n### run pytest / coverage\n\n$ make test\n\n### before commit\n\n$ make format\n```\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT", "maintainer": "Mehmet Can Ozdemir", "maintainer_email": "mefu.ozd@gmail.com", "name": "confdict", "package_url": "https://pypi.org/project/confdict/", "platform": "", "project_url": "https://pypi.org/project/confdict/", "project_urls": null, "release_url": "https://pypi.org/project/confdict/0.0.1/", "requires_dist": null, "requires_python": ">=3.4,<4.0", "summary": "A dictionary with nested access, interpolation and fallback features. It is primarily meant to be used for storing configurations of programs.", "version": "0.0.1" }, "last_serial": 4993057, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2da0dd82d4c09b26120516eddd13377f", "sha256": "fb13bae393d73c7dec20d43a8cda42e97c2eb9e901b902ced186d4b93ba6894b" }, "downloads": -1, "filename": "confdict-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2da0dd82d4c09b26120516eddd13377f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4,<4.0", "size": 14739, "upload_time": "2019-03-27T14:15:23", "url": "https://files.pythonhosted.org/packages/e2/63/d6855a5badbc95c0fb2966e1c553e21d7c4d811cb023fd49883eb2ff1ffd/confdict-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "201c5d366e0a343aad76e90a187ca35f", "sha256": "a979530e6176cd54ba5d54295b916a282c0f640dc931b9628f11aadaaaa08a58" }, "downloads": -1, "filename": "confdict-0.0.1.tar.gz", "has_sig": false, "md5_digest": "201c5d366e0a343aad76e90a187ca35f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4,<4.0", "size": 5770, "upload_time": "2019-03-27T14:15:24", "url": "https://files.pythonhosted.org/packages/b0/f8/71cbab47cd592aa3337f37c94e539ab03c3fb2122e0af34b644c6efcd19a/confdict-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2da0dd82d4c09b26120516eddd13377f", "sha256": "fb13bae393d73c7dec20d43a8cda42e97c2eb9e901b902ced186d4b93ba6894b" }, "downloads": -1, "filename": "confdict-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2da0dd82d4c09b26120516eddd13377f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4,<4.0", "size": 14739, "upload_time": "2019-03-27T14:15:23", "url": "https://files.pythonhosted.org/packages/e2/63/d6855a5badbc95c0fb2966e1c553e21d7c4d811cb023fd49883eb2ff1ffd/confdict-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "201c5d366e0a343aad76e90a187ca35f", "sha256": "a979530e6176cd54ba5d54295b916a282c0f640dc931b9628f11aadaaaa08a58" }, "downloads": -1, "filename": "confdict-0.0.1.tar.gz", "has_sig": false, "md5_digest": "201c5d366e0a343aad76e90a187ca35f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4,<4.0", "size": 5770, "upload_time": "2019-03-27T14:15:24", "url": "https://files.pythonhosted.org/packages/b0/f8/71cbab47cd592aa3337f37c94e539ab03c3fb2122e0af34b644c6efcd19a/confdict-0.0.1.tar.gz" } ] }