# Simplify how you read configuration files using PyYAML
[](https://codecov.io/gh/EM51641/PyYAMEL-object) [](https://github.com/psf/black) [](https://pypi.org/project/pyaml-object) [](https://pypi.org/project/pyaml-object) [](https://github.com/EM51641/PyYAMEL-object/actions/workflows/unit.yaml)
## Installation
The library is available on PyPI and can be installed using pip:
```bash
pip install pyaml-object
```
## Usage
Having a ```service.yaml``` file such:
```yaml
service:
version: 1.0.0
name: myservice
secret_key: XXXXXX
```
We can read the config file through the Config API by applying the read method.
```python
from pyyaml_object import Config
conf_manager = Config('service.yaml')
conf = conf_manager.read()
```
Now we have a ```conf``` object that embedes every key and value from our yaml file. For instance, we can reconstitute a constant ```SETTING``` variable such:
```python
SETTINGS = {
'VERSION': conf.service.version,
'NAME': conf.service.name,
'SECRET_KEY': conf.service.secret_key
}
print(SETTINGS)
#{'VERSION': '1.0.0', 'NAME': 'myservice', 'SECRET_KEY': 'XXXXXX'}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/EM51641/PyYAMEL-object/tree/main",
"name": "pyaml-object",
"maintainer": "Elyes",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "elyesmahjoubi@gmail.com",
"keywords": "",
"author": "Elyes",
"author_email": "elyesmahjoubi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c7/53/dc961351b9d3278e6b504a731141dc3c5ccead16f35fc98e32957a082324/pyaml_object-2.0.1.post0.tar.gz",
"platform": null,
"description": "# Simplify how you read configuration files using PyYAML\n[](https://codecov.io/gh/EM51641/PyYAMEL-object) [](https://github.com/psf/black) [](https://pypi.org/project/pyaml-object) [](https://pypi.org/project/pyaml-object) [](https://github.com/EM51641/PyYAMEL-object/actions/workflows/unit.yaml)\n\n## Installation\n\nThe library is available on PyPI and can be installed using pip:\n\n```bash\npip install pyaml-object\n```\n\n## Usage\n\nHaving a ```service.yaml``` file such:\n```yaml\nservice:\n version: 1.0.0\n name: myservice\n secret_key: XXXXXX\n```\n\nWe can read the config file through the Config API by applying the read method.\n\n```python\nfrom pyyaml_object import Config\nconf_manager = Config('service.yaml')\nconf = conf_manager.read()\n```\n\nNow we have a ```conf``` object that embedes every key and value from our yaml file. For instance, we can reconstitute a constant ```SETTING``` variable such:\n\n```python\nSETTINGS = {\n 'VERSION': conf.service.version,\n 'NAME': conf.service.name,\n 'SECRET_KEY': conf.service.secret_key\n}\n\nprint(SETTINGS)\n#{'VERSION': '1.0.0', 'NAME': 'myservice', 'SECRET_KEY': 'XXXXXX'}\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": "Read your YAML files easily",
"version": "2.0.1.post0",
"project_urls": {
"Homepage": "https://github.com/EM51641/PyYAMEL-object/tree/main",
"Repository": "https://github.com/EM51641/PyYAMEL-object/tree/main"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9917d2b1b8a5760a95848c11539cb16cefe4eaea295168e7cd677da7a07e6bec",
"md5": "4f8f4bceb1bd12970952565401c916b0",
"sha256": "dbf9b2187f6dc756f924122eb004f9632756086d805248a080c85f682078d467"
},
"downloads": -1,
"filename": "pyaml_object-2.0.1.post0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4f8f4bceb1bd12970952565401c916b0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 4964,
"upload_time": "2023-09-07T12:31:19",
"upload_time_iso_8601": "2023-09-07T12:31:19.447904Z",
"url": "https://files.pythonhosted.org/packages/99/17/d2b1b8a5760a95848c11539cb16cefe4eaea295168e7cd677da7a07e6bec/pyaml_object-2.0.1.post0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c753dc961351b9d3278e6b504a731141dc3c5ccead16f35fc98e32957a082324",
"md5": "19c3690e3cc37b912cd205034c8c499c",
"sha256": "13d01acccb3e9fd95c1660c11f7814e6e7cb9d683c90b3941e1b4386938cfddc"
},
"downloads": -1,
"filename": "pyaml_object-2.0.1.post0.tar.gz",
"has_sig": false,
"md5_digest": "19c3690e3cc37b912cd205034c8c499c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 4036,
"upload_time": "2023-09-07T12:31:20",
"upload_time_iso_8601": "2023-09-07T12:31:20.789956Z",
"url": "https://files.pythonhosted.org/packages/c7/53/dc961351b9d3278e6b504a731141dc3c5ccead16f35fc98e32957a082324/pyaml_object-2.0.1.post0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-07 12:31:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "EM51641",
"github_project": "PyYAMEL-object",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pyaml-object"
}