<!-- Would be good to find a badge for this -->
<!-- [PyPi][6] -->
ActiveConfigParser
==================
The ActiveConfigParser package provides extended
handling of .ini files beyond what [ConfigParser][1] provides
by adding an active syntax to embed operations with options.
For example, a *standard* `.ini` file is generally formatted like this:
```ini
[Section 1]
Foo: Bar
Baz: Bif
[Section 2]
Foo: Bar2
Bif: Baz
```
These files are used to organize sets of key - value pairs called
“options” within groups called “sections”. In the example above
there are two sections, “Section 1” and “Section 2”. Each of them
contains two options where Section 1 has the keys ‘Foo’ and ‘Baz’
which are assigned the values ‘Bar’ and ‘Bif’, respectively. For
more details on .ini files please see the documentation for
ConfigParser.
Internally, these handlers methods defined according to a naming
convention like `handler_<operation>()`.
ActiveConfigParser only provides one pre-defined operation: use which is
formatted as `use TARGET:` where *param1* is the TARGET (there is no value
field for this one). The TARGET paramter takes the *name of a target section*
that will be loaded in at this point. This works in the same way a
`#include` would work in C++ and serves to insert the contents or processing
of the target section into this location.
The `use` operation is useful for .ini files for complex systems by allowing
developers to create a common section and then have specializations where
they can customize options for a given project. For example:
```ini
[COMMON]
Key C1: Value C1
Key C2: Value C2
Key C3: Value C3
[Data 1]
Key D1: Value D1
use COMMON
Key D2: Value D2
```
In this example, processing section `Data 1` via ActiveConfigParser
will result in the following options: `Key D1: Value D1`, `Key C1: Value C1`,
`Key C2: Value C2`, `Key C2: Value C2`, `Key D2: Value D2`.
An alternative way of looking at this is it’s like having a .ini file that
is effectively the following where the `use` operations are replaced with the
results of a Depth-First expansion of the linked sections:
```ini
[COMMON]
Key C1: Value C1
Key C2: Value C2
Key C3: Value C3
[Data 1]
Key D1: Value D1
Key C1: Value C1
Key C2: Value C2
Key C3: Value C3
Key D2: Value D2
```
Linked Projects
---------------
- [SetProgramOptions][3] - depends on ActiveConfigParser [RTD][4], [GitHub][5]
Examples
--------
Here we show some example usages of ActiveConfigParser.
Additional examples can be found in the [`examples/`](examples) directory
of the repository.
### Example 1
```ini
[SECTION-A]
key-A1: value-A1
key-A2: value-A2
key-A3: value-A3
[SECTION-B]
use SECTION-A
key-B1: value-B1
```
In this example, the entry `use SECTION-A` that is inside `[SECTION-B]` instructs the core
parser to recurse into `[SECTION-A]` and process it before moving on with the rest of the
entries in `[SECTION-B]`. In this example the following code could be used to parse
`SECTION-B`.
`ActiveConfigParser.activeconfigparserdata['SECTION-B']` would return the following
result:
```python
>>> from activeconfigparser import ActiveConfigParser
>>> cpe = ActiveConfigParser(filename='config.ini')
>>> cpe.activeconfigparserdata['SECTION-B']
{
'key-A1': 'value-A1',
'key-A2': 'value-A2',
'key-A3': 'value-A3',
'key-B1': 'value-B1',
}
```
Updates
=======
See the [CHANGELOG](CHANGELOG) for information on changes.
[1]: https://docs.python.org/3/library/configparser.html
[3]: https://pypi.org/project/setprogramoptions/
[4]: https://setprogramoptions.readthedocs.io/en/latest
[5]: https://github.com/sandialabs/SetProgramOptions
[6]: https://pypi.org/project/activeconfigprogramoptions/
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/semantik-software/code/python/ActiveConfigParser",
"name": "activeconfigparser",
"maintainer": "William",
"docs_url": null,
"requires_python": ">=3.6,<4.0",
"maintainer_email": "Semantik-Codeworks@outlook.com",
"keywords": "Utility,Bash,Configuration,ActiveConfigParser,ConfigParser",
"author": "William",
"author_email": "Semantik-Codeworks@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/bb/06/c3f51c6ea24c2bab1c08414a2cedd63c149fdfeada9882352136afb39665/activeconfigparser-0.9.1.1.tar.gz",
"platform": null,
"description": "<!-- Would be good to find a badge for this -->\n<!-- [PyPi][6] -->\n\nActiveConfigParser\n==================\nThe ActiveConfigParser package provides extended\nhandling of .ini files beyond what [ConfigParser][1] provides\nby adding an active syntax to embed operations with options.\n\nFor example, a *standard* `.ini` file is generally formatted like this:\n\n```ini\n[Section 1]\nFoo: Bar\nBaz: Bif\n\n[Section 2]\nFoo: Bar2\nBif: Baz\n```\n\nThese files are used to organize sets of key - value pairs called\n\u201coptions\u201d within groups called \u201csections\u201d. In the example above\nthere are two sections, \u201cSection 1\u201d and \u201cSection 2\u201d. Each of them\ncontains two options where Section 1 has the keys \u2018Foo\u2019 and \u2018Baz\u2019\nwhich are assigned the values \u2018Bar\u2019 and \u2018Bif\u2019, respectively. For\nmore details on .ini files please see the documentation for\nConfigParser.\n\nInternally, these handlers methods defined according to a naming\nconvention like `handler_<operation>()`.\n\nActiveConfigParser only provides one pre-defined operation: use which is\nformatted as `use TARGET:` where *param1* is the TARGET (there is no value\nfield for this one). The TARGET paramter takes the *name of a target section*\nthat will be loaded in at this point. This works in the same way a\n`#include` would work in C++ and serves to insert the contents or processing\nof the target section into this location.\n\nThe `use` operation is useful for .ini files for complex systems by allowing\ndevelopers to create a common section and then have specializations where\nthey can customize options for a given project. For example:\n\n```ini\n[COMMON]\nKey C1: Value C1\nKey C2: Value C2\nKey C3: Value C3\n\n[Data 1]\nKey D1: Value D1\nuse COMMON\nKey D2: Value D2\n```\n\nIn this example, processing section `Data 1` via ActiveConfigParser\nwill result in the following options: `Key D1: Value D1`, `Key C1: Value C1`,\n`Key C2: Value C2`, `Key C2: Value C2`, `Key D2: Value D2`.\n\nAn alternative way of looking at this is it\u2019s like having a .ini file that\nis effectively the following where the `use` operations are replaced with the\nresults of a Depth-First expansion of the linked sections:\n\n```ini\n[COMMON]\nKey C1: Value C1\nKey C2: Value C2\nKey C3: Value C3\n\n[Data 1]\nKey D1: Value D1\nKey C1: Value C1\nKey C2: Value C2\nKey C3: Value C3\nKey D2: Value D2\n```\n\nLinked Projects\n---------------\n- [SetProgramOptions][3] - depends on ActiveConfigParser [RTD][4], [GitHub][5]\n\nExamples\n--------\nHere we show some example usages of ActiveConfigParser.\nAdditional examples can be found in the [`examples/`](examples) directory\nof the repository.\n\n### Example 1\n\n```ini\n[SECTION-A]\nkey-A1: value-A1\nkey-A2: value-A2\nkey-A3: value-A3\n\n[SECTION-B]\nuse SECTION-A\nkey-B1: value-B1\n```\n\nIn this example, the entry `use SECTION-A` that is inside `[SECTION-B]` instructs the core\nparser to recurse into `[SECTION-A]` and process it before moving on with the rest of the\nentries in `[SECTION-B]`. In this example the following code could be used to parse\n`SECTION-B`.\n`ActiveConfigParser.activeconfigparserdata['SECTION-B']` would return the following\nresult:\n\n```python\n>>> from activeconfigparser import ActiveConfigParser\n>>> cpe = ActiveConfigParser(filename='config.ini')\n>>> cpe.activeconfigparserdata['SECTION-B']\n{\n 'key-A1': 'value-A1',\n 'key-A2': 'value-A2',\n 'key-A3': 'value-A3',\n 'key-B1': 'value-B1',\n}\n```\n\nUpdates\n=======\nSee the [CHANGELOG](CHANGELOG) for information on changes.\n\n\n[1]: https://docs.python.org/3/library/configparser.html\n[3]: https://pypi.org/project/setprogramoptions/\n[4]: https://setprogramoptions.readthedocs.io/en/latest\n[5]: https://github.com/sandialabs/SetProgramOptions\n[6]: https://pypi.org/project/activeconfigprogramoptions/\n\n\n",
"bugtrack_url": null,
"license": "LICENSE",
"summary": "A tool that extends configparser to enable enhanced processing of .ini files.",
"version": "0.9.1.1",
"project_urls": {
"CI": "https://gitlab.com/semantik-software/code/python/ActiveConfigParser/-/pipelines",
"Documentation": "https://semantik-software.gitlab.io/code/python/ActiveConfigParser/",
"Homepage": "https://gitlab.com/semantik-software/code/python/ActiveConfigParser",
"Issues": "https://gitlab.com/semantik-software/code/python/ActiveConfigParser/-/issues",
"Repository": "https://gitlab.com/semantik-software/code/python/ActiveConfigParser"
},
"split_keywords": [
"utility",
"bash",
"configuration",
"activeconfigparser",
"configparser"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2a0a2094288bfb11f71bf57b9b2dded9a09c451b038f7799ccdd6d6dcabc4be7",
"md5": "26ecff5c972f890a49ad8c01f5fbcf17",
"sha256": "d6fcb73d1c6452d392004b75099bc424a62c126f812de2f02df4ccbd906792fc"
},
"downloads": -1,
"filename": "activeconfigparser-0.9.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "26ecff5c972f890a49ad8c01f5fbcf17",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6,<4.0",
"size": 56197,
"upload_time": "2023-08-29T13:41:41",
"upload_time_iso_8601": "2023-08-29T13:41:41.118858Z",
"url": "https://files.pythonhosted.org/packages/2a/0a/2094288bfb11f71bf57b9b2dded9a09c451b038f7799ccdd6d6dcabc4be7/activeconfigparser-0.9.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb06c3f51c6ea24c2bab1c08414a2cedd63c149fdfeada9882352136afb39665",
"md5": "791413974c37060f17c26fa3afab3b9b",
"sha256": "572c7522811b354671f83e0b577c01080a9b36f0ad17e156f20e1d864896b436"
},
"downloads": -1,
"filename": "activeconfigparser-0.9.1.1.tar.gz",
"has_sig": false,
"md5_digest": "791413974c37060f17c26fa3afab3b9b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6,<4.0",
"size": 47325,
"upload_time": "2023-08-29T13:41:43",
"upload_time_iso_8601": "2023-08-29T13:41:43.388450Z",
"url": "https://files.pythonhosted.org/packages/bb/06/c3f51c6ea24c2bab1c08414a2cedd63c149fdfeada9882352136afb39665/activeconfigparser-0.9.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-29 13:41:43",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "semantik-software",
"gitlab_project": "code",
"lcname": "activeconfigparser"
}