> For the complete documentation index, see [llms.txt](https://docs.macilib.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.macilib.org/docs/ini/functions/maci.inibuildauto.md).

# maci.inibuildauto

Auto builds a [ConfigParser](https://docs.python.org/3/library/configparser.html) object from a dictionary with a correct section and key/value structure.

{% hint style="info" %}
maci.inibuildauto  ->  [ConfigParser](https://docs.python.org/3/library/configparser.html)
{% endhint %}

*Example auto building ConfigParser data with sections and key/values*

```python
data_to_build = {'section1': {'key1': 1}, 'section2': {'key2': 2}}

data = maci.inibuildauto(data_to_build)
```

In this example, we created a simple dictionary representing sections with key names and their values and assigned the data to a variable, then passed the dict data as an argument to the inibuildauto function to build the ini data and assign the returned data to a variable.

#### dictionary structure

As shown in the example above, in order to auto-build the ini data for your [ConfigParser](https://docs.python.org/3/library/configparser.html) object, your dictionary must follow a specific structure. The structure is as follows:

* All top level key names in dict are sections
* All values of each section must contain a dict with key/value pairs

*Example structure unpacked*

```python
{ 
    'section1': {
        'key1': 'value1'
    },
    'section2': {
        'key2': 'value2'
    }
}
```

Values can be anything, but when they are [dumped](/docs/ini/functions/maci.inidump.md) to a file and loaded back in, they will be loaded as a string type in their string representation (See [iniload](/docs/ini/functions/maci.iniload.md))

Note: If your sub-value contains a NoneType, this function will auto-convert that to a string representation for you as the underlying library does not support None.\
\
\
More information on using ConfigParser data:\
Youtube Video Search: <https://www.youtube.com/results?search_query=python+configparser>\
Documentation: <https://docs.python.org/3/library/configparser.html>

### parameters & arguments

Describes all parameter functionality and accepted data types

<details>

<summary>data:  dict[str, dict[str, Any]]</summary>

First and only required positional argument. Accepts dictionaries

Use this parameter to pass in the data you want to build out the [ConfigParser](https://docs.python.org/3/library/configparser.html) object.

</details>

*This function uses the native configparser library shipped with the python standard library for its underlying functionality. For more information on the configparser library, visit:*[ *https://docs.python.org/3/library/configparser.html*](https://docs.python.org/3/library/configparser.html)
