{ "info": { "author": "Philip J Grabner, Cadit Health Inc", "author_email": "oss@cadit.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "License :: Public Domain", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "====================\nINI File Inheritance\n====================\n\nAdds INI-file inheritance to ConfigParser. Note that although it\neffectively behaves very similarly to passing multiple files to\nConfigParser's `read()` method, that requires changing the code at\nthat point. If that is not feasible, or the INI files should dictate\ninheritance themselves, then the `iniherit` package is a better\nalternative.\n\nOh, `iniherit` also adds support for environment variable expansion\nvia ``%(ENV:VARNAME)s``. This really shouldn't be here, but since\n`iniherit` supports the ``%(SUPER)s`` expansion, it was \"just too\neasy\" to add envvar expansion as well...\n\n\nProject Info\n============\n\n* Project Page: https://github.com/cadithealth/iniherit\n* Bug Tracking: https://github.com/cadithealth/iniherit/issues\n\n\nTL;DR\n=====\n\nGiven the following two files, ``base.ini``:\n\n.. code:: ini\n\n [app:main]\n name = My Application Name\n\nand ``config.ini``:\n\n.. code:: ini\n\n [DEFAULT]\n # the following will cause both \"base.ini\" and \"override.ini\" to be\n # inherited. the \"?\" indicates that \"override.ini\" will be ignored\n # if not found; otherwise an error would occur.\n %inherit = base.ini ?override.ini\n\nThen the following code will pass the assert:\n\n.. code:: python\n\n import iniherit\n cfg = iniherit.SafeConfigParser()\n cfg.read('config.ini')\n\n assert cfg.get('app:main', 'name') == 'My Application Name'\n\nAlternatively, the global ConfigParser can be altered to\nsupport inheritance:\n\n.. code:: python\n\n import iniherit\n iniherit.mixin.install_globally()\n\n import ConfigParser\n cfg = ConfigParser.SafeConfigParser()\n cfg.read('config.ini')\n\n assert cfg.get('app:main', 'name') == 'My Application Name'\n\nNote that the call to `install_globally()` must be invoked **before**\nany other module imports ConfigParser for the global override to have\nan effect.\n\nThe command-line program `iniherit` allows flattening of INI files\n(i.e. collapsing all inheritance rules), optionally in \"watch\" mode:\n\n.. code:: bash\n\n $ iniherit --watch --interval 2 --verbose input.ini output.ini\n INFO:iniherit.cli:\"source.ini\" changed; updating output...\n INFO:iniherit.cli:\"inherited-file.ini\" changed; updating output...\n ^C\n\n\nInstallation\n============\n\nInstall iniherit via your favorite PyPI package manager works as\nfollows:\n\n.. code:: bash\n\n # if using python 3+, upgrade your `distribute` package *first*\n $ pip install \"distribute>=0.7.3\"\n\n # then istall with pip:\n $ pip install iniherit\n\n\nInheritance Mechanism\n=====================\n\nINI file inheritance with the `iniherit` package:\n\n* To add inheritance to an INI file, add an ``%inherit`` option to the\n \"DEFAULT\" section of the INI file to inherit all sections of the\n specified files. Example:\n\n .. code:: ini\n\n [DEFAULT]\n %inherit = base.ini\n def_var = Overrides the \"def_var\" setting, if present,\n in the \"DEFAULT\" section of \"base.ini\".\n\n [my-app]\n sect_var = Overrides the \"sect_var\" setting, if present,\n in the \"my-app\" section of \"base.ini\". Other sections in\n \"base.ini\" will also be inherited, even if not specified\n here.\n\n* The ``%inherit`` option points to a space-separated, URL-encoded,\n list of files to inherit values from, whose values are loaded\n depth-first, left-to-right. For example:\n\n .. code:: ini\n\n [DEFAULT]\n %inherit = base.ini file-with%20space.ini\n\n* To inherit only a specific section, add the ``%inherit`` option\n directly to the applicable section. By default, the section by the\n same name will be loaded from the other files, unless the filename\n is suffixed with square-bracket enclosed (\"[\" ... \"]\"), URL-encoded,\n section name. Example:\n\n .. code:: ini\n\n [section]\n %inherit = base.ini override.ini[other%20section]\n\n In this case, the \"section\" section in \"base.ini\" will be inherited,\n followed by the \"other section\" from \"override.ini\".\n\n Note that if the inherited section includes interpolation references\n to the DEFAULT section, these will **NOT** be carried over! In other\n words, inheritance currently ONLY inherits the actual values, not\n the interpreted values. Be warned, as this can lead to surprising\n results!\n\n If a filename has \"[\" in the actual name, it can be URL-encoded.\n\n* Filenames, if specified relatively, are taken to be relative to the\n current INI file.\n\n* If a filename is prefixed with \"?\", then it will be loaded\n optionally: i.e. if the file does not exist, it will be silently\n ignored. If the file does NOT have a \"?\" prefixed and cannot be\n found, then an ``IOError`` will be raised. Note that this is unlike\n standard ConfigParser.read() behavior, which silently ignores any\n files that cannot be found.\n\n If a filename has \"?\" as its first character, it can be URL-encoded.\n\n* Note that the actual name of the inherit option can be changed by\n changing either ``iniherit.parser.DEFAULT_INHERITTAG`` for a global\n effect, or ``ConfigParser.IM_INHERITTAG`` for a per-instance effect.\n\n\nSubstitutions\n=============\n\nThe `iniherit` package adds the following additional substitution\noptions:\n\n* ``%(SUPER[:-DEFAULT])s``\n\n Evaluates to the inherited value of the current section/key value.\n If the inherited INI does not specify a value and no default is\n provided, then an `InterpolationMissingSuperError` is raised. The\n \"inherited value\" is evaluated depth-first. Note that \"SUPER\" must\n be all upper case.\n\n For example, given the following INI files:\n\n .. code:: ini\n\n # base.ini\n [loggers]\n keys = root, app\n\n\n .. code:: ini\n\n # config.ini\n [DEFAULT]\n %inherit = base.ini\n [loggers]\n keys = %(SUPER)s, auth\n wdef = %(SUPER:-more)s or less\n nada = %(SUPER)s boom!\n\n\n Then the following Python will result:\n\n .. code:: python\n\n import iniherit\n iniherit.mixin.install_globally()\n import ConfigParser\n cfg = ConfigParser.SafeConfigParser()\n cfg.read('config.ini')\n\n cfg.get('loggers', 'keys') # ==> 'root, app, auth'\n cfg.get('loggers', 'wdef') # ==> 'more or less'\n cfg.get('loggers', 'nada') # ==> raises InterpolationMissingSuperError\n\n\n As with standard interpolation errors, the\n InterpolationMissingSuperError exception is only raised if/when the\n value is requested from the config (with `raw` set to falsy).\n\n\n* ``%(ENV:VARNAME[:-DEFAULT])s``\n\n Evaluates to the value of the environment variable name \"VARNAME\".\n If the environment variable is not defined and no default is\n provided, then an `InterpolationMissingEnvError` is raised. Note\n that environment variable names are always case sensitive.\n\n For example, given the following INI file:\n\n .. code:: ini\n\n # config.ini\n [section]\n home = %(ENV:HOME)s\n rdir = %(ENV:RDIR:-/var/run)s\n nada = %(ENV:RDIR)s\n\n\n Then the following Python will result:\n\n .. code:: python\n\n import iniherit\n iniherit.mixin.install_globally()\n import ConfigParser\n cfg = ConfigParser.SafeConfigParser()\n cfg.read('config.ini')\n\n import os\n os.environ['home'] = '/home/user' # ensure \"HOME\" envvar exists\n os.environ.pop('RDIR', None) # ensure \"RDIR\" envvar does NOT exist\n\n cfg.get('section', 'home') # ==> '/home/user'\n cfg.get('section', 'rdir') # ==> '/var/run'\n cfg.get('section', 'nada') # ==> raises InterpolationMissingEnvError\n\n\n As with standard interpolation errors, the\n InterpolationMissingEnvError exception is only raised if/when the\n value is requested from the config (with `raw` set to falsy).\n\n\nGotchas\n=======\n\n* After an inherit-enabled INI file is loaded, the ConfigParser no\n longer has knowledge of where a particular option was loaded from or\n how it was derived. For this reason, when the `write` method is\n called, the ConfigParser generates an INI file without inheritance.\n In other words, it flattens the inheritance tree.\n\n.. _ConfigParser: http://docs.python.org/2/library/configparser.html\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/cadithealth/iniherit", "keywords": "INI inheritance configparser mixin", "license": "MIT (http://opensource.org/licenses/MIT)", "maintainer": "", "maintainer_email": "", "name": "iniherit", "package_url": "https://pypi.org/project/iniherit/", "platform": "", "project_url": "https://pypi.org/project/iniherit/", "project_urls": { "Homepage": "http://github.com/cadithealth/iniherit" }, "release_url": "https://pypi.org/project/iniherit/0.3.9/", "requires_dist": null, "requires_python": "", "summary": "A ConfigParser subclass with file-specified inheritance.", "version": "0.3.9" }, "last_serial": 2887748, "releases": { "0.1.0": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6d2a264cbc0ae695d675db32a4b428cc", "sha256": "df0f4b405d4747c0ca0925db621d2426e9b27c8c00423b08a304ee223805aef6" }, "downloads": -1, "filename": "iniherit-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6d2a264cbc0ae695d675db32a4b428cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6265, "upload_time": "2013-08-21T18:06:41", "url": "https://files.pythonhosted.org/packages/84/cc/67a76bfbaf92f746adbb587bb2c8205ab2104e33e22eadd5285275ffac44/iniherit-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "118dcf5723c80fa8b36765dc2c5f463d", "sha256": "c677e3f0e4f78cd36068532a1bc0d5d7d9c86b243598c0132ecc449560d525a1" }, "downloads": -1, "filename": "iniherit-0.1.2.tar.gz", "has_sig": false, "md5_digest": "118dcf5723c80fa8b36765dc2c5f463d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7377, "upload_time": "2013-08-21T18:25:05", "url": "https://files.pythonhosted.org/packages/e1/95/be446aec14602abd7c19d41f29d9b7d025959565a0cb3877706ca15cb82f/iniherit-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "fb838f2d7394ee9fd4467409acf7822f", "sha256": "83d38495cde9660927e0aec6638cd102efba6155224489d1211646fad184c923" }, "downloads": -1, "filename": "iniherit-0.1.3.tar.gz", "has_sig": false, "md5_digest": "fb838f2d7394ee9fd4467409acf7822f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7458, "upload_time": "2013-08-21T21:31:23", "url": "https://files.pythonhosted.org/packages/25/1e/303b1bfcb90576ad7e814e0700406dcc97e1a059832032ea99b4e519dd10/iniherit-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "bb5c2382eb75472c8533e4d60254cc08", "sha256": "2109271f569fb848ceafa50886dc71fade948df0f078a3a8a39b424c4c46ff59" }, "downloads": -1, "filename": "iniherit-0.1.4.tar.gz", "has_sig": false, "md5_digest": "bb5c2382eb75472c8533e4d60254cc08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7441, "upload_time": "2013-08-21T21:40:05", "url": "https://files.pythonhosted.org/packages/45/a4/35569f3391f79acf390e3cc99ca43b3a3b30e5c77108f9b53c04ff25fad4/iniherit-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "b5a9ee7c6003354d3c707b7e4c166f9a", "sha256": "3e4b31a77e33657721b92b7bf179b1ed2d4c7a9a85082fed1cc1ed049828f1ad" }, "downloads": -1, "filename": "iniherit-0.1.5.tar.gz", "has_sig": false, "md5_digest": "b5a9ee7c6003354d3c707b7e4c166f9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10136, "upload_time": "2013-08-26T20:58:39", "url": "https://files.pythonhosted.org/packages/08/2c/4bdbc87755cd9d74745fc882391144abffe0bad5012abf52f00938d30063/iniherit-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "a6b6778958a6e5cb0941b6281ea49ec6", "sha256": "fb7bec5e8e2293c8b517be02db38f76b5b948ad4211683909398be5d1ac295dd" }, "downloads": -1, "filename": "iniherit-0.1.6.tar.gz", "has_sig": false, "md5_digest": "a6b6778958a6e5cb0941b6281ea49ec6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10431, "upload_time": "2013-08-26T21:19:59", "url": "https://files.pythonhosted.org/packages/53/b3/60492998f8c58fb58e910143d8f1e523763e23170da5128b102e156ffcce/iniherit-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "a0259262d70554ac25d9418d684efb1b", "sha256": "84a24e0f812818e8bab4cb6be072f5d1d7bbba38140000b3435c20230ba5b143" }, "downloads": -1, "filename": "iniherit-0.1.7.tar.gz", "has_sig": false, "md5_digest": "a0259262d70554ac25d9418d684efb1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10891, "upload_time": "2013-09-19T20:49:57", "url": "https://files.pythonhosted.org/packages/97/9d/b58fceabd023cb9edc85ce1fd7ebe2f2d16768ed1dead8673489e8316bd0/iniherit-0.1.7.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "a5b15f2f149eb0a828eaee3d6a2f3520", "sha256": "016dabdd75ad0e34e5f005cb36668535383107fa99a72b9ababe2eb5455a9d73" }, "downloads": -1, "filename": "iniherit-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a5b15f2f149eb0a828eaee3d6a2f3520", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11505, "upload_time": "2014-04-16T19:39:24", "url": "https://files.pythonhosted.org/packages/a7/11/ab209de6ba33d063359fba96dbdf1fcaaa2245fddd0ce2694bc6f927a516/iniherit-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "dc0c7b962a46e5e827043422666d9d8f", "sha256": "b10d0765b2b969ebba7d54a7dcbb7a7037ed04fc2a094a56ed94d04b1dd29b0c" }, "downloads": -1, "filename": "iniherit-0.3.0.tar.gz", "has_sig": false, "md5_digest": "dc0c7b962a46e5e827043422666d9d8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12624, "upload_time": "2014-04-27T21:49:43", "url": "https://files.pythonhosted.org/packages/63/e2/0c255ec907585ce65bba6ecb2b59c6ad775ecd42593c8f2d19079a24ed06/iniherit-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "6e818eb3bb818ffbecd0ef30e4ce40b6", "sha256": "0db0e85284f56e6f3f37b60875d8029c8018f234d709874f3a8feba3334e9cf6" }, "downloads": -1, "filename": "iniherit-0.3.1.tar.gz", "has_sig": false, "md5_digest": "6e818eb3bb818ffbecd0ef30e4ce40b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12679, "upload_time": "2014-04-27T22:02:11", "url": "https://files.pythonhosted.org/packages/a8/4a/55a5e00b2ed75115e2db48802eacc7a4885576f94e4d55cf4713a62898a5/iniherit-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "6f9efae26e1f5da08dec2b2a0978ca26", "sha256": "a917d4bb7f15d80a728e31c247b5c639b6d9748f3df4314d69b0817b933c3b2c" }, "downloads": -1, "filename": "iniherit-0.3.2.tar.gz", "has_sig": false, "md5_digest": "6f9efae26e1f5da08dec2b2a0978ca26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12797, "upload_time": "2014-04-27T22:09:53", "url": "https://files.pythonhosted.org/packages/52/aa/4a0955e7de42cb459660bdf17cd6c51a2d43b0df39f7c0cc26e276c66e7f/iniherit-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "4d299bb321242d210260870ea7887954", "sha256": "9812cc69a085d840ca042f797d476cf7efc8143a9858d472245e05878b2a48e0" }, "downloads": -1, "filename": "iniherit-0.3.3.tar.gz", "has_sig": false, "md5_digest": "4d299bb321242d210260870ea7887954", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13085, "upload_time": "2015-03-20T04:13:25", "url": "https://files.pythonhosted.org/packages/4c/fa/433fcc2381ed31c449f2602894f5dcb08efbf1abefb9727cff08a08edd64/iniherit-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "269a4cfdd0b6d7af0e878749a3b9c1c0", "sha256": "8cc90d099dbfb46eb8634b41e44628e3035d7add122a34f9901873bc75ed1247" }, "downloads": -1, "filename": "iniherit-0.3.4.tar.gz", "has_sig": false, "md5_digest": "269a4cfdd0b6d7af0e878749a3b9c1c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10716, "upload_time": "2015-10-01T23:55:43", "url": "https://files.pythonhosted.org/packages/06/18/0f10fa5a797a0dd1ec0c7825434118965c01dfeb1d2f59f5185b5b8a3b70/iniherit-0.3.4.tar.gz" } ], "0.3.5": [ { "comment_text": "", "digests": { "md5": "19fbd19da582e87587ff7da8c991d4aa", "sha256": "4fcf873ab7f575a0adef358277bad6fef7a5c562f03775be6d384a2110eb0912" }, "downloads": -1, "filename": "iniherit-0.3.5.tar.gz", "has_sig": false, "md5_digest": "19fbd19da582e87587ff7da8c991d4aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16631, "upload_time": "2016-12-14T19:17:21", "url": "https://files.pythonhosted.org/packages/d5/d2/791ff6db35293c2ab4b3aec242f38962ae990269721cdeca90bd77560b4e/iniherit-0.3.5.tar.gz" } ], "0.3.6": [ { "comment_text": "", "digests": { "md5": "321fdc670d43814c086617ec888e4c33", "sha256": "79d182b245bfb79c633f6658b448e6f5cf79549b6232db721db8d97b8d957437" }, "downloads": -1, "filename": "iniherit-0.3.6.tar.gz", "has_sig": false, "md5_digest": "321fdc670d43814c086617ec888e4c33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17084, "upload_time": "2016-12-19T19:09:45", "url": "https://files.pythonhosted.org/packages/7b/aa/eab5855c2820b61f1fd598f31758e892f928ee59fca87a1fb15e5b718ad7/iniherit-0.3.6.tar.gz" } ], "0.3.7": [ { "comment_text": "", "digests": { "md5": "67972b64ae59c85c62ea8b35a796d12f", "sha256": "6dfd57ee74aa43a4b852b9ea33947fbed9bb85de43ca4267de753065ece7be3b" }, "downloads": -1, "filename": "iniherit-0.3.7.tar.gz", "has_sig": false, "md5_digest": "67972b64ae59c85c62ea8b35a796d12f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17696, "upload_time": "2017-05-19T23:34:43", "url": "https://files.pythonhosted.org/packages/e8/1b/6120df838f665fa08442f6cf5b6f75f1012900cca103114ec2e3205bce74/iniherit-0.3.7.tar.gz" } ], "0.3.8": [ { "comment_text": "", "digests": { "md5": "e038d30b1947d452615d1cc91a774753", "sha256": "27d3fbc379714ba86b11ae0751c3601174a916a48389e810cd50890cdf4ad52a" }, "downloads": -1, "filename": "iniherit-0.3.8.tar.gz", "has_sig": false, "md5_digest": "e038d30b1947d452615d1cc91a774753", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17823, "upload_time": "2017-05-20T14:40:32", "url": "https://files.pythonhosted.org/packages/10/c1/25e281affe24b3a6d8cf841bdb3891308c2ea808f854831c67d9c6172d27/iniherit-0.3.8.tar.gz" } ], "0.3.9": [ { "comment_text": "", "digests": { "md5": "0e501d38a1ad7c9bde7bff9387d4a582", "sha256": "06d90849ff0c4fadb7e255ce31e7c8e188a99af90d761435c72b79b36adbb67a" }, "downloads": -1, "filename": "iniherit-0.3.9.tar.gz", "has_sig": false, "md5_digest": "0e501d38a1ad7c9bde7bff9387d4a582", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18355, "upload_time": "2017-05-20T20:27:12", "url": "https://files.pythonhosted.org/packages/65/a5/5bb95059c92c23560a80bcd599bc737a4175b275b3a577cb19f66bd302e3/iniherit-0.3.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0e501d38a1ad7c9bde7bff9387d4a582", "sha256": "06d90849ff0c4fadb7e255ce31e7c8e188a99af90d761435c72b79b36adbb67a" }, "downloads": -1, "filename": "iniherit-0.3.9.tar.gz", "has_sig": false, "md5_digest": "0e501d38a1ad7c9bde7bff9387d4a582", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18355, "upload_time": "2017-05-20T20:27:12", "url": "https://files.pythonhosted.org/packages/65/a5/5bb95059c92c23560a80bcd599bc737a4175b275b3a577cb19f66bd302e3/iniherit-0.3.9.tar.gz" } ] }