Metadata-Version: 2.4
Name: inihelper
Version: 0.1.0
Summary: An INI parser that preserves comments, supports custom 'separator' (=) 'rules' and comment styles, incl (wip) multiline.
Author-email: "Simon Arjuna Erat (sri-arjuna)" <erat.simon@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/sri-arjuna/python-ini
Project-URL: Bug Reports, https://github.com/sri-arjuna/python-ini/issues
Project-URL: Source, https://github.com/sri-arjuna/python-ini
Keywords: ini,config,parser,comments
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# INI Comments
This is a ini-file handler that preserves comments.

For various projects of mine, I prefer to provide comments within an ini file for others to know their meanings, or other options.

While configParser is nice, it always removed any/all comments from the file, so this project solves that issue.


### Features:
- Supports: "#", ";" and "//" as line comments
- Preserve comments
- Handles "line comment" and "comments behind values"
- Custom "separator" (default: "=")
- Allows toggle between: "instant save" or "on purpose"
- May handle "lazy" (bStrict=False) ini files, that do not have any "[Section]"s (this is required for the saving, wether manual or automatic)
- Allows for fallback/non-existing config 


# Usage:
How to handle this class:

## Available commands:
- my_ini.export(args)
- my_ini.get(args)
- my_ini.get_simple(args)
- my_ini.list_sections()
- my_ini.list_variables(args)
- my_ini.load_data()
- my_ini.load_file()
- my_ini.save()
- my_ini.set(args)
- my_ini.set_simple(args)


### Import:
```python
import inicomments
```

### Initialize:
```python
my_ini = inicomments.handler("/path/to/file")
```

### Working with values:
```python
# Get value:
current_value = my_ini.get("SectionName", "VariableName")
print(current_value)

# Set Value:
my_ini.set("SectionName", "VariableName", "NewValue")
```

### Special Handling:
If you have ``bInstantSave=False`` you simply call: ``my_ini.save()`` at whatever point you want/need to save the file.



# Example File:
Here is an example of a - *very chaotic, but still work-able* - ini file:

```
# Most used comment
; But you can apply any comment style
// that fits your project

[section]
variable = some value
someting = with a comment // like this
ofCourse = this would ; work as well
sooooo = "would this ; if you" ; apply quotes

```
