{ "info": { "author": "Niels Lensink", "author_email": "niels.lenssink@kpn.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP" ], "description": "pkgsettings\n===========\n\n.. image:: https://secure.travis-ci.org/kpn-digital/py-pkgsettings.svg?branch=master\n :target: http://travis-ci.org/kpn-digital/py-pkgsettings?branch=master\n\n.. image:: https://img.shields.io/codecov/c/github/kpn-digital/py-pkgsettings/master.svg\n :target: http://codecov.io/github/kpn-digital/py-pkgsettings?branch=master\n\n.. image:: https://img.shields.io/pypi/v/pkgsettings.svg\n :target: https://pypi.python.org/pypi/pkgsettings\n\n.. image:: https://readthedocs.org/projects/py-pkgsettings/badge/?version=latest\n :target: http://py-pkgsettings.readthedocs.org/en/latest/?badge=latest\n\n\nGoal\n----\n\nThe goal of this package is to offer an easy, generic and extendable way\nof configuring a package.\n\nInstallation\n------------\n.. start_installation\n\n.. code-block:: bash\n\n $ pip install pkgsettings\n\n.. end_installation\n\nUsage\n-----\n.. start_usage\n.. code-block:: python\n\n from pkgsettings import Settings\n\n # Create the settings object for your package to use\n settings = Settings()\n\n # Now let's define the default settings\n settings.configure(hello='World', debug=False)\n\nBy calling the configure you actually inject a ``layer`` of settings.\nWhen requesting a setting it will go through all layers until it finds the\nrequested key.\n\nNow if someone starts using your package it can easily modify the active\nsettings of your package by calling the configure again.\n\n.. code-block:: python\n\n from my_awesome_package.conf import settings\n\n # Lets change the configuration here\n settings.configure(debug=True)\n\n\nNow from within your package you can work with the settings like so:\n\n.. code-block:: python\n\n from conf import settings\n\n print(settings.debug) # This will print: True\n print(settings.hello) # This will print: World\n\nIt is also possible to pass an object instead of kwargs.\nThe settings object will call ``getattr(ur_object, key)``\nAn example below:\n\n.. code-block:: python\n\n class MySettings(object):\n def __init__(self):\n self.debug = True\n\n settings = Settings()\n settings.configure(MySettings())\n print(settings.debug) # This will print: True\n\nMore advanced usage\n-------------------\n\nThe settings object can also be used as context manager:\n\n.. code-block:: python\n\n with settings(debug=True):\n print(settings.debug) # This will print: True\n\n print(settings.debug) # This will print: False\n\nAdditionally you can also use this as a decorator:\n\n.. code-block:: python\n\n @settings(debug=True)\n def go()\n print(settings.debug) # This will print: True\n\n go()\n\n print(settings.debug) # This will print: False\n\nPrefixed Settings\n-----------------\n\nIf a group of settings share a common prefix, you can make\nuse of the ``PrefixedSettings`` class and pass the desired\nprefix as an argument, together with the main settings instance.\nAll attributes will be automatically prefixed when accessed.\n\n.. code-block:: python\n\n from pkgsettings import PrefixedSettings, Settings\n\n # First create the settings object for your package to use\n settings = Settings()\n\n # Suppose some of your settings are all prefixed with 'FOO'\n settings.configure(FOO_a='a', FOO_b='b', c='c', debug=False)\n\n # Create a PrefixedSettings instance with the desired prefix\n foo_settings = PrefixedSettings(settings, 'FOO_')\n\n foo_settings.a # This will print: a\n foo_settings.b # This will print: b\n\n foo_settings.c # This will raise an AttributeError\n\n.. end_usage", "description_content_type": null, "docs_url": "https://pythonhosted.org/pkgsettings/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kpn-digital/py-pkgsettings.git", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pkgsettings", "package_url": "https://pypi.org/project/pkgsettings/", "platform": "", "project_url": "https://pypi.org/project/pkgsettings/", "project_urls": { "Homepage": "https://github.com/kpn-digital/py-pkgsettings.git" }, "release_url": "https://pypi.org/project/pkgsettings/0.12.0/", "requires_dist": null, "requires_python": "", "summary": "Python package to ease the configuration of packages", "version": "0.12.0" }, "last_serial": 3098048, "releases": { "0.10.0": [ { "comment_text": "", "digests": { "md5": "bbf7bb32b75ddc6071a945dc555a5e81", "sha256": "96f1f1e6bb21fac63e77174eb33e8b5a821d8ccb040b204f8a0fcb44c150f9ba" }, "downloads": -1, "filename": "pkgsettings-0.10.0.tar.gz", "has_sig": false, "md5_digest": "bbf7bb32b75ddc6071a945dc555a5e81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12743, "upload_time": "2016-07-15T06:52:35", "url": "https://files.pythonhosted.org/packages/0d/bc/2c3f5ce4f35cae4f1109dd7e20c0a9d2891ee313d16c123878fc0d3cb2cb/pkgsettings-0.10.0.tar.gz" } ], "0.10.1": [ { "comment_text": "", "digests": { "md5": "cd350a2f12288d6dcb0488945863e8d5", "sha256": "4480a451ac4a69501c63e5e6ff059a7d87d54494979532088a6dee2caa79c87e" }, "downloads": -1, "filename": "pkgsettings-0.10.1.tar.gz", "has_sig": false, "md5_digest": "cd350a2f12288d6dcb0488945863e8d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12175, "upload_time": "2017-06-23T13:22:24", "url": "https://files.pythonhosted.org/packages/fb/c3/d0daf57a4ee165d45f78f02a54c54799d01106bb13992e2b1f7a7cbdc45a/pkgsettings-0.10.1.tar.gz" } ], "0.11.0": [ { "comment_text": "", "digests": { "md5": "637b0c7e4951998edd06398e8e999ca2", "sha256": "44dae2cdfa3fb4cf435779160cf650a90500f8b0ccbb817b57487f05f864d167" }, "downloads": -1, "filename": "pkgsettings-0.11.0.tar.gz", "has_sig": false, "md5_digest": "637b0c7e4951998edd06398e8e999ca2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12858, "upload_time": "2017-07-12T09:31:58", "url": "https://files.pythonhosted.org/packages/c8/34/395b02d2014cc6c726a7f174eef87c5a2adca84f63a5313fc2ec94d36d7a/pkgsettings-0.11.0.tar.gz" } ], "0.12.0": [ { "comment_text": "", "digests": { "md5": "ef4e23eefed2f1dfcc352534f00f4c06", "sha256": "149102d1c3d2179140eaa8acd94b085aaa6ae30605d425b84aa83a3bb1536658" }, "downloads": -1, "filename": "pkgsettings-0.12.0.tar.gz", "has_sig": false, "md5_digest": "ef4e23eefed2f1dfcc352534f00f4c06", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12987, "upload_time": "2017-08-15T12:55:01", "url": "https://files.pythonhosted.org/packages/ea/b7/1366a939081169480df4fb93309b6ba0a6ed7007a99ec684afccc7dc5a87/pkgsettings-0.12.0.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "d4de9c7b1787d13b1a927debf0d1dcd9", "sha256": "88ccbed245fe1253a04b825b58e03730964da30844a9a07300455e6234fa9906" }, "downloads": -1, "filename": "pkgsettings-0.9.0.tar.gz", "has_sig": false, "md5_digest": "d4de9c7b1787d13b1a927debf0d1dcd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11469, "upload_time": "2016-03-09T16:55:48", "url": "https://files.pythonhosted.org/packages/f0/88/1eecfa355831b7a4f255a013509c04535dc7a4acd8a7107f7967b887aae7/pkgsettings-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "14e45b107c6f4059b629eb8b18c27b6f", "sha256": "6d23ebea0fabfb895596dcec91f51fb6c6105bf5a192f1d22fdfe17321a7ebbf" }, "downloads": -1, "filename": "pkgsettings-0.9.1.tar.gz", "has_sig": false, "md5_digest": "14e45b107c6f4059b629eb8b18c27b6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11460, "upload_time": "2016-03-09T16:56:38", "url": "https://files.pythonhosted.org/packages/35/14/d22a4b19806b89a79035bc5d045a0a70a885d3e8e4ddf121ffd5b1c28e2d/pkgsettings-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "d698fa7d4dac91deb0749c6cb51eaca0", "sha256": "c4c2b90c3ce85e807a6991fe005b3211fd1fbb58158dd30409cd7823d0c54646" }, "downloads": -1, "filename": "pkgsettings-0.9.2.tar.gz", "has_sig": false, "md5_digest": "d698fa7d4dac91deb0749c6cb51eaca0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12090, "upload_time": "2016-03-09T18:09:24", "url": "https://files.pythonhosted.org/packages/73/11/26551422b34e475ef49fae81eaeeef38080f0431b69a416065d77503de0d/pkgsettings-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "3c1615c4b4066c1f3a2d14b31fe46cc5", "sha256": "26e057892583755bc344bc2869f1f459e0f2a59dcee146338e05c7bb49de791a" }, "downloads": -1, "filename": "pkgsettings-0.9.3.tar.gz", "has_sig": false, "md5_digest": "3c1615c4b4066c1f3a2d14b31fe46cc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12142, "upload_time": "2016-04-08T12:27:57", "url": "https://files.pythonhosted.org/packages/a9/e5/f235e7d34febae00e7b1ebf6a33be489fd757d3bb8f6e67566e06859a469/pkgsettings-0.9.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ef4e23eefed2f1dfcc352534f00f4c06", "sha256": "149102d1c3d2179140eaa8acd94b085aaa6ae30605d425b84aa83a3bb1536658" }, "downloads": -1, "filename": "pkgsettings-0.12.0.tar.gz", "has_sig": false, "md5_digest": "ef4e23eefed2f1dfcc352534f00f4c06", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12987, "upload_time": "2017-08-15T12:55:01", "url": "https://files.pythonhosted.org/packages/ea/b7/1366a939081169480df4fb93309b6ba0a6ed7007a99ec684afccc7dc5a87/pkgsettings-0.12.0.tar.gz" } ] }