{ "info": { "author": "Aswa Paul", "author_email": "", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "pyconfigreader\n==============\n\n|Travis-CI| |Codacy Badge| |Issues| |Python|\n\nA configuration file handler for the most basic stuff in ini files that\nwill get you up and running in no time.\n\npyconfigreader\u2019s ``ConfigReader`` uses Python\u2019s ConfigParser to parse\nconfig files.\n\n**PS**: This is just to get you working on other stuff and not focus on\nconfig files. If you need advanced features head to `Python\u2019s\nConfigParser `__ or\nread `pyconfigreader\u2019s\ndocumentation `__.\n\nUsage\n=====\n\nInstallation\n------------\n\n::\n\n $ pip install pyconfigreader\n\nSetting Values\n--------------\n\n``ConfigReader`` creates a default ``main`` section in which key-value\npairs are inserted if no section is specified.\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.set('version', '2') # Saved to section `main`\n config.set('Key', 'Value', section='Section') # Creates a section `Section` on-the-fly\n config.set('name', 'main')\n config.close(save=True) # Save on close\n # Or explicitly call\n # config.save()\n # config.close()\n\nBy default, changes are not immediately written to the file on disk but\nare kept in memory. ``commit=True`` writes the changes to the file on\ndisk.\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.set('okay', 'True', commit=True)\n\nGetting values\n--------------\n\nGetting values only requires specifying the key. If the key does not\nexist then None is returned. No exception is raised.\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n name = config.get('name')\n okay = config.get('okay')\n section = config.get('Key', section='Section') # Get from the section `Section`\n\n agency = config.get('agency') # Raises NoOptionError\n\n print(config.sections) # Get a list of sections\n\n key, value, section = config.search('config') # Search for the parameters of a value. Returns a tuple\n\n help(config)\n config.close() # Don't forget to close the file object\n\nSometimes, if a key is not available a return value may be added using\nthe ``default`` argument\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n name = config.get('country', default='Kenya') # Returns Kenya since key was not available in config file\n config.close()\n\nThe return value, by default, is not saved to file but this can be\nenabled by setting ``default_commit``\\ =True\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n name = config.get('name', default='Kenya', default_commit=True)\n config.close()\n\nAny call to ``commit`` saves all the in-memory changes to the file on\ndisk.\n\nOptions\n-------\n\nOptions can be remove permanently\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.remove_option('reader') # the reader option is always set by default\n # or config.remove_key('reader')\n config.set('name', 'first', section='Details')\n config.remove_option('name', section='Details')\n config.close(save=True)\n\nSections\n--------\n\nSections are created when keys and values are added to them.\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.set('name', 'first', section='Details') # Save key `name` with value `first` in section `Details`\n config.close()\n\nSections can be removed explicitly.\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.set('name', 'first', section='Details') # Creates section `Details`\n config.remove_section('Details') # Removes section `Details` plus all the keys and values\n config.close(save=True)\n\nSection items can be acquired as dictionary values\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.set('name', 'first', section='Details')\n\n config.get_items('Details')\n # OrderedDict([('name', 'first')])\n config.close() # Or config.close(save=True)\n\nEnvironment Variables\n---------------------\n\nConfiguration values can be save to the environment (``os.environ``)\n\n.. code:: python\n\n import os\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.set('name', 'first', section='Details')\n config.to_env()\n os.environ['DETAILS_NAME']\n # first\n os.environ['MAIN_READER']\n # configreader\n config.close()\n\nThe environment keys are formed from the section name and the key name.\n\nSaving\n------\n\nChanges are not written to disk unless ``commit`` is set to True.\n\nAnother alternative is calling ``to_file``\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n config = ConfigReader(filename='config.ini')\n config.set('name', 'first', section='Details')\n config.save()\n config.close()\n\nAs a context, the changes are saved when the object is closed.\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n with ConfigReader(filename='config.ini') as config:\n config.set('name', 'first', section='Details')\n\nThe contents of the config file can also be dumped to a JSON file.\n\n.. code:: python\n\n from pyconfigreader import ConfigReader\n reader = ConfigReader()\n reader.set('name', 'first', section='Details')\n with open('config.json', 'w') as f:\n reader.to_json(f)\n \n reader.close()\n\nA lot more on ``help(config)``\n\nMore\n====\n\nSee `pyconfigreader\ndocumentation `__.\n\nLicense\n=======\n\nDistributed under `MIT `__\n\n.. |Travis-CI| image:: https://img.shields.io/travis/giantas/pyconfigreader.svg?maxAge=220\n :target: https://travis-ci.org/giantas/pyconfigreader\n.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Coverage/5f3132cafe78478dbdeb081b53d3661d\n :target: https://www.codacy.com/app/giantas/pyconfigreader?utm_source=github.com&utm_medium=referral&utm_content=giantas/pyconfigreader&utm_campaign=Badge_Coverage\n.. |Issues| image:: https://img.shields.io/github/issues-raw/giantas/pyconfigreader/website.svg\n :target: https://github.com/giantas/pyconfigreader/issues\n.. |Python| image:: https://img.shields.io/pypi/pyversions/pyconfigreader.svg\n :target: https://img.shields.io/pypi/pyversions/pyconfigreader.svg", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/giantas/pyconfigreader", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyconfigreader", "package_url": "https://pypi.org/project/pyconfigreader/", "platform": "", "project_url": "https://pypi.org/project/pyconfigreader/", "project_urls": { "Homepage": "http://github.com/giantas/pyconfigreader" }, "release_url": "https://pypi.org/project/pyconfigreader/0.7.1/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.7", "summary": "A module for handling simple configuration requirements", "version": "0.7.1" }, "last_serial": 5546900, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ab8a5a51415ea0f2484d16a0f24af794", "sha256": "797e0236a810d57f99a8ac2c004d224beb25151d232145645cf5e397c499af0d" }, "downloads": -1, "filename": "pyconfigreader-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ab8a5a51415ea0f2484d16a0f24af794", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2985, "upload_time": "2018-02-12T20:05:37", "url": "https://files.pythonhosted.org/packages/db/1c/c7ab782716bf54b4d803f019ca6fb68b501abfbd31a5c00a75d150bb05fd/pyconfigreader-0.0.1.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "efafae576b673c2cb68774ab06df361a", "sha256": "0ac2198f98588f89e71a4b250935882f910ecec507476eaf21fafa7495fbdd37" }, "downloads": -1, "filename": "pyconfigreader-0.0.5.tar.gz", "has_sig": false, "md5_digest": "efafae576b673c2cb68774ab06df361a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5599, "upload_time": "2018-02-24T19:44:35", "url": "https://files.pythonhosted.org/packages/a7/de/f129f38891be4f286c59d70ce9f3c2f8a5ce9334c1ecf2bb8649c8423143/pyconfigreader-0.0.5.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "c6e8c328062b0e97532341f62b98923c", "sha256": "6e71d84ffd6245df941175fcd75c2bf80660ce23b9e35b2f2d63b9920c987a22" }, "downloads": -1, "filename": "pyconfigreader-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c6e8c328062b0e97532341f62b98923c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5711, "upload_time": "2018-02-25T14:17:11", "url": "https://files.pythonhosted.org/packages/c2/34/fb79ee7953d6b4f3cadb050dfb10e493af107827d0cf33b7d6c6a9c9e596/pyconfigreader-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "860f222610825b19f7ff5c701e0b5736", "sha256": "d5b9eef2e4eaa8d1d529500c33e1fef50660a2578520d122a678f2c9270f5ae2" }, "downloads": -1, "filename": "pyconfigreader-0.1.1.tar.gz", "has_sig": false, "md5_digest": "860f222610825b19f7ff5c701e0b5736", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5826, "upload_time": "2018-02-26T07:12:38", "url": "https://files.pythonhosted.org/packages/9e/b9/ed1b99347c90fe6d5c3385adea3b48ac882bafe0366b65f52ad7c6aa6636/pyconfigreader-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "c182cd1f68486733c1f241246756b991", "sha256": "791321ac6316fa7190123cf7dd2f0918f804275693b426ec752484667c0b8183" }, "downloads": -1, "filename": "pyconfigreader-0.2.0.tar.gz", "has_sig": false, "md5_digest": "c182cd1f68486733c1f241246756b991", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6129, "upload_time": "2018-03-03T17:30:23", "url": "https://files.pythonhosted.org/packages/5b/5a/37add38c5e406316831973d41658c1e568917b04d9c1a49e5e097a5ec02b/pyconfigreader-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "1b0a02f81e27a18e49e7a5c0992d89ba", "sha256": "c0b887653e4116e83cbce9b419a93123589a51b2e54b92179e329ba14a247d6d" }, "downloads": -1, "filename": "pyconfigreader-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1b0a02f81e27a18e49e7a5c0992d89ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6162, "upload_time": "2018-03-07T19:54:31", "url": "https://files.pythonhosted.org/packages/b6/2b/5a978a087197f504449d4943e2f3450b972276aa0f5387428342c23281de/pyconfigreader-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "5283730b9b807a0ad568744535141701", "sha256": "e6ccb064d37796a68786df9c8568f321cc97daacee9001b678bb9321c7fec563" }, "downloads": -1, "filename": "pyconfigreader-0.2.2.tar.gz", "has_sig": false, "md5_digest": "5283730b9b807a0ad568744535141701", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7592, "upload_time": "2018-03-10T18:44:11", "url": "https://files.pythonhosted.org/packages/fc/dc/a19a090748d02a70e41d670821082f5fe8a9ca2821349d9de15928693e80/pyconfigreader-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "9a2dbd3749e2ad6f02ca8ac854e08c1b", "sha256": "c98e04bc8bd125701487365fad9f2e36ae83c7dd44bded182b6879f36386e02f" }, "downloads": -1, "filename": "pyconfigreader-0.2.3.tar.gz", "has_sig": false, "md5_digest": "9a2dbd3749e2ad6f02ca8ac854e08c1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7798, "upload_time": "2018-03-10T18:56:18", "url": "https://files.pythonhosted.org/packages/f4/44/6f5eabda00b2acc69d6b7a61f4ae23b0cbf0081e560a2eeaa5b1bb4b7691/pyconfigreader-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "ef579a2be9c6f44058c0d9e190829388", "sha256": "dc36b1926801b679cd016a8cce63de4f8db8ec866736cc1ca30e2fbd2ad9af91" }, "downloads": -1, "filename": "pyconfigreader-0.2.4.tar.gz", "has_sig": false, "md5_digest": "ef579a2be9c6f44058c0d9e190829388", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7834, "upload_time": "2018-03-11T19:30:59", "url": "https://files.pythonhosted.org/packages/ee/64/72326df603dd746c2df9b9063ea47d443ce28c985e7d949d76be827185c3/pyconfigreader-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "6dc655d85e5c838a6c82f8669f99e5e8", "sha256": "488e59ca593d2e0f5e13ffafd63f3a3b332c671fa214afd87b61a78d97d0a53b" }, "downloads": -1, "filename": "pyconfigreader-0.2.5.tar.gz", "has_sig": false, "md5_digest": "6dc655d85e5c838a6c82f8669f99e5e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7832, "upload_time": "2018-03-11T19:38:00", "url": "https://files.pythonhosted.org/packages/d7/0d/32c8e723efd25b448da2031b68d503241de15da27764cc1e9a505f126cc2/pyconfigreader-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "870f4d089feb44c30dd23eb64fbb899f", "sha256": "3f75ed6da88c0ee1e0ee08327840e1b59e041a2a024aca7789d1126ee0b821aa" }, "downloads": -1, "filename": "pyconfigreader-0.2.6.tar.gz", "has_sig": false, "md5_digest": "870f4d089feb44c30dd23eb64fbb899f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7426, "upload_time": "2018-03-27T20:07:34", "url": "https://files.pythonhosted.org/packages/6f/f7/a80ebfee4bca6c2ad39b231e322744ab2f8eec86ee068d447e15fb624e2c/pyconfigreader-0.2.6.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "26181e28ac91fabed39a644b2f17d980", "sha256": "057af81881667eaa1919761f0a47d41c46ec9a514f1b0db151ed48a3ec513391" }, "downloads": -1, "filename": "pyconfigreader-0.3.2.tar.gz", "has_sig": false, "md5_digest": "26181e28ac91fabed39a644b2f17d980", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9319, "upload_time": "2018-05-25T05:44:18", "url": "https://files.pythonhosted.org/packages/31/8d/88c2acac25364884d906a731cc590c672b958eec8dbae03be04bb6716f17/pyconfigreader-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "41d12d011b478f9b21bf3251bbbe317a", "sha256": "92b502c2d2282347cb0fcc9ba74e1e76f34f5f731740a18ca44fbbddb7430015" }, "downloads": -1, "filename": "pyconfigreader-0.3.3.tar.gz", "has_sig": false, "md5_digest": "41d12d011b478f9b21bf3251bbbe317a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9598, "upload_time": "2018-09-10T09:21:12", "url": "https://files.pythonhosted.org/packages/6d/d4/bfeed107c4ce18c0f4da645b6f978477c32c3123b02dc44d49f09a6ba81e/pyconfigreader-0.3.3.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "0e8175cba91fb453015eaedcaa6d4c58", "sha256": "3579e183fb0d6ec0cb6a8dbec8ba9dd5d1672cad4ab94d3007dff71baec85a35" }, "downloads": -1, "filename": "pyconfigreader-0.5.0.tar.gz", "has_sig": false, "md5_digest": "0e8175cba91fb453015eaedcaa6d4c58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9868, "upload_time": "2018-11-11T18:10:00", "url": "https://files.pythonhosted.org/packages/6a/a1/e2debad3bc26a84b9aaf930915bf34f1bd77198a9d1cae2b767b73157e4a/pyconfigreader-0.5.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "fae694363e2b164d68b4b2e7c2c0ffdb", "sha256": "19d5575151f34e5ba3628cd2cdb0c396b9e85696c07f3651bfc1845e3af7a1d6" }, "downloads": -1, "filename": "pyconfigreader-0.7.1.tar.gz", "has_sig": false, "md5_digest": "fae694363e2b164d68b4b2e7c2c0ffdb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.7", "size": 12084, "upload_time": "2019-07-17T17:15:05", "url": "https://files.pythonhosted.org/packages/17/b4/5a9f6870bceb73a670cab81f54d99876d3f8bbbde6c5861988aecd01eb95/pyconfigreader-0.7.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fae694363e2b164d68b4b2e7c2c0ffdb", "sha256": "19d5575151f34e5ba3628cd2cdb0c396b9e85696c07f3651bfc1845e3af7a1d6" }, "downloads": -1, "filename": "pyconfigreader-0.7.1.tar.gz", "has_sig": false, "md5_digest": "fae694363e2b164d68b4b2e7c2c0ffdb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.7", "size": 12084, "upload_time": "2019-07-17T17:15:05", "url": "https://files.pythonhosted.org/packages/17/b4/5a9f6870bceb73a670cab81f54d99876d3f8bbbde6c5861988aecd01eb95/pyconfigreader-0.7.1.tar.gz" } ] }