{ "info": { "author": "Prahlad Yeri", "author_email": "prahladyeri@yahoo.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "![pypi](https://img.shields.io/pypi/v/cfgsaver.svg)\n![python](https://img.shields.io/pypi/pyversions/cfgsaver.svg)\n![implementation](https://img.shields.io/pypi/implementation/cfgsaver.svg)\n\n\n![license](https://img.shields.io/github/license/prahladyeri/cfgsaver.svg)\n![last-commit](https://img.shields.io/github/last-commit/prahladyeri/cfgsaver.svg)\n\n[![donate](https://img.shields.io/badge/-Donate-blue.svg?logo=paypal)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JM8FUXNFUK6EU)\n[![follow](https://img.shields.io/twitter/follow/prahladyeri.svg?style=social)](https://twitter.com/prahladyeri)\n# cfgsaver\n\n![project logo](https://raw.githubusercontent.com/prahladyeri/cfgsaver/master/logo.png)\n\nPython library to save and fetch configuration data in a standard/conventional path and format.\n\n# Installation\n\n```bash\npip install cfgsaver\n```\n\n# Usage\n\nImport the `cfgsaver` module to save/read configuration values in your source files:\n\n```python\nfrom cfgsaver import cfgsaver\n\ndef save_config():\n\t# saves configuration data to ~/.config//cfg.json\n\t# unless cfgpath parameter is overridden:\n\tconfig = {'name': 'Prahlad', \n\t'language': 'Python', \n\t'framework': 'Flask'\n\t}\n\tcfgsaver.save('', config)\n\ndef get_config():\n\t# gets configuration data from ~/.config//cfg.json \n\t# unless cfgpath parameter is overridden:\n\tconfig = cfgsaver.get(\"\") #returns None if config file doesn't exist\n```\n\n\nIn case you want to ship some default configuration data packaged with your app, then read the below instructions carefully:\n\nEnsure to include the path to your cfg.json in `MANIFEST.in` as follows (you'll have to copy this file from ~/.config/ to your source directory for packaging purpose):\n\n```bash\ninclude /cfg.json\n```\n\t\t\nOverride the PostInstall class in your setup.py like this in order to save your config file to the user's machine after installation:\n\n```python\nfrom setuptools import setup, find_packages\nfrom setuptools.command.install import install\nimport shutil\n\nclass PostInstallCommand(install):\n\t\"\"\"Post-installation for installation mode.\"\"\"\n\tdef run(self):\n\t\tinstall.run(self)\n\t\tfpath = os.path.join(self.install_lib, your_package)\n\t\tfpath = os.path.join(fpath, \"cfg.json\")\n\t\ttpath = os.path.join(os.path.expanduser(\"~\"), \".config//cfg.json\")\n\t\tif not os.path.isdir(tpath):\n\t\t\tos.makedirs(tpath)\n\t\tshutil.move(fpath, tpath)\n\ns = setup(\n\tname = \"your_package\",\n\tpackages=find_packages(),\n\t..\n\t..\n\t..\n\tcmdclass={\n\t\t'install': PostInstallCommand,\n\t},\n)\n```\n\t\n# Attribution\n\n
Icons made by Smashicons from www.flaticon.com is licensed by CC 3.0 BY
", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/prahladyeri/cfgsaver", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cfgsaver", "package_url": "https://pypi.org/project/cfgsaver/", "platform": "", "project_url": "https://pypi.org/project/cfgsaver/", "project_urls": { "Homepage": "https://github.com/prahladyeri/cfgsaver" }, "release_url": "https://pypi.org/project/cfgsaver/1.0.4/", "requires_dist": null, "requires_python": ">= 3.4", "summary": "Module to save and fetch configuration data in a standard path and format.", "version": "1.0.4" }, "last_serial": 5456340, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "f72c60ba4d8b89c50cb77194e0d6c160", "sha256": "f23d330e59d01ebe872a230d6d8a732a700df0de5de280f9ea7dc71d9b52e68f" }, "downloads": -1, "filename": "cfgsaver-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f72c60ba4d8b89c50cb77194e0d6c160", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.4", "size": 3503, "upload_time": "2019-06-18T20:59:18", "url": "https://files.pythonhosted.org/packages/55/6f/07a13926480461ba166c98d7e00d360a670ba59511fbc2859fdfe5428fdd/cfgsaver-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "6f687fbaf7dd9c2a4d839e79d55caf6b", "sha256": "06b637a75886f45b276f4752c3bf28e7b431bcb5783e81b2493dfdd380a0f187" }, "downloads": -1, "filename": "cfgsaver-1.0.2.tar.gz", "has_sig": false, "md5_digest": "6f687fbaf7dd9c2a4d839e79d55caf6b", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.4", "size": 3602, "upload_time": "2019-06-19T11:03:06", "url": "https://files.pythonhosted.org/packages/0a/47/e341a462adfcb4342ac21d2a9025243ec7f369d3b5aa13008ab383e99743/cfgsaver-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "4f2bfb7db2bad9476299fd7fac1f0895", "sha256": "b4215b6eee15f58ec62d25c8d744363ab82c7aaec44654ade2efcf1b7c20df7c" }, "downloads": -1, "filename": "cfgsaver-1.0.3.tar.gz", "has_sig": true, "md5_digest": "4f2bfb7db2bad9476299fd7fac1f0895", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.4", "size": 3756, "upload_time": "2019-06-27T05:00:40", "url": "https://files.pythonhosted.org/packages/c5/80/7c584b3417f2d451dd70262bd1d63fe8190a01564e4f8225cb9339435f41/cfgsaver-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "a830b52c730d2529e48e5ad82e522f94", "sha256": "d12de211624be818e4596a08cd2d448098e9e8bf9500bb9f974b17f9267c4c48" }, "downloads": -1, "filename": "cfgsaver-1.0.4.tar.gz", "has_sig": false, "md5_digest": "a830b52c730d2529e48e5ad82e522f94", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.4", "size": 3770, "upload_time": "2019-06-27T10:34:37", "url": "https://files.pythonhosted.org/packages/67/61/daf64653e81eee5aa282b937b3f83e22b5845eef2ca77546f4ec0128e34c/cfgsaver-1.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a830b52c730d2529e48e5ad82e522f94", "sha256": "d12de211624be818e4596a08cd2d448098e9e8bf9500bb9f974b17f9267c4c48" }, "downloads": -1, "filename": "cfgsaver-1.0.4.tar.gz", "has_sig": false, "md5_digest": "a830b52c730d2529e48e5ad82e522f94", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.4", "size": 3770, "upload_time": "2019-06-27T10:34:37", "url": "https://files.pythonhosted.org/packages/67/61/daf64653e81eee5aa282b937b3f83e22b5845eef2ca77546f4ec0128e34c/cfgsaver-1.0.4.tar.gz" } ] }