{ "info": { "author": "S\u00e9bastien IOOSS", "author_email": "archimist.linux@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Distribute Config\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c95ee137fde197b24dc1/maintainability)](https://codeclimate.com/github/Net-Mist/distribute_config/maintainability)\n[![Coverage Status](https://coveralls.io/repos/github/Net-Mist/distribute_config/badge.svg?branch=master)](https://coveralls.io/github/Net-Mist/distribute_config?branch=master)\n[![Build Status](https://travis-ci.org/Net-Mist/distribute_config.svg?branch=master)](https://travis-ci.org/Net-Mist/distribute_config)\n\nA package to handle multi-source distributed configuration\n\nThis package handle the problem of multi-source configuration in python. For a python program containing a set of configuration variables,\nthis package will populate the values of these configuration variables by looking for a yaml configuration file, then will overwrite the values of the \nvariables by looking for matching environment variables and then, if the program was started with some arguments, will once again overwrite the values of the configuration by loading these variables\n\nMoreover, this package allow you to define configuration variables in multiple python files, using a namespace system so you can't accidentally break other parts of the configuration, so the configuration stay near the code that needs it and you can update your configuration by just importing new python files. \n\n## Example\n\nLet the following python program app.py:\n```python\nfrom distribute_config import Config\n\nConfig.define_int(\"nb\", 1, \"some number\")\nConfig.define_str_list(\"list\", [\"a\", \"b\", \"c\"], \"some list\")\nConfig.define_enum(\"logger\", \"debug\", [\"info\", \"debug\", \"warn\"], \"the logger level\")\n\nConfig.load_conf()\nprint(Config.get_dict())\n```\n\nby running it with `python app.py` it will create a file config.yml :\n```yml\nlist:\n- a\n- b\n- c\nnb: 1\nlogger: debug\n```\n\nand display : `{'nb': 1, 'list': ['a', 'b', 'c'], 'logger' : 'debug'}`\n\nNow if we update config.yml:\n```yml\nlist:\n- a\n- b\nnb: 2\n```\n- `python app.py` will print `{'nb': 2, 'list': ['a', 'b']}`\n- `NB=3 python app.py` will print `{'nb': 3, 'list': ['a', 'b']}`\n- `NB=3 python app.py --nb 4` will print `{'nb': 4, 'list': ['a', 'b']}`\n\nMoreover, `python app.py --help` with display all the possible variables and useful comments\n\n## Example 2: namespace\nLet change app.py to be:\n```python\nfrom distribute_config import Config\n\nConfig.define_int(\"nb\", 1, \"some number\")\nwith Config.namespace(\"set1\"):\n Config.define_int(\"nb\", 2, \"some other number\")\n with Config.namespace(\"set2\"):\n Config.define_int(\"nb\", 3, \"and again\")\nConfig.define_int(\"other.nb\", 4, \"last\") \n\nConfig.load_conf()\nprint(Config.get_dict())\n```\nRunning `python app.py` will display `{'nb': 1, 'set1': {'nb': 2, 'set2': {'nb': 3}}, 'other': {'nb': 4}}`\nand the created config.yml is:\n```yml\nnb: 1\nother:\n nb: 4\nset1:\n nb: 2\n set2:\n nb: 3\n```\n\n- `python app.py` will print `{'nb': 1, 'set1': {'nb': 2, 'set2': {'nb': 3}}, 'other': {'nb': 4}}`\n- `SET1__SET2__NB=30 python app.py` will print `{'nb': 1, 'set1': {'nb': 2, 'set2': {'nb': 30}}, 'other': {'nb': 4}}`\n- `SET1__SET2__NB=30 python app.py --set1.set2.nb=40` will print `{'nb': 1, 'set1': {'nb': 2, 'set2': {'nb': 40}}, 'other': {'nb': 4}}`\n\n\n## Features\n- The config support single variables (int, float, str, bool) but also list (int, float, str) and enum\n- When loading configuration using Config.load_conf(), you can specify the name of the config file you want to create or load, and you can also specify if you don't want a config file to be create or if you want to update the content of the current config file (usefull when adding new features)\n\n## Tests\nnosetests -v", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Net-Mist/distribute_config", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "distribute-config", "package_url": "https://pypi.org/project/distribute-config/", "platform": "", "project_url": "https://pypi.org/project/distribute-config/", "project_urls": { "Homepage": "https://github.com/Net-Mist/distribute_config" }, "release_url": "https://pypi.org/project/distribute-config/0.1.7/", "requires_dist": null, "requires_python": "", "summary": "A package to handle multi-source distributed configuration", "version": "0.1.7" }, "last_serial": 5841389, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2cf422e85991e61c8add43d430bf892e", "sha256": "b7b5aabfbc8d718d19dd30a6a58c8020158628d307cfe5adc19d80e4fac3313a" }, "downloads": -1, "filename": "distribute_config-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2cf422e85991e61c8add43d430bf892e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5914, "upload_time": "2019-06-30T16:21:47", "url": "https://files.pythonhosted.org/packages/07/d6/f8e573161dab6a91d0a216ca341dd102d4f7e42ee4faa21c528ac870ea52/distribute_config-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4c1b2838a9e374be5b26f8ed80acd4e3", "sha256": "99bdd1be4d584b76257afc14f613ecd1b9c0e3bd5c18b0b35e366fa4564be897" }, "downloads": -1, "filename": "distribute_config-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4c1b2838a9e374be5b26f8ed80acd4e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4100, "upload_time": "2019-06-30T16:21:49", "url": "https://files.pythonhosted.org/packages/0f/87/233cce69480e81b7bb26613524f77618a1de9e6e5b6822add73533cb0696/distribute_config-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4d7f80e53215eadc98f9ffc3f7cc3a96", "sha256": "c1428a4b9f2f5d9a27e2fcc6e6267de0b8cb4559a69d0015aebb8e68c5dfcf72" }, "downloads": -1, "filename": "distribute_config-0.0.2.tar.gz", "has_sig": false, "md5_digest": "4d7f80e53215eadc98f9ffc3f7cc3a96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4086, "upload_time": "2019-06-30T16:38:23", "url": "https://files.pythonhosted.org/packages/ad/a8/054afbb15a500b8161de95b775e7f35b62849ee53892804452aa10de8875/distribute_config-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "c4fd6ce1bd0284a6ea04216751e104a3", "sha256": "f3d4aec4d4912678fa39650c536becd36de76f3becdff245b6c65592441f8d14" }, "downloads": -1, "filename": "distribute_config-0.0.3.tar.gz", "has_sig": false, "md5_digest": "c4fd6ce1bd0284a6ea04216751e104a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4945, "upload_time": "2019-06-30T22:06:11", "url": "https://files.pythonhosted.org/packages/6d/10/913b2dbc6338c9f54f3a03d385e8b45bfb0ea45a435f809df325876c66c0/distribute_config-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "202e5fa0c5d35ff1d24a0c94be596137", "sha256": "df68b2382aa21892ed12a240eb0821a4c09ef0f1d27902e7b7de72f8043afd88" }, "downloads": -1, "filename": "distribute_config-0.0.4.tar.gz", "has_sig": false, "md5_digest": "202e5fa0c5d35ff1d24a0c94be596137", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4961, "upload_time": "2019-07-01T14:01:25", "url": "https://files.pythonhosted.org/packages/ef/74/fa90ff522ad22dabc03acb59b981a2d6d9ad941855143c6fdbb7d3f77835/distribute_config-0.0.4.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "88da2ccb4fbab78125bde1a419cac28a", "sha256": "ba974ef1110678c19ceaf26bbea61b20d08f42d26da6153572119bc63cacd327" }, "downloads": -1, "filename": "distribute_config-0.1.0.tar.gz", "has_sig": false, "md5_digest": "88da2ccb4fbab78125bde1a419cac28a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5997, "upload_time": "2019-07-11T21:39:02", "url": "https://files.pythonhosted.org/packages/d5/b3/b04c4d6480dae40484c80892cc9dd306a890826630a1b9ed61fbc0699d25/distribute_config-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a550cfd6ffef4707999bd6514c2f52d2", "sha256": "92f0cec934fdef018dd23be59886f135a4998d640b327c1f105951d26b15de12" }, "downloads": -1, "filename": "distribute_config-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a550cfd6ffef4707999bd6514c2f52d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6140, "upload_time": "2019-07-26T09:39:12", "url": "https://files.pythonhosted.org/packages/bb/c1/8d7f0434defc2ed9acc79a7f49d5ddceabb0999bc096a09b0b1ec428beaf/distribute_config-0.1.1.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "f63efd6650893af2bac08024afb08fc9", "sha256": "052f910dd01bc79fe3446f0fa52fb6ffa52758f200361e2c8558402677b7ee8d" }, "downloads": -1, "filename": "distribute_config-0.1.5.tar.gz", "has_sig": false, "md5_digest": "f63efd6650893af2bac08024afb08fc9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6247, "upload_time": "2019-08-27T11:32:44", "url": "https://files.pythonhosted.org/packages/bf/b1/1f3d31ee8386ceab67237cad2329bf4b9cb4bfe24d20e069be747ba60ff5/distribute_config-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "b18cdd27ebcf16c16a378ccec8ce3d93", "sha256": "710860eed570075cda55871fc433006601a1dfa61c87191c6a500dd289b48c61" }, "downloads": -1, "filename": "distribute_config-0.1.6.tar.gz", "has_sig": false, "md5_digest": "b18cdd27ebcf16c16a378ccec8ce3d93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6200, "upload_time": "2019-09-17T11:53:58", "url": "https://files.pythonhosted.org/packages/49/7a/6fdbab58816e7553bb2f726ed42f2e82e22f08c4b93b3a363e5a7a42a3ff/distribute_config-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "73e390b2f193c721e9e99792b85b0b3b", "sha256": "4e352d718871d97eaba39f15138a04925b9ac66d37c6d3abb30cd88f22adc172" }, "downloads": -1, "filename": "distribute_config-0.1.7.tar.gz", "has_sig": false, "md5_digest": "73e390b2f193c721e9e99792b85b0b3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6222, "upload_time": "2019-09-17T12:01:35", "url": "https://files.pythonhosted.org/packages/f1/6e/77e95dc04820d103b7d7ca5a5ef6448614dd6e2b1aca07ca1d4b81d7a05e/distribute_config-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "73e390b2f193c721e9e99792b85b0b3b", "sha256": "4e352d718871d97eaba39f15138a04925b9ac66d37c6d3abb30cd88f22adc172" }, "downloads": -1, "filename": "distribute_config-0.1.7.tar.gz", "has_sig": false, "md5_digest": "73e390b2f193c721e9e99792b85b0b3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6222, "upload_time": "2019-09-17T12:01:35", "url": "https://files.pythonhosted.org/packages/f1/6e/77e95dc04820d103b7d7ca5a5ef6448614dd6e2b1aca07ca1d4b81d7a05e/distribute_config-0.1.7.tar.gz" } ] }