{ "info": { "author": "Chris Withers", "author_email": "chris@withers.org", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "\nconfigurator\n============\n\n|CircleCI|_ |Docs|_\n\n.. |CircleCI| image:: https://circleci.com/gh/Simplistix/configurator/tree/master.svg?style=shield\n.. _CircleCI: https://circleci.com/gh/Simplistix/configurator/tree/master\n\n.. |Docs| image:: https://readthedocs.org/projects/configurator/badge/?version=latest\n.. _Docs: http://configurator.readthedocs.org/en/latest/\n\nThis is a Python library for building a configuration store\nfrom one or more layered configuration sources.\nThese are most commonly files, with yaml, toml and json support included\nand other formats easily supported with plugins.\n\nIt provides an easy interface for accessing configuration information\nsourced from overlaid config files or mapped in from environment variables\nor command line options.\n\nConfiguration information is also available as nested, simple python data types so that\nyou can validate the schema of your configuration using the tool of your choice.\n\nQuickstart\n~~~~~~~~~~\n\n.. invisible-code-block: python\n\n fs.create_file('/etc/my_app/config.yaml',\n contents='cache:\\n location: /var/my_app/\\n')\n fs.create_dir('/var/logs/myapp/')\n replace('os.environ.MYAPP_THREADS', '2', strict=False)\n replace('os.environ.MYAPP_CACHE_DIRECTORY', '/var/logs/myapp/', strict=False)\n replace('sys.argv', ['myapp.py', '--threads', '3'])\n from pprint import pprint\n\nTo install the library, go for:\n\n.. code-block:: bash\n\n pip install configurator[yaml,toml]\n\nHere's how you would handle a layered set of defaults, system-wide config\nand then optional per-user config:\n\n.. code-block:: python\n\n\n from configurator import Config\n\n defaults = Config({\n 'cache': {\n 'location': '/tmp/my_app',\n 'max_files': 100,\n },\n 'banner': 'default banner',\n 'threads': 1,\n })\n system = Config.from_path('/etc/my_app/config.yaml')\n user = Config.from_path('~/.my_app.yaml', optional=True)\n config = defaults + system + user\n\nNow, if we wanted configuration from the environment and command line\narguments to override those provided in configuration files, we could do so\nas follows:\n\n.. code-block:: python\n\n import os\n from argparse import ArgumentParser\n from configurator import convert, target, required\n\n config.merge(os.environ, {\n convert('MYAPP_THREADS', int): 'threads',\n required('MYAPP_CACHE_DIRECTORY'): 'cache.location',\n })\n\n parser = ArgumentParser()\n parser.add_argument('--threads', type=int)\n parser.add_argument('--max-files', type=int)\n args = parser.parse_args()\n\n config.merge(args, {\n 'threads': 'threads',\n 'max-files': 'cache.max_files',\n })\n\nTo check the configuration we've accumulated is sensible we can use a data validation library\nsuch as `Voluptuous`__:\n\n__ https://github.com/alecthomas/voluptuous\n\n.. code-block:: python\n\n from os.path import exists\n from voluptuous import Schema, All, Required, PathExists\n\n schema = Schema({\n 'cache': {'location': All(str, PathExists()), 'max_files': int},\n 'banner': Required(str),\n 'threads': Required(int),\n })\n\n schema(config.data)\n\nSo, with all of the above, we could use the following sources of configuration:\n\n>>> import os, sys\n>>> print(open('/etc/my_app/config.yaml').read())\ncache:\n location: /var/my_app/\n\n>>> os.environ['MYAPP_THREADS']\n'2'\n>>> os.environ['MYAPP_CACHE_DIRECTORY']\n'/var/logs/myapp/'\n>>> sys.argv\n['myapp.py', '--threads', '3']\n\nWith the above sources of configuration, we'd end up with a configuration store that we can use as\nfollows:\n\n>>> config.cache.location\n'/var/logs/myapp/'\n>>> config.cache.max_files\n100\n>>> config.banner\n'default banner'\n>>> config.threads\n3\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Simplistix/configurator", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "configurator", "package_url": "https://pypi.org/project/configurator/", "platform": "", "project_url": "https://pypi.org/project/configurator/", "project_urls": { "Homepage": "https://github.com/Simplistix/configurator" }, "release_url": "https://pypi.org/project/configurator/1.2.0/", "requires_dist": [ "sphinx ; extra == 'build'", "sphinx-rtd-theme ; extra == 'build'", "setuptools-git ; extra == 'build'", "twine ; extra == 'build'", "wheel ; extra == 'build'", "jinja2 ; extra == 'test'", "mock ; extra == 'test'", "pyfakefs ; extra == 'test'", "pytest ; extra == 'test'", "pytest-cov ; extra == 'test'", "requests ; extra == 'test'", "sybil ; extra == 'test'", "testfixtures ; extra == 'test'", "voluptuous ; extra == 'test'", "toml ; extra == 'toml'", "pyyaml ; extra == 'yaml'" ], "requires_python": "", "summary": "A library for building a configuration store from one or more layered configuration sources", "version": "1.2.0" }, "last_serial": 5333688, "releases": { "0": [], "0.0.dev0": [ { "comment_text": "", "digests": { "md5": "36cab5de4c0759d2fef06dc8db6d5a52", "sha256": "13a5bb9e80120ad1e0bba88e087376667d103b199eb88e1dcb61ae106ab55f4d" }, "downloads": -1, "filename": "configurator-0.0.dev0-py3-none-any.whl", "has_sig": false, "md5_digest": "36cab5de4c0759d2fef06dc8db6d5a52", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10969, "upload_time": "2019-03-13T08:13:25", "url": "https://files.pythonhosted.org/packages/55/33/ee9cd373bd3092ec0b3bc6f485e53b0399279675f45a58d0a34eefe254aa/configurator-0.0.dev0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9c2e33edd536ce7a754d36a811f7ba1", "sha256": "2d7d6a689bd1eeaa0441e1f0676d722703bcb091c5567c9d13888af49d5dc075" }, "downloads": -1, "filename": "configurator-0.0.dev0.tar.gz", "has_sig": false, "md5_digest": "c9c2e33edd536ce7a754d36a811f7ba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11716, "upload_time": "2019-03-13T08:13:27", "url": "https://files.pythonhosted.org/packages/f2/83/e3ede049a0f0dddee74dcebd52ab9ad900af6783e42e39c941feef038bc2/configurator-0.0.dev0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "d5ea8b7f1c818000ede08b78407e969b", "sha256": "fe3c810930ce22dcc5598f1c0a43122d1cc2266c915b334b6a74b59eadf2bc84" }, "downloads": -1, "filename": "configurator-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d5ea8b7f1c818000ede08b78407e969b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12568, "upload_time": "2019-03-15T07:56:15", "url": "https://files.pythonhosted.org/packages/29/df/827fd808bb5685b1a0351d4ea7a805f98dd09bafef0e2510f5362a0d581a/configurator-0.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1cf20f8d8dd3cf20e573a4406fbb725c", "sha256": "2510de6693c7362072687c55b0b5f0a9cbe979716741a40f5e666479af3a22fc" }, "downloads": -1, "filename": "configurator-0.5.0.tar.gz", "has_sig": false, "md5_digest": "1cf20f8d8dd3cf20e573a4406fbb725c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12380, "upload_time": "2019-03-15T07:56:17", "url": "https://files.pythonhosted.org/packages/d1/9c/9f4da0fffe56a6ee8ec4c155c4a9ac0d3334fc571f2b8c4aa4eecb49a361/configurator-0.5.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "02622106afb010ad90d44edd3deeee37", "sha256": "e2e31a14d879bff543810aeed3d9bcaa22192566160862a6ca311c8b55ade48d" }, "downloads": -1, "filename": "configurator-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "02622106afb010ad90d44edd3deeee37", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15506, "upload_time": "2019-04-04T07:05:55", "url": "https://files.pythonhosted.org/packages/4e/d5/a9b0ec2b31f33b5d3f93caaea2af2e3e30811fd353c702ea7876d928f7cb/configurator-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "735fa7d51e725ded42cadb1f48d17061", "sha256": "9db150f5c3fff2d04d7cf449cdaee823506b9e7b80a44f54dff49d05e3aea90f" }, "downloads": -1, "filename": "configurator-1.0.0.tar.gz", "has_sig": false, "md5_digest": "735fa7d51e725ded42cadb1f48d17061", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24898, "upload_time": "2019-04-04T07:05:56", "url": "https://files.pythonhosted.org/packages/6e/0d/8e9be8425d06be690b383ecf9751a982b868d954a1d288434bfeb794c793/configurator-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "04e18d71071baa43db4b908c3896befc", "sha256": "99a8b6d4fcdcdc4ccedd1ed04099bd15ed5df75b4099388a3177d2b542ba06b4" }, "downloads": -1, "filename": "configurator-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "04e18d71071baa43db4b908c3896befc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9410, "upload_time": "2019-05-29T07:02:05", "url": "https://files.pythonhosted.org/packages/5e/f6/026e184c6a0e402055c0b4dea1e66b6a171bb692a70f2449a24c3d28e349/configurator-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fb46d0e02227fa4085095071811c186c", "sha256": "51bedb16092939e28d5bfba39a55fafc216e546764b9738797f3bba1c0ba6ff4" }, "downloads": -1, "filename": "configurator-1.1.0.tar.gz", "has_sig": false, "md5_digest": "fb46d0e02227fa4085095071811c186c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26142, "upload_time": "2019-05-29T07:02:07", "url": "https://files.pythonhosted.org/packages/e0/8d/eb0291621cfa640a4b868eb498bd6659abada6785afca73b08edcf21c0b0/configurator-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "b36ae095389ad5b89d48c86c042cd4c0", "sha256": "e3e7f361568a11f5bed0718ce04406fdc9f5d65ea6cf20ab0b7d339595ccaf91" }, "downloads": -1, "filename": "configurator-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b36ae095389ad5b89d48c86c042cd4c0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9627, "upload_time": "2019-05-29T18:11:17", "url": "https://files.pythonhosted.org/packages/da/0e/b74bb009dab935e2c2d547b5d8fe8e28a9c11ee3fe9937e967d88e0e478e/configurator-1.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb0269289d7415e563c1fe7aae01e2a6", "sha256": "dc97af9d3e3176dd68be730f311b7d8b5d9bf0a1885b124c2aa3983b1aeea437" }, "downloads": -1, "filename": "configurator-1.2.0.tar.gz", "has_sig": false, "md5_digest": "eb0269289d7415e563c1fe7aae01e2a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26583, "upload_time": "2019-05-29T18:11:18", "url": "https://files.pythonhosted.org/packages/ee/04/511d91482e0196ca3eb7bdd405e5d8b801a4add03db5ebd1cd232a1cd193/configurator-1.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b36ae095389ad5b89d48c86c042cd4c0", "sha256": "e3e7f361568a11f5bed0718ce04406fdc9f5d65ea6cf20ab0b7d339595ccaf91" }, "downloads": -1, "filename": "configurator-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b36ae095389ad5b89d48c86c042cd4c0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9627, "upload_time": "2019-05-29T18:11:17", "url": "https://files.pythonhosted.org/packages/da/0e/b74bb009dab935e2c2d547b5d8fe8e28a9c11ee3fe9937e967d88e0e478e/configurator-1.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb0269289d7415e563c1fe7aae01e2a6", "sha256": "dc97af9d3e3176dd68be730f311b7d8b5d9bf0a1885b124c2aa3983b1aeea437" }, "downloads": -1, "filename": "configurator-1.2.0.tar.gz", "has_sig": false, "md5_digest": "eb0269289d7415e563c1fe7aae01e2a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26583, "upload_time": "2019-05-29T18:11:18", "url": "https://files.pythonhosted.org/packages/ee/04/511d91482e0196ca3eb7bdd405e5d8b801a4add03db5ebd1cd232a1cd193/configurator-1.2.0.tar.gz" } ] }