Mercurial > hgrepos > Python > libs > ConfigMix
diff doc/introduction.rst @ 97:1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Sun, 18 Mar 2018 19:15:01 +0100 |
| parents | 2b79ddc0f92b |
| children | aa0c61e79660 |
line wrap: on
line diff
--- a/doc/introduction.rst Sun Mar 18 19:13:35 2018 +0100 +++ b/doc/introduction.rst Sun Mar 18 19:15:01 2018 +0100 @@ -28,6 +28,12 @@ .. note:: All strings are returned as Unicode text strings. +An example is: + +.. literalinclude:: ../tests/data/conf10.yml + :language: yaml + + .. _ini-files: INI Files @@ -63,9 +69,20 @@ .. note:: Contrary to the behaviour of the standard Python :mod:`configparser` module the INI file reader is *case-sensitive*. -.. todo:: Implement tree-ish interpretation of INI files +.. todo:: Document the build of tree-ish configuration settings out of + INI files. + +The example INI style configuration below yields an equivalent +configuration to the YAML configuration above: - Currently there is no tree. +.. literalinclude:: ../tests/data/conf10.ini + :language: ini + +As can be seen in thie example -- INI file internal value interpolation +is done as in Python's standard :mod:`configparser` module. + +This example also illustrates how INI sections are used to build a +tree-ish configuration dictionary. .. _executable-python-scripts: @@ -90,3 +107,9 @@ .. note:: The Python configuration files are evaluated with ``exec`` and not imported. + +The example configuration by Python script below yields an equivalent +configuration to the YAML configuration above: + +.. literalinclude:: ../tests/data/conf10.py + :language: python
