{ "info": { "author": "Ken", "author_email": "kenjyco@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries" ], "description": "Setup in your package\n---------------------\n\nCreate a default/sample ``settings.ini`` file in the module directory of\nyour package, with a ``[default]`` section and any other ``[sections]``\nyou want (i.e. app environments)\n\n::\n\n [default]\n something = 100\n\n [dev]\n redis_url = redis://localhost:6379/1\n something = 500\n\n [test]\n redis_url = redis://localhost:6379/9\n things = none, true, false, 1, 2.5, dogs\n\nCreate a ``MANIFEST.in`` file in your package directory with the\nfollowing\n\n::\n\n include settings.ini\n\nUpdate the ``setup.py`` file of the package to include the\n``setting.ini`` file and add ``settings-helper`` to ``install_requires``\nlist\n\n::\n\n from setuptools import setup, find_packages\n\n setup(\n name='package-name',\n version='0.0.1',\n ...\n packages=find_packages(),\n install_requires=[\n 'settings-helper',\n ...\n ],\n include_package_data=True,\n package_dir={'': '.'},\n package_data={\n '': ['*.ini'],\n },\n ...\n )\n\nNote, your package directory tree will be something like the following\n\n::\n\n package-name\n \u251c\u2500\u2500 .gitignore\n \u251c\u2500\u2500 LICENSE.txt\n \u251c\u2500\u2500 MANIFEST.in\n \u251c\u2500\u2500 README.md\n \u251c\u2500\u2500 README.rst\n \u251c\u2500\u2500 package_name/\n \u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 settings.ini\n \u2514\u2500\u2500 setup.py\n\nUsage\n-----\n\nUse in ``__init__.py`` of package\n\n::\n\n import settings_helper as sh\n\n get_setting = sh.settings_getter(__name__)\n something = get_setting('something')\n something_else = get_setting('something_else', 'default_val')\n\nSet ``APP_ENV`` environment variable to be one of your section names\nwhen starting your Python interpreter/server. ``APP_ENV`` defaults to\n``dev``\\ if it is not set.\n\n- The ``get_setting`` func will return the value of the requested\n variable if it is set in the section specified in ``APP_ENV``.\n- If the variable is not in the section, it will pull the value from\n the ``[default]`` section\n- If the varialbe is not in the ``[default]`` section either, then\n return the optional fallback value passed in the ``default`` keyword\n argument to ``get_setting`` (which defaults to an empty string)\n- **If the requested variable exists in the environment (or its\n uppercase equivalent), it will be used instead of getting from\n settings.ini**\n- The value is automatically converted to a bool, None, int, or float\n if it should be\n- If the value contains any of (, ; \\|) then a list of converted values\n will be returned\n\nThe first time that ``settings_getter`` func in invoked, it looks for a\n``settings.ini`` file in ``~/.config/package-name/settings.ini``.\n\n- If it does not find it, it will copy the default settings.ini from\n the module\u2019s install directory to that location\n- If the settings.ini file does not exist in the module\u2019s install\n directory, an exception is raised\n\nAlternate Usage\n---------------\n\n::\n\n import settings_helper as sh\n\n settings = sh.get_all_settings(__name__)\n\nThe ``get_all_settings`` func returns a dict containing all sections\nother than \u2018default\u2019.\n\n- If a setting is defined in \u2018default\u2019, but not in a particular\n section, the setting in \u2018default\u2019 will appear under the section\n- If a setting (or upper-case equivalent) is defined as an environment\n variable, that value will be used for all sections that use it\n\nTip\n---\n\nIn your ``/tests/__init__.py`` file, add the following so\nthe ``test`` section of settings is automatically used\n\n::\n\n import os\n\n os.environ['APP_ENV'] = 'test'\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/kenjyco/settings-helper/tarball/v0.0.7", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kenjyco/settings-helper", "keywords": "settings,helper", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "settings-helper", "package_url": "https://pypi.org/project/settings-helper/", "platform": "", "project_url": "https://pypi.org/project/settings-helper/", "project_urls": { "Download": "https://github.com/kenjyco/settings-helper/tarball/v0.0.7", "Homepage": "https://github.com/kenjyco/settings-helper" }, "release_url": "https://pypi.org/project/settings-helper/0.0.7/", "requires_dist": [ "input-helper" ], "requires_python": "", "summary": "Helpers to get specific settings from a particular section of a settings.ini file", "version": "0.0.7" }, "last_serial": 5828008, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "07b20d5012b96d6947362e8be8a08da8", "sha256": "da4609e5847c76817fbd8b43a0104268fe771e4f7eed2b50ad6cba3e0c3ca046" }, "downloads": -1, "filename": "settings_helper-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "07b20d5012b96d6947362e8be8a08da8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3279, "upload_time": "2017-12-07T14:57:16", "url": "https://files.pythonhosted.org/packages/e0/03/8eb33001adc192d894c6f2cc029d9fbf2c7493238f00c76a3217975ca177/settings_helper-0.0.1-py3-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4e9d9a31ef18d921227435ad6864e6e3", "sha256": "73559ab21d4eff8474bab3d6c8e001ceb378b46bf9d61a63a0679b7e476bae24" }, "downloads": -1, "filename": "settings_helper-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4e9d9a31ef18d921227435ad6864e6e3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5812, "upload_time": "2018-07-20T08:16:16", "url": "https://files.pythonhosted.org/packages/22/a5/b21642f930042dc9b470ff2879f4c847223c6251763726b361f44d2bf9a3/settings_helper-0.0.2-py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "216890290397a3571a911df29799974f", "sha256": "86b33105601cf8deb25d579025ff6c01a57bfd59c0fb857a4d02ee87e5240f27" }, "downloads": -1, "filename": "settings_helper-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "216890290397a3571a911df29799974f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4220, "upload_time": "2018-11-14T15:08:36", "url": "https://files.pythonhosted.org/packages/bb/6f/3438e977ddbbf0698e42f2b07a1e31219ff9c1f62a2dfde44b01cd9f833c/settings_helper-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "124543c1a38b27851da88717a4f35f84", "sha256": "55759478c4675df5e225ba9ac7c32f1accba91ce16a668242972289ffc0bd46a" }, "downloads": -1, "filename": "settings_helper-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "124543c1a38b27851da88717a4f35f84", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5784, "upload_time": "2019-04-02T09:21:49", "url": "https://files.pythonhosted.org/packages/2a/99/140f844514f8abbf5a0172dd7c82a2c0b658e1476c435caaba004bac60bb/settings_helper-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "8a519c8dbf1f84e29413edfb65c2e430", "sha256": "91fd9ea9baa987eef1f8eda143e2497a4c4f3559a63b1d38d6f102a6f66898c0" }, "downloads": -1, "filename": "settings_helper-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "8a519c8dbf1f84e29413edfb65c2e430", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5800, "upload_time": "2019-04-05T18:15:11", "url": "https://files.pythonhosted.org/packages/43/af/b6ca76bc984916312e3e05b5d8d6f9f4165d07dde7d63f5039213c8b9518/settings_helper-0.0.5-py3-none-any.whl" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "57d87ebf2d090f0607a434f67d257134", "sha256": "6ae044b3b8503cb66534a19eb1ec86dce1ee14ded297bdbb09d5be6f2ed8dc0d" }, "downloads": -1, "filename": "settings_helper-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "57d87ebf2d090f0607a434f67d257134", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6057, "upload_time": "2019-09-12T04:46:57", "url": "https://files.pythonhosted.org/packages/b0/88/bb27b6c936389a82f9de513685e5bd63131a959b929fc2e76d23ea4fafa5/settings_helper-0.0.6-py3-none-any.whl" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "5ebb8fa0e9c322aacde4bab77399eb14", "sha256": "9e0ee2d68ca63145f19b80eb96a8fbac7f096879f0ac1b123f31ad897eb1904b" }, "downloads": -1, "filename": "settings_helper-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "5ebb8fa0e9c322aacde4bab77399eb14", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6067, "upload_time": "2019-09-13T22:33:51", "url": "https://files.pythonhosted.org/packages/6a/19/4dcc0b6f23a0ab9dd96bd784c5da613c5ff93c17eae16d4c3b5251aadeaf/settings_helper-0.0.7-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5ebb8fa0e9c322aacde4bab77399eb14", "sha256": "9e0ee2d68ca63145f19b80eb96a8fbac7f096879f0ac1b123f31ad897eb1904b" }, "downloads": -1, "filename": "settings_helper-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "5ebb8fa0e9c322aacde4bab77399eb14", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6067, "upload_time": "2019-09-13T22:33:51", "url": "https://files.pythonhosted.org/packages/6a/19/4dcc0b6f23a0ab9dd96bd784c5da613c5ff93c17eae16d4c3b5251aadeaf/settings_helper-0.0.7-py3-none-any.whl" } ] }