{ "info": { "author": "Peter Pentchev", "author_email": "roam@ringlet.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: DFSG approved", "License :: Freely Distributable", "License :: OSI Approved :: BSD License", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "confget - parse configuration files\n===================================\n\nThe `confget` library parses configuration files (currently INI-style\nfiles and CGI `QUERY_STRING` environment variable) and allows a program\nto use the values defined in them. It provides various options for\nselecting the variable names and values to return and the configuration\nfile sections to fetch them from.\n\nThe `confget` library may also be used as a command-line tool with\nthe same interface as the C implementation.\n\nThe `confget` library is fully typed.\n\nSpecifying configuration values for the backends\n------------------------------------------------\n\nThe `confget.defs` module defines the `Config` class that is used to\ncontrol the behavior of the various `confget` backends. Its main\npurpose is to specify the filename and, optionally, the section name for\nINI-style files, but other backends may use its fields in different ways.\n\nA `Config` object is created using the following parameters:\n- a list of variable names to query (may be empty)\n- `filename` (str, optional): the name of the file to open\n- `section` (str, default \"\"): the name of the section within the file\n- `section_specified` (bool, default false): if `section` is an empty\n string, only fetch variables from the unnamed section at the start of\n the file instead of defaulting to the first section in the file\n\nParsing INI-style configuration files\n-------------------------------------\n\nThe `confget` library's \"ini\" backend parses an INI-style configuration\nfile. Its `read_file()` method parses the file and returns a dictionary\nof sections and the variables and their values within them:\n\n import confget\n\n cfg = confget.Config([], filename='config.ini')\n ini = confget.BACKENDS['ini'](cfg)\n data = ini.read_file()\n print('Section names: {names}'.format(names=sorted(data.keys())))\n print(data['server']['address'])\n\nLetting variables in a section override the default ones\n--------------------------------------------------------\n\nIn some cases it is useful to have default values before the first\nnamed section in a file and then override some values in various\nsections. This may be useful for e.g. host-specific configuration\nkept in a section with the same name as the host.\n\nThe `format` module in the `confget` library allows, among other\nfiltering modes, to get the list of variables with a section\noverriding the default ones:\n\n from confget import backend, format\n\n cfg = format.FormatConfig(['foo'], filename='config.ini', section='first',\n section_override=True)\n ini = backend.BACKENDS['ini'](cfg)\n data = ini.read_file()\n res = format.filter_vars(cfg, data)\n assert len(res) == 1, repr(res)\n print(res[0].output_full)\n\n cfg = format.FormatConfig(['foo'], filename='config.ini', section='second',\n section_override=True)\n ini = backend.BACKENDS['ini'](cfg)\n data = ini.read_file()\n res = format.filter_vars(cfg, data)\n assert len(res) == 1, repr(res)\n print(res[0].output_full)\n\nSee the documentation of the `FormatConfig` class and the `filter_vars()`\nfunction in the `confget.format` module for more information and for\na list of the various other filtering modes, all supported when\nthe library is used as a command-line tool.\n\nComments: Peter Pentchev \n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://devel.ringlet.net/textproc/confget/", "keywords": "", "license": "BSD-2", "maintainer": "", "maintainer_email": "", "name": "confget", "package_url": "https://pypi.org/project/confget/", "platform": "", "project_url": "https://pypi.org/project/confget/", "project_urls": { "Homepage": "https://devel.ringlet.net/textproc/confget/" }, "release_url": "https://pypi.org/project/confget/2.3.0/", "requires_dist": [ "six", "configparser ; python_version < \"3\"" ], "requires_python": "", "summary": "Parse configuration files and extract values from them", "version": "2.3.0" }, "last_serial": 5803463, "releases": { "2.2.1": [ { "comment_text": "", "digests": { "md5": "2f1bc313a1557c9938bf19a2810e65ea", "sha256": "55df13f18aebfb9981e24b5305929f123890e14ff8b8447c34e9013f62c240cf" }, "downloads": -1, "filename": "confget-2.2.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "2f1bc313a1557c9938bf19a2810e65ea", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19183, "upload_time": "2019-05-05T14:08:59", "url": "https://files.pythonhosted.org/packages/55/fd/071785439237af8e448922a48af5915ea3ed5b8db0d428d86ba22754d7b1/confget-2.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "28aa34648e3da92a037163bd34dd62ca", "sha256": "44a6ce9d1ceba6109aab1923bb526ea4d5dc33754552603362160ab0d75d47cb" }, "downloads": -1, "filename": "confget-2.2.1.tar.gz", "has_sig": true, "md5_digest": "28aa34648e3da92a037163bd34dd62ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16886, "upload_time": "2019-05-05T14:09:02", "url": "https://files.pythonhosted.org/packages/ac/f5/60718cec80980028b591f806c951061a716e9fa851c72e2dca016fcbd849/confget-2.2.1.tar.gz" } ], "2.3.0": [ { "comment_text": "", "digests": { "md5": "ae2890cc4edb078ea341fe741561a7b2", "sha256": "9c1bdd822a5269564d7d4c4f5fbf5e334b76b8c47eaf6f84492e5912f9ea83a9" }, "downloads": -1, "filename": "confget-2.3.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "ae2890cc4edb078ea341fe741561a7b2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19485, "upload_time": "2019-09-09T12:53:13", "url": "https://files.pythonhosted.org/packages/95/2a/fc2b1a68c51b78491380a61bd319ddc537825bb0ffec1afb8a6e789f3905/confget-2.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3e7da2eb4bbc2693dce06d158d963c76", "sha256": "1915b43d10dc05b5a9313dd2d0d8943abd67b1315258694727ab56e6837793aa" }, "downloads": -1, "filename": "confget-2.3.0.tar.gz", "has_sig": true, "md5_digest": "3e7da2eb4bbc2693dce06d158d963c76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17591, "upload_time": "2019-09-09T12:53:15", "url": "https://files.pythonhosted.org/packages/09/e1/e7f7baa2be5ffa3fa3b2775bb286eea0ed841d01983625eadc17b4545487/confget-2.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ae2890cc4edb078ea341fe741561a7b2", "sha256": "9c1bdd822a5269564d7d4c4f5fbf5e334b76b8c47eaf6f84492e5912f9ea83a9" }, "downloads": -1, "filename": "confget-2.3.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "ae2890cc4edb078ea341fe741561a7b2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19485, "upload_time": "2019-09-09T12:53:13", "url": "https://files.pythonhosted.org/packages/95/2a/fc2b1a68c51b78491380a61bd319ddc537825bb0ffec1afb8a6e789f3905/confget-2.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3e7da2eb4bbc2693dce06d158d963c76", "sha256": "1915b43d10dc05b5a9313dd2d0d8943abd67b1315258694727ab56e6837793aa" }, "downloads": -1, "filename": "confget-2.3.0.tar.gz", "has_sig": true, "md5_digest": "3e7da2eb4bbc2693dce06d158d963c76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17591, "upload_time": "2019-09-09T12:53:15", "url": "https://files.pythonhosted.org/packages/09/e1/e7f7baa2be5ffa3fa3b2775bb286eea0ed841d01983625eadc17b4545487/confget-2.3.0.tar.gz" } ] }