Metadata-Version: 2.1
Name: xdgconfig
Version: 0.0.4
Summary: Easy access to `~/.config`
Home-page: https://github.com/dogeek/xdgconfig
Author: Dogeek
Author-email: dogeek@users-noreply.github.com
License: MIT
Download-URL: https://github.com/dogeek/xdgconfig/releases
Description: # XDGConfig
        
        Easy access to `~/.config`.
        
        
        ## Usage
        
        ```python
        from xdgconfig import JsonConfig
        
        # Instanciate the JsonConfig object
        # If you'd rather use a different format, there also are config classes
        # for TOML, YAML, INI (configparser), and XML.
        # This will save your configuration under `~/.config/PROG/config
        config = JsonConfig('PROG', autosave=True)
        
        config['foo'] = 'bar'  # Save a value to the config
        
        # Access the value later on
        print(config['foo'])
        
        # It behaves like a collections.defaultdict as well
        config['oof']['bar'] = 'baz'
        
        # Prints {'oof': {'bar': 'baz'}, 'foo': 'bar'}
        print(config)
        
        ```
        
        ### Custom serializers
        
        You can add custom serializers support by using a Mixin class, as well as
        a serializer class which must have a `dumps` and a `loads` method, which will
        be used to store and load data from the config file. The data is always
        represented as a python `dict` object, but you can serialize any data you want
        inside of it.
        
        Look at the following example for an implementation guide.
        
        ```python
        from typing import Any, Dict
        
        from xdgconfig import Config
        
        
        class MySerializer:
            def dumps(data: Dict[str, Any]) -> str:
                return '\n'.join(f'{k}:{v}' for k, v in data.items())
        
            def loads(contents: str) -> Dict[str, Any]:
                return dict(s.split(':') for s in contents.split('\n'))
        
        
        class MySerializerMixin:
            SERIALIZER = MySerializer
        
        
        class MyConfig(MySerializerMixin, Config):
            ...
        
        ```
Keywords: configuration,python3
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: jsonc
Provides-Extra: toml
Provides-Extra: yaml
Provides-Extra: xml
Provides-Extra: jsonc+toml
Provides-Extra: jsonc+yaml
Provides-Extra: jsonc+xml
Provides-Extra: toml+jsonc
Provides-Extra: toml+yaml
Provides-Extra: toml+xml
Provides-Extra: yaml+jsonc
Provides-Extra: yaml+toml
Provides-Extra: yaml+xml
Provides-Extra: xml+jsonc
Provides-Extra: xml+toml
Provides-Extra: xml+yaml
Provides-Extra: jsonc+toml+yaml
Provides-Extra: jsonc+toml+xml
Provides-Extra: jsonc+yaml+toml
Provides-Extra: jsonc+yaml+xml
Provides-Extra: jsonc+xml+toml
Provides-Extra: jsonc+xml+yaml
Provides-Extra: toml+jsonc+yaml
Provides-Extra: toml+jsonc+xml
Provides-Extra: toml+yaml+jsonc
Provides-Extra: toml+yaml+xml
Provides-Extra: toml+xml+jsonc
Provides-Extra: toml+xml+yaml
Provides-Extra: yaml+jsonc+toml
Provides-Extra: yaml+jsonc+xml
Provides-Extra: yaml+toml+jsonc
Provides-Extra: yaml+toml+xml
Provides-Extra: yaml+xml+jsonc
Provides-Extra: yaml+xml+toml
Provides-Extra: xml+jsonc+toml
Provides-Extra: xml+jsonc+yaml
Provides-Extra: xml+toml+jsonc
Provides-Extra: xml+toml+yaml
Provides-Extra: xml+yaml+jsonc
Provides-Extra: xml+yaml+toml
Provides-Extra: jsonc+toml+yaml+xml
Provides-Extra: jsonc+toml+xml+yaml
Provides-Extra: jsonc+yaml+toml+xml
Provides-Extra: jsonc+yaml+xml+toml
Provides-Extra: jsonc+xml+toml+yaml
Provides-Extra: jsonc+xml+yaml+toml
Provides-Extra: toml+jsonc+yaml+xml
Provides-Extra: toml+jsonc+xml+yaml
Provides-Extra: toml+yaml+jsonc+xml
Provides-Extra: toml+yaml+xml+jsonc
Provides-Extra: toml+xml+jsonc+yaml
Provides-Extra: toml+xml+yaml+jsonc
Provides-Extra: yaml+jsonc+toml+xml
Provides-Extra: yaml+jsonc+xml+toml
Provides-Extra: yaml+toml+jsonc+xml
Provides-Extra: yaml+toml+xml+jsonc
Provides-Extra: yaml+xml+jsonc+toml
Provides-Extra: yaml+xml+toml+jsonc
Provides-Extra: xml+jsonc+toml+yaml
Provides-Extra: xml+jsonc+yaml+toml
Provides-Extra: xml+toml+jsonc+yaml
Provides-Extra: xml+toml+yaml+jsonc
Provides-Extra: xml+yaml+jsonc+toml
Provides-Extra: xml+yaml+toml+jsonc
Provides-Extra: all
