Metadata-Version: 2.2
Name: oop_config
Version: 0.1
Summary: An object orianted config module that implements json files with structured objects to manage setting files
Author-email: Sulaiman Al Qusaimi <suleiman.alqusaimi@gmail.com>
Project-URL: project_repo, https://github.com/sulaiman-alqusaimi/oop_config
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# oop_config
This module's intend is to simplify the process of creating and managing config files by implementing json files with structured object call to get or set configuration items.
# How it works?
First,, you import the Config class, which is the only class to be actually used.
from config import Config

then you just create one config object, passing the path of the settings file to be loaded or created, along with an optional parameter to pass a dictionary for default settings

if the default dictionary is passed, all its keys will be used as class properties to access and edit those configurations directly.
if the default dictionary contained nested dictionaries, all those sub dictionaries will be converted into sections and will be accessed directly like this
config.section1.item1 = "newvalue"

There are helper methods to add individual setting items or sections to the base config object and sections. Use:
config.add_setting(name, value) to add individual settings, or
config.add_section(section_name, optional_default_settings) to add full section
the same is applyed to sections. use
config.section.add_setting to add individual settings into sections, and config.section.add_section to nest another section into that section



## example

from oop_config import Config

config = Config("settings.json", {"debug": True})
print(config.debug)
config.debug = False
print(config.debug)
config.add_setting("path", "default")
config.path = "documents"
config.add_section("keyboard")
config.keyboard.add_setting("delay", 5)
config.keyboard.add_section("hotkeys")
config.keyboard.hotkeys.add_setting("exit", "esc")
config.keyboard.hotkeys.exit = "alt+f4"
