{ "info": { "author": "keshaB Paudel", "author_email": "self@keshab.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Build Tools" ], "description": "# Simple Config\n\nA simple configuration file manager for python. Best suited for simple scripts that need\nto take user defined configuration parameters.\n\nConfiguration is saved in JSON format to a file of your chosing.\n\n\n## Why?\n\nThis is mostly intended to be used in quick and dirty scripts and simple CLI apps.\nThis does not intend to replace `configparser`. There are instances where I feel\nthat bootstrapping `configparser` is an overkill. This is where `simple_config` chips in.\n\n\n## Installation\n\nInstall if using `pipenv` by running the command below.\n\n```bash\npipenv install simple-config\n```\n\nOr, if you are not using `pipenv`, run the following:\n\n```bash\npip install simple-config\n```\n\n## Usage\n\n`simple-config` provides a `Config` class. It is intended to be instantiated\nat the module level once and used the instance everywhere.\n\nPut this in a file called `config.py`:\n\n```python\nfrom simple_config import Config\n\ndefault_settings = {\n \"is_registered\": True,\n \"token\": \"aK3NJe3PnXJr\"\n}\nsettings = Config(\"/path/to/config.json\", defaults=default_settings)\n```\n\nHere, the first argument is the path to the configuration file.\nThe `defaults` keyword argument takes the default configuration\noptions for your app.\nIf the config file does not exist, it will be created and populated\nwith the default values.\n\nNow, import the instance of `Config` i.e. `settings` wherever necessary and use:\n\n```python\nfrom config import settings\n\nprint(settings.token)\n```\n\n### Mutating the config\n\nSometimes there might be a need to update the config, e.g. to save state of\nthe app. The `Config` class provides `update` instance method.\n\n```python\nsettings.update(token=\"Ju901jK1Rb\")\n```\n\nThe update method will update the parameters and write it to the config\nfile as well.\n\n\n## Multiple configs\n\nThere can exist more than one `Config` instance in an application. For example,\nthe application auto-generated state can be saved in one file and user's config\ncan be saved in another instance.\n\n\n## Run the tests\n\nGo to the root of this project and run:\n\n```python\npython -m unittest discover\n```\n\n\n## Similar projects\n\n* [yapconf](https://github.com/loganasherjones/yapconf)\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/poudel/simple-config", "keywords": "config json-config user-config", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "simple-config", "package_url": "https://pypi.org/project/simple-config/", "platform": "", "project_url": "https://pypi.org/project/simple-config/", "project_urls": { "Homepage": "https://github.com/poudel/simple-config" }, "release_url": "https://pypi.org/project/simple-config/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "A simple configuration file manager for python", "version": "1.0.1" }, "last_serial": 3764542, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "5edf6ae82e264c6c023b5b09753496f1", "sha256": "95987173b87b1a43e5878213de0bac4fc07c4f292379e89bf56bc994838dc834" }, "downloads": -1, "filename": "simple_config-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5edf6ae82e264c6c023b5b09753496f1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4747, "upload_time": "2018-03-27T16:24:22", "url": "https://files.pythonhosted.org/packages/49/29/7d16d4e1b49917d77b5a64b99cfa76ff09e662577a004fa8da56489aabb2/simple_config-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "554325d12d0cc6a750fb9f2475abb0c5", "sha256": "e75c86d6bd9e5d9a9a29480339d33d1900e407e89ce353074cd477240b36afc0" }, "downloads": -1, "filename": "simple-config-1.0.0.tar.gz", "has_sig": false, "md5_digest": "554325d12d0cc6a750fb9f2475abb0c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2774, "upload_time": "2018-03-27T16:24:24", "url": "https://files.pythonhosted.org/packages/61/e8/46a54a8ba6451e4cb9ac681a2b29caeaa847e1f32243504e6d877cc51336/simple-config-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "abee887903bea3a51c2dce9dda3d5ded", "sha256": "b9588085ebb82a9b6ec21d60917c908acda68da6473eb2ac6178f9f3b59ebf16" }, "downloads": -1, "filename": "simple-config-1.0.1.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "abee887903bea3a51c2dce9dda3d5ded", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2452, "upload_time": "2018-04-14T15:11:21", "url": "https://files.pythonhosted.org/packages/55/05/a0f51d7c29920f91330ce87707bf0fa6f769e2838c1c434a311cbc2d56d7/simple-config-1.0.1.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "d1ba6860e51eb00f8befee5d972a44f4", "sha256": "06e62440ae51a49073935d84cf21d2fb3c812d3bec6dce392e0b36cd4e1f487c" }, "downloads": -1, "filename": "simple_config-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d1ba6860e51eb00f8befee5d972a44f4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4863, "upload_time": "2018-04-14T15:11:19", "url": "https://files.pythonhosted.org/packages/63/9d/250327515576377d533be41e566f3b27fdbf9d1f88545def24fd2e44fc44/simple_config-1.0.1-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "abee887903bea3a51c2dce9dda3d5ded", "sha256": "b9588085ebb82a9b6ec21d60917c908acda68da6473eb2ac6178f9f3b59ebf16" }, "downloads": -1, "filename": "simple-config-1.0.1.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "abee887903bea3a51c2dce9dda3d5ded", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2452, "upload_time": "2018-04-14T15:11:21", "url": "https://files.pythonhosted.org/packages/55/05/a0f51d7c29920f91330ce87707bf0fa6f769e2838c1c434a311cbc2d56d7/simple-config-1.0.1.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "d1ba6860e51eb00f8befee5d972a44f4", "sha256": "06e62440ae51a49073935d84cf21d2fb3c812d3bec6dce392e0b36cd4e1f487c" }, "downloads": -1, "filename": "simple_config-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d1ba6860e51eb00f8befee5d972a44f4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4863, "upload_time": "2018-04-14T15:11:19", "url": "https://files.pythonhosted.org/packages/63/9d/250327515576377d533be41e566f3b27fdbf9d1f88545def24fd2e44fc44/simple_config-1.0.1-py2.py3-none-any.whl" } ] }