Metadata-Version: 2.1
Name: configjy
Version: 0.1.0
Summary: Loads a json or yaml config file
Author: henrique lino
Author-email: henrique.lino97@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Dist: ruamel.yaml (>=0.17.21,<0.18.0)
Description-Content-Type: text/markdown

# configjy

> Loads variables from a .json, .yaml or .yml file

[![PyPI version][pypi-image]][pypi-url]
[![Build status][build-image]][build-url]
[![GitHub stars][stars-image]][stars-url]
[![Support Python versions][versions-image]][versions-url]



## Getting started

You can [get `configjy` from PyPI](https://pypi.org/project/configjy),
which means it's easily installable with `pip`:

```bash
python -m pip install configjy
```


## Example usage

```python

from src.configjy import ConfigFile

# given this file:
"""
{
    "key1": 10,
    "key2": {
        "key3": 20
    },
    "key4": "{{key1}}"
}
"""

        
fvar = ConfigFile(config_file_path)
key1 = fvar.get('key1')
print(key1) # 10

key2 = fvar.get('key2')
print(key2) # {"key3": 20}

key3 = fvar.get('key2.key3')
print(key3) # 20

key4 = fvar.get('key4')
print(key4) # str(key1) = "10"

key5 = fvar.get('key5', default=1, print_when_not_exists=False)
print(key5) # 1

try:
    key6 = fvar.get('key6', raise_when_not_exists=True) # raises key error
except KeyError:
    pass

key6 = fvar.get('key6') # print a warning abou non existent key
print(key6) # None


```



## Changelog

Refer to the [CHANGELOG.md](https://github.com/henriquelino/configjy/blob/main/CHANGELOG.md) file.



<!-- Badges -->

[pypi-image]: https://img.shields.io/pypi/v/configjy
[pypi-url]: https://pypi.org/project/configjy/

[build-image]: https://github.com/henriquelino/configjy/actions/workflows/build.yaml/badge.svg
[build-url]: https://github.com/henriquelino/configjy/actions/workflows/build.yaml

[stars-image]: https://img.shields.io/github/stars/henriquelino/configjy
[stars-url]: https://github.com/henriquelino/configjy

[versions-image]: https://img.shields.io/pypi/pyversions/configjy
[versions-url]: https://pypi.org/project/configjy/


