{ "info": { "author": "Netherlands Forensic Institute", "author_email": "holmesnl@users.noreply.github.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Utilities" ], "description": "\nconfidence.py :+1:\n==================\n\nConfidence makes it easy to load one or multiple sources of\nconfiguration values and exposes them as a simple to use Python object.\nGiven the following YAML file:\n\n.. code:: yaml\n\n foo:\n bar: 42\n\n foo.baz: '21 is only half the answer'\n\n foobar: the answer is ${foo.bar}\u2026\n\nUse it with confidence:\n\n.. code:: python\n\n # load configuration from a YAML file\n configuration = confidence.loadf('path/to/configuration.yaml')\n\n # a Configuration object is like a dict, but better\n value = configuration.get('foo.bar')\n value = configuration.get('foo.bar', default=42)\n # or even kwargs, should you want to\n # (passing bar=42 and foo='21 is only half the answer')\n function(**configuration.foo)\n\n # namespaces are one honking great idea -- let's do more of those!\n value = configuration.foo.bar\n # they're even safe when values might be missing\n value = configuration.foo.whoopsie\n if value is NotConfigured:\n value = 42\n # or, similar\n value = configuration.foo.whoopsie or 42\n\n # even references to other configured values will work\n value = configuration.foobar # 'the answer is 42\u2026'\n\nOften, combining multiple sources of configuration can be useful when\ndefining defaults or reading from multiple files:\n\n.. code:: python\n\n configuration = confidence.loadf('/etc/system-wide-defaults.yaml',\n './local-overrides.yaml')\n\n # confidence provides a convenient way of using this kind of precedence,\n # letting 'more local' files take precedence over system-wide sources\n # load_name will attempt to load multiple files, skipping ones that\n # don't exist (using typical *nix paths, XDG-specified locations, some\n # Windows environment variables and typical OSX paths):\n # - /etc/xdg/app.yaml\n # - /etc/app.yaml\n # - /Library/Preferences/app.yaml\n # - C:/ProgramData/app.yaml\n # - ~/.config/app.yaml\n # - ~/Library/Preferences/app.yaml\n # - ~/AppData/Roaming/app.yaml\n # - ~/.app.yaml\n # - ./app.yaml\n\n configuration = confidence.load_name('app')\n\n # if set, load_name will take a look at environment variables like\n # APP_FOO_BAR and APP_FOO_BAZ, mixing those in as foo.bar and foo.baz\n\n # the default load order can be overridden if necessary:\n\n configuration = confidence.load_name('app', load_order=confidence.loaders(\n # loading system after user makes system locations take precedence\n confidence.Locality.user, confidence.Locality.system\n ))\n\nWhile powerful, no set of convenience functions will ever satisfy\neveryone's use case. To be able to serve as wide an audience as\npossible, confidence doesn't hide away its flexible internal API.\n\n.. code:: python\n\n # let's say application defaults are available as a dict in source\n app_defaults = {'foo': {'bar': 42},\n 'foo.baz': '21 is only half the answer'}\n\n # and we've already created a way to read a dict from somewhere\n def read_from_source(name):\n ...\n return read_values\n\n # all of this can be combined to turn it into a single glorious Configuration instance\n # precedence rules apply here, values from read_from_source will overwrite both\n # app_defaults and values read from file\n configuration = confidence.Configuration(app_defaults,\n # yeah, this would be a Configuration instance\n # remember it's just like a dict?\n confidence.loadf('path/to/app.yaml'),\n read_from_source('app'))\n # make it so, no. 1\n run_app(configuration)\n\n.. |Build Status| image:: https://img.shields.io/travis/HolmesNL/confidence/master.svg\n :target: https://travis-ci.org/HolmesNL/confidence\n.. |Coverage Status| image:: https://img.shields.io/coveralls/HolmesNL/confidence/master.svg\n :target: https://coveralls.io/r/HolmesNL/confidence?branch=master\n\n\nChanges\n=======\n\n0.6.1 (2019-04-12)\n------------------\n\n- Fix resolving references during loading when sources passed to `Configuration` are `Configuration` instances themselves.\n\n0.6 (2019-04-05)\n----------------\n\n- Add `Missing` policy to control what to do with unconfigured keys on attribute access\n- Split single-file module into multi-module package (user-facing names importable from `confidence` package)\n- Raise errors when merging / splitting non-`str` type keys, avoiding issues with confusing and broken access patterns\n\n0.5 (2019-02-01)\n----------------\n\n- Enable referencing keys from values\n- Enable customizing load order for `load_name` through `loaders` and `Locality` (default behaviour remains unchanged)\n\n0.4.1 (2018-11-26)\n------------------\n\n- Warn about attribute access to configuration keys that collide with `Configuration` members.\n\n0.4 (2018-07-09)\n----------------\n\n- Enable escaping underscores in environment variables (``NAME_FOO__BAR`` results in ``config.foo_bar``).\n- Use ``yaml.safe_load`` to avoid security issues with ``yaml.load``.\n- Raise ``AttributeError`` when attempting to set a non-protected attribute on a `Configuration` instance.\n\n0.3 (2018-05-24)\n----------------\n\n- Enable ignoring missing files in `loadf`.\n- Fix crashes when reading empty or comment-only yaml files.\n\n0.2 (2018-03-06)\n----------------\n\n- Read files from `XDG-specified `_ directories.\n- Read files form system-wide and user-local directories specified in environment variables ``PROGRAMDATA``, ``APPDATA`` and ``LOCALAPPDATA`` (in that order).\n- Read files from ``/Library/Preferences`` and ``~/Library/Preferences``.\n\n0.1.1 (2018-01-12)\n------------------\n\n- Expand user dirs for arguments to `loadf`, including values for ``EXAMPLE_CONFIG_FILE`` environment variables.\n\n0.1 (2017-12-18)\n----------------\n\n- Initial release.\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/HolmesNL/confidence/", "keywords": "configuration", "license": "Apache Software License 2.0", "maintainer": "", "maintainer_email": "", "name": "confidence", "package_url": "https://pypi.org/project/confidence/", "platform": "", "project_url": "https://pypi.org/project/confidence/", "project_urls": { "Homepage": "https://github.com/HolmesNL/confidence/" }, "release_url": "https://pypi.org/project/confidence/0.6.1/", "requires_dist": [ "pyyaml" ], "requires_python": "", "summary": "Simple module to load and use configuration in a clean, 'pythonic' way.", "version": "0.6.1" }, "last_serial": 5134229, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "95a5d1492d1c8f517f9818b8559683a9", "sha256": "bc30dc7617cf7393b1735032952cdc9ca73413af59b2ab1dc7de34c3052e7504" }, "downloads": -1, "filename": "confidence-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "95a5d1492d1c8f517f9818b8559683a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8369, "upload_time": "2017-12-18T13:01:23", "url": "https://files.pythonhosted.org/packages/0c/5f/c310bd958e4b5522b23dee047870bc65755d8d36adc3bbc90781365f682c/confidence-0.1-py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c67dab717d8433588e784ae8ee3a0950", "sha256": "0c10dd9167a29c091ff3a31827b0dd4e81ac28c098d4d2ff7c20492fbdcea67f" }, "downloads": -1, "filename": "confidence-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c67dab717d8433588e784ae8ee3a0950", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8371, "upload_time": "2018-01-12T13:42:48", "url": "https://files.pythonhosted.org/packages/15/4c/d50732ce5945a8d1b247e9423458b17f0b52b420bf98ecc129c3c588757f/confidence-0.1.1-py3-none-any.whl" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "9adae5c01a74607f5dcd0cb64f5ef86c", "sha256": "35d0c0021a4f8fcb758ec64356f7381a917d9012108b7c1ff2964d177209d6ce" }, "downloads": -1, "filename": "confidence-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9adae5c01a74607f5dcd0cb64f5ef86c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9996, "upload_time": "2018-03-06T12:43:35", "url": "https://files.pythonhosted.org/packages/bd/42/e0466dbd9f7f34bb30963bf85cac637ec532b60b989089e4bc3ef99e547f/confidence-0.2-py3-none-any.whl" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "9f817911258e098513d494da8082c6d8", "sha256": "f5a3e186d292598f641ea22e8b090b4279e96ff8156e59de82ddd86e05b9f022" }, "downloads": -1, "filename": "confidence-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9f817911258e098513d494da8082c6d8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7596, "upload_time": "2018-05-24T19:56:05", "url": "https://files.pythonhosted.org/packages/9a/f1/3e0f0fa84318dfb49b46246c6a236e320598766cf07f1396402b74cb9dce/confidence-0.3-py3-none-any.whl" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "9f5b38a07284da87e85f98fa6473f0e5", "sha256": "6c2c9b69ad152778a063f453cc04398997f5e2e81e97f43ca5c63453b409ee78" }, "downloads": -1, "filename": "confidence-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "9f5b38a07284da87e85f98fa6473f0e5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8095, "upload_time": "2018-07-09T12:59:58", "url": "https://files.pythonhosted.org/packages/fb/f1/62ce014e15f5e7d79e80ff55197fa371eae095fc6c783ea598ac934e7ba3/confidence-0.4-py3-none-any.whl" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "f1c118a36b5773ebd45b8673be5f6b0f", "sha256": "0e1d4d801f4333ab4b1cfc3372fff825ac52f1010d89ae68c84b1ca947a27b13" }, "downloads": -1, "filename": "confidence-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f1c118a36b5773ebd45b8673be5f6b0f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12452, "upload_time": "2018-11-26T10:33:20", "url": "https://files.pythonhosted.org/packages/6f/64/3a2c55d5ea5d8d69ff48f5cf59a54b6bb665a8710a9f7c3d9fc42db129d1/confidence-0.4.1-py3-none-any.whl" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "18e07cc11e0096f8312e2dd0737d198d", "sha256": "cd4c6558b3b501e254ce1e0bedb9a680afe022fa1b635b15bd7c1a14198955d4" }, "downloads": -1, "filename": "confidence-0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "18e07cc11e0096f8312e2dd0737d198d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14097, "upload_time": "2019-02-01T17:17:48", "url": "https://files.pythonhosted.org/packages/4c/db/c18b3c1261bd5a84225e7035c1d74c724e9242365b191d137d85443800d8/confidence-0.5-py3-none-any.whl" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "645216f656b52bc9d7fc963c84faad20", "sha256": "6206d5bd0395b5a6d1c4a7dbb82d4104511b1dfdfd44898c8ace90cdc8897013" }, "downloads": -1, "filename": "confidence-0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "645216f656b52bc9d7fc963c84faad20", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16458, "upload_time": "2019-04-05T08:23:01", "url": "https://files.pythonhosted.org/packages/f4/f8/8b6bfe8e89bd33994da6b35ce27bf16fc2afec5b8d3045f4b4b357a46e7d/confidence-0.6-py3-none-any.whl" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "1855047c9189c6262434e320c6558720", "sha256": "75ad9bb4fff5c4b39653df045cb0a11e86094a2359801f1e45255a78113c599a" }, "downloads": -1, "filename": "confidence-0.6.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1855047c9189c6262434e320c6558720", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16580, "upload_time": "2019-04-12T14:29:59", "url": "https://files.pythonhosted.org/packages/a5/a4/9c3ee541be8e4f1fcb6cea5a3b80abc242c32e017d4a7aca24dfe1c5c94d/confidence-0.6.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1855047c9189c6262434e320c6558720", "sha256": "75ad9bb4fff5c4b39653df045cb0a11e86094a2359801f1e45255a78113c599a" }, "downloads": -1, "filename": "confidence-0.6.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1855047c9189c6262434e320c6558720", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16580, "upload_time": "2019-04-12T14:29:59", "url": "https://files.pythonhosted.org/packages/a5/a4/9c3ee541be8e4f1fcb6cea5a3b80abc242c32e017d4a7aca24dfe1c5c94d/confidence-0.6.1-py3-none-any.whl" } ] }