Metadata-Version: 2.1
Name: staticconfig
Version: 0.0.2
Summary: Json config files with a statically defined structure.
Home-page: https://github.com/gammelalf/staticconfig
Author: Wolfgang Fischer
Author-email: 31348226+gammelalf@users.noreply.github.com
License: UNKNOWN
Description: # staticconfig
        
        Json config files with a staticly defined structure.
        
        This is common code which I used accross many projects.
        
        ## Usage
        
        A config file's structure is defined by subclassing `Config` and filling the constructor with attribute assignments.
        
        Then a file is loaded with the `from_json` classmethod:
        
        - If the file exists, it returns an instance of the config class.
        - If the file does not exist, it creates one and raises a ConfigError.
        
        The class `Namespace` provides syntactic sugar around dicts.
        
        ### Example
        
        ```python
        from staticconfig import Namespace, Config
        
        
        class MyConfig(Config):
        
          def __init__(self):
            super().__init__()
            
            self.option1 = "default1"
            self.option2 = 0
            self.option3 = Namespace()
            self.option3.suboption1 = True
            self.option3.suboption2 = ["en", "de"]
            
        
        # If the file doesn't exists this will create it with the default values and raise a ConfigError
        config = MyConfig.from_json("config.json")
        ```
        
        The produced config file:
        ```json
        {
          "option1": "default1",
          "option2": 0,
          "option3": {
            "suboption1": true,
            "suboption2": [
              "en",
              "de"
            ]
          }
        }
        ```
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.5
Description-Content-Type: text/markdown
