Metadata-Version: 2.4
Name: cfg-mgr
Version: 0.2.0
Summary: Simple out-of-box configs
Author-email: Raghav Jindal <raghavjindal1998@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Raghav Jindal
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/raghavj98/cfgmgr
Keywords: config,cfg,config file
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: python-lsp-server; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: license-file

# cfgmgr
Simple out of the box configurations for python projects

## Basic usage
```python3

import cfgmgr

cfgmgr.make_config(env_prefix="CFG_", file_path="config.json", find_file=True)
some_val = cfgmgr.get('key')
cfgmgr.set('key', 'new_val')
```

### `make_config`
- Initializes a global `Config` as per args specified
- Pass in `env_prefix` to read values from environment variables
    - `env_prefix` will be prefixed to the keys before reading the environment variable
    - Ex. `env_prefix="CFG_"` will effectively translate `cfgmgr.get('foo')` to `os.getenv('CFG_foo')`
- Values are resolved dynamically, so `cfgmgr.get` will respect environment variables set via `os.environ` (Useful in test cases)
- `file_path` attempts to resolve the extension and defers to the corresponding loader
    - JSON support is present. TOML, YAML and dotenv are planned.
    - Custom Loaders can be implemented and registered via a decorator `cfgmgr.fileloaders.register('.extension')`
- `find_file`, if `True`, will crawl upwards from `cwd` until it finds a match for `file_path`

### `get` and `set`
- Getter and Setter for the global default `Config` object
- `raise AttributeError` if `make_config` has not been called prior to a `get`/`set` call
