{ "info": { "author": "Soixante circuits", "author_email": "emmanuel@soixantecircuits.fr", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: System :: Installation/Setup", "Topic :: Utilities" ], "description": "pyStandardSettings\n==================\n\nStandardised settings loader\n\na port of nodejs `standard-settings `_\n\n\nWhy\n---\n\nNo more `cp config.sample.json config.json`.\n\nYour app presents a `settings/settings.default.json` which is always included. \nUser, or other developer needing custom settings, loads his custom settings, overriding default settings. \nIf a key is missing in user settings, it won't trigger any error, as a default value is in `settings.default.json`. \n`standard-settings` offers multiple ways to change settings: `settings.json` file, command line arguments, environment variables. \nCheck below examples for usage and priority order.\n\nInstallation\n------------\n\n.. code:: bash\n\n pip install pyStandardSettings \n\nUsage\n-----\n\nThis module loads settings from a file, from commandline arguments, and environment variables.\nIt should be required at the very beginning of your project:\n\n.. code:: python\n\n from pyStandardSettings import settings\n\n\nThen your settings are accessible using:\n\n.. code:: python\n\n print settings.server.port\n\nPriority order\n--------------\n\n1. Environment variables\n\nExample:\n\n.. code:: bash\n\n SERVER_PORT=2500 python main.py \n service_spacebro_inputMessage=new-media python main.py\n\n2. Command line parameters (argv)\n\nExample: \n\n.. code:: bash\n\n python main.py --server.port 2000 # to specify a field \n python main.py --settings settings/settings.prod.json # to specify a settings file \n\nNB: To use a key with argv, it needs to be present in `settings.default.json`\n\n3. Files\n\nThese files are always loaded if present: \n\n`settings/settings.json` first \n\n`settings/settings.default.json`\n\nWorking all together with different settings\n--------------------------------------------\n\nOn your project, you may have other developers working with different settings. \nPushing them in the repo is annoying. We know you've seen that before. \nUsing standard-settings, developers can share common default settings, AND load custom settings.\n\nBest practice is to add `settings/settings.default.json` in your repo, this file covers default settings, common for each developer. \nAnd `.gitignore` `settings/settings.json`, this file has custom settings inside. \n\nSchema\n------\n\nThe following schema is an example of settings used in Soixante circuits apps:\n\n\n.. code:: json\n\n {\n \"server\": {\n \"host\" : \"myip\",\n \"port\" : 3333\n },\n \"timeout\": {\n \"lookbook\": 5,\n \"popup\": 4\n },\n \"folder\": {\n \"kcDownloader\": \"path-to/data\",\n \"lookbook\": \"path-to/lookbook\"\n },\n \"flag\": {\n \"stabalize\": true,\n \"devMode\": true\n },\n \"customKey\": {\n \"maxImageNumber\": 64\n },\n \"meta\": {\n \"title\": \"\",\n \"description\": \"\",\n \"message\": \"...\",\n \"source\": \"\"\n },\n \"service\": {\n \"altruist\": {\n \"host\" : \"192.168.1.6\",\n \"port\" : 6666\n },\n \"spacebro\": {\n \"host\" : \"192.168.1.6\",\n \"port\" : 8888,\n \"channelName\": \"my-channel\",\n \"client\" : {\n \"name\" : \"my-app\"\n }\n }\n }\n }\n\nSee `soixantecircuits/standard `_\n\nGoodies\n-------\n\nTo list all settings keys available in your project, use\n\n\n.. code:: bash\n\n python main.py -h\n\n\nand it will display\n\n.. code:: bash\n\n usage: main.py [-h] [-s SETTINGS] [--recipe RECIPE]\n [--server.host SERVER.HOST] [--server.port SERVER.PORT]\n\n optional arguments:\n -h, --help show this help message and exit\n -s SETTINGS, --settings SETTINGS\n settings file in json format\n --recipe RECIPE\n --server.host SERVER.HOST\n --server.port SERVER.PORT\n\ntest command\n============\n\n.. code:: bash\n\n python -m tests.test\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/soixantecircuits/pyStandardSettings", "keywords": "argv env settings config commandline arguments conf file json", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyStandardSettings", "package_url": "https://pypi.org/project/pyStandardSettings/", "platform": "", "project_url": "https://pypi.org/project/pyStandardSettings/", "project_urls": { "Homepage": "https://github.com/soixantecircuits/pyStandardSettings" }, "release_url": "https://pypi.org/project/pyStandardSettings/0.0.1/", "requires_dist": [ "dotmap (>=1.2.17)", "mock (>=1.0.1); extra == 'test'" ], "requires_python": "", "summary": "Standardised settings loader", "version": "0.0.1" }, "last_serial": 3049658, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d67d4f46268b1bce5ef5b9bc294857fd", "sha256": "66001deb54038b49fc9650168bddc640888fa5372ba62fa417a554e7ac012ee9" }, "downloads": -1, "filename": "pyStandardSettings-0.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d67d4f46268b1bce5ef5b9bc294857fd", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7355, "upload_time": "2017-07-26T09:45:44", "url": "https://files.pythonhosted.org/packages/33/85/c5c91362fd79709d63d1244b5c5a1ae763fb25d98d60e806970a448ac96b/pyStandardSettings-0.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ad236b03532e98b3067a189f12f6e70", "sha256": "ccc57de1bfc6a36b72734ed9137ed6d0818006d8ef1f76f13a0cb79da22d660b" }, "downloads": -1, "filename": "pyStandardSettings-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2ad236b03532e98b3067a189f12f6e70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6462, "upload_time": "2017-07-26T09:45:46", "url": "https://files.pythonhosted.org/packages/de/7b/a02a0de40d4bf55593d8b009e417617532ca917fc6638f51af46edbde800/pyStandardSettings-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d67d4f46268b1bce5ef5b9bc294857fd", "sha256": "66001deb54038b49fc9650168bddc640888fa5372ba62fa417a554e7ac012ee9" }, "downloads": -1, "filename": "pyStandardSettings-0.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d67d4f46268b1bce5ef5b9bc294857fd", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7355, "upload_time": "2017-07-26T09:45:44", "url": "https://files.pythonhosted.org/packages/33/85/c5c91362fd79709d63d1244b5c5a1ae763fb25d98d60e806970a448ac96b/pyStandardSettings-0.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ad236b03532e98b3067a189f12f6e70", "sha256": "ccc57de1bfc6a36b72734ed9137ed6d0818006d8ef1f76f13a0cb79da22d660b" }, "downloads": -1, "filename": "pyStandardSettings-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2ad236b03532e98b3067a189f12f6e70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6462, "upload_time": "2017-07-26T09:45:46", "url": "https://files.pythonhosted.org/packages/de/7b/a02a0de40d4bf55593d8b009e417617532ca917fc6638f51af46edbde800/pyStandardSettings-0.0.1.tar.gz" } ] }