{ "info": { "author": "Alexander Tikhonov", "author_email": "random.gauss@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "consul-options - Define and use your project settings without pain\n===================================================================\n\n.. image:: https://travis-ci.org/Fatal1ty/consul-options.svg?branch=master\n :target: https://travis-ci.org/Fatal1ty/consul-options\n\n.. image:: https://requires.io/github/Fatal1ty/consul-options/requirements.svg?branch=master\n :target: https://requires.io/github/Fatal1ty/consul-options/requirements/?branch=master\n :alt: Requirements Status\n\n.. image:: https://img.shields.io/pypi/v/consul-options.svg\n :target: https://pypi.python.org/pypi/consul-options\n\n.. image:: https://img.shields.io/pypi/pyversions/consul-options.svg\n :target: https://pypi.python.org/pypi/consul-options/\n\n.. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg\n :target: https://opensource.org/licenses/Apache-2.0\n\n\nHow often do you wonder where to store the project settings? When your project is small\nit is not a big problem. But if your big project consists of dozens of microservices\nthen there is a problem of centralized configuration management. The \u0421onsul have a key/value\nstorage that is ideal for this.\n\nWith **consul-options** you can define and use options in your code by a simple and elegant way.\nJust take a look at the example:\n\n.. code-block:: python\n\n class DB(ConsulKV):\n pass\n\n\n class Users(DB):\n host = '127.0.0.1'\n port = 5432\n user = 'postgres'\n password = 'postgres'\n\n dbname = 'users'\n\n\n class Orders(DB):\n host = '127.0.0.1'\n port = 5432\n user = 'postgres'\n password = 'postgres'\n\n dbname = 'orders'\n\nNow you can access option values in a clear way:\n\n.. code-block:: python\n\n from consul_options import options\n\n print options.db.users.host\n print options.db.orders.dbname\n\n**consul-options** automagically creates folders and keys with default values defined above\nin Consul and later read them from there. So if anyone will change the value of *db/orders/host* key\nto something different in Consul then you will get that value.\n\nHow project options stored in Consul\n------------------------------------\n\nWhen you declare a new class based on **ConsulKV** default bahavior is\ncreation a *folder* in Consul key/value storage with name of your class in lowercase.\nEach class attribute you define will have mapping to key *folder/key*.\nIf you don't agree with generated folder name you are free to choose any other\nwith reserved class attribute **__key__** as shown below:\n\n.. code-block:: python\n\n class WorkerOptions(ConsulKV):\n __key__ = 'worker'\n\n host = '127.0.0.1'\n port = 80\n\nAfter that you can access to the option with \"worker\" in path:\n\n.. code-block:: python\n\n from consul_options import options\n\n print options.worker.host\n print options.worker.port\n\nTo create hierarchical key structure you can take advantage of usual class hierarchy:\n\n.. code-block:: python\n\n from consul_options import ConsulKV, options\n\n class WorkerOptions(ConsulKV):\n __key__ = 'worker'\n\n host = '127.0.0.1'\n port = 80\n\n class DB(WorkerOptions):\n host = '127.0.0.1'\n port = 5432\n user = 'postgres'\n password = 'postgres'\n\n print options.worker.db.host # 'host'\n print options.worker.db.port # 5432\n\nIt is also possible to create keys at root level with class attribute **__root__**:\n\n.. code-block:: python\n\n class RootOptions(ConsulKV):\n __root__ = True\n\n host = '127.0.0.1'\n port = 80\n\n print options.host\n print options.port\n\n\nCompatibility\n-------------\n\nconsul-options is compatible with both Python 2 and Python 3.\n\n\nInstallation\n------------\n\nUse pip to install::\n\n $ pip install consul-options\n\n\nLicense\n-------\n\nconsul-options is developed and distributed under the Apache 2.0 license.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Fatal1ty/consul-options", "keywords": "", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "consul-options", "package_url": "https://pypi.org/project/consul-options/", "platform": "all", "project_url": "https://pypi.org/project/consul-options/", "project_urls": { "Homepage": "https://github.com/Fatal1ty/consul-options" }, "release_url": "https://pypi.org/project/consul-options/1.2/", "requires_dist": null, "requires_python": "", "summary": "Framework for using Consul as your project options storage", "version": "1.2" }, "last_serial": 3315452, "releases": { "0.7": [ { "comment_text": "", "digests": { "md5": "778db8c37fdad0c87714c07037b5a1b1", "sha256": "9a4d92b7e1db5b046a0cd11ec49d7079e7a14e2d931b75fad8148d27ca8cf74e" }, "downloads": -1, "filename": "consul-options-0.7.tar.gz", "has_sig": false, "md5_digest": "778db8c37fdad0c87714c07037b5a1b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4126, "upload_time": "2017-06-16T11:01:44", "url": "https://files.pythonhosted.org/packages/e5/b6/ca5dc3dd384c506fff564245d76c19d44d66a9c8a54b2d75fa9b24166bb1/consul-options-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "f6401dee54ae18512daca5e14d13db0b", "sha256": "baf22fb0d8527865d105794ebda7f2014aad95d0665c42ab77f61c549a472bba" }, "downloads": -1, "filename": "consul-options-0.8.tar.gz", "has_sig": false, "md5_digest": "f6401dee54ae18512daca5e14d13db0b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4129, "upload_time": "2017-06-16T11:05:53", "url": "https://files.pythonhosted.org/packages/a7/4e/c0896c62dfe45bdca812dc21173c74089f7580e6555d677767165451ec96/consul-options-0.8.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "8750a447512dfe334cc48c8c7eb58dca", "sha256": "b41b4aa351aca404fafa0a75bc7baee457d1d06a0cf0dc19d7f0093dcaadc976" }, "downloads": -1, "filename": "consul-options-1.0.tar.gz", "has_sig": false, "md5_digest": "8750a447512dfe334cc48c8c7eb58dca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4157, "upload_time": "2017-08-07T13:11:32", "url": "https://files.pythonhosted.org/packages/cf/be/e22f95307288076b4e1d85eba39a809364c4e30d3200e1069555d7cc32b2/consul-options-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "1aaec7a930fdc676d271c52eb4641343", "sha256": "16221254e5c903c685bbd3342422d6104df6ff7ff893aa3f555f59b9f4c7b6bc" }, "downloads": -1, "filename": "consul-options-1.1.tar.gz", "has_sig": false, "md5_digest": "1aaec7a930fdc676d271c52eb4641343", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4237, "upload_time": "2017-11-02T09:59:53", "url": "https://files.pythonhosted.org/packages/f5/8f/2ff56028f6e01840e120a77d4aa641792e845176b13c540702d2cba980c2/consul-options-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "574ddcb0b23ae3c35a4a9c9a16d41ecc", "sha256": "87b4f4d1aa8a4f03151bd0a853a4dabe2cb85237672d29abfa898ac4049b03dd" }, "downloads": -1, "filename": "consul-options-1.2.tar.gz", "has_sig": false, "md5_digest": "574ddcb0b23ae3c35a4a9c9a16d41ecc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4246, "upload_time": "2017-11-08T08:13:21", "url": "https://files.pythonhosted.org/packages/0c/3e/ac99fad520ad36eaff98ef9acc863078027c909a39c201e8c36894605f3b/consul-options-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "574ddcb0b23ae3c35a4a9c9a16d41ecc", "sha256": "87b4f4d1aa8a4f03151bd0a853a4dabe2cb85237672d29abfa898ac4049b03dd" }, "downloads": -1, "filename": "consul-options-1.2.tar.gz", "has_sig": false, "md5_digest": "574ddcb0b23ae3c35a4a9c9a16d41ecc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4246, "upload_time": "2017-11-08T08:13:21", "url": "https://files.pythonhosted.org/packages/0c/3e/ac99fad520ad36eaff98ef9acc863078027c909a39c201e8c36894605f3b/consul-options-1.2.tar.gz" } ] }