[](https://coveralls.io/github/simongarisch/pyyamlsettings?branch=master)
[](https://badge.fury.io/py/pyyamlsettings)
# pyyamlsettings
A Flyweight pattern for loading yaml files in Python.
## Installation
pyyamlsettings is python 2 and 3 compatible.
```bash
pip install pyyamlsettings
```
## Overview
There is a YamlSettings class exposed by the package that allows you to load and query yaml files.
Suppose we have a yaml file with the structure:
```
att1: 42
att2: "This is a string"
level1:
a: 1
b: 2
level2:
a: 3
b: 4
```
We can load this file:
```python
import os
import pyyamlsettings
yaml_file_path = os.path.join("tests", "test_yaml_file.yaml")
settings = pyyamlsettings.YamlSettings(yaml_file_path)
```
And read particular items with:
```python
result = settings.get_data("att1")
print(result) # 42
result = settings.get_data("level1", "level2", "b")
print(result) # 4
```
## Notes
Due to a [deprecation message](https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation) yaml.load was modified slightly.
```python
yaml.load(input, Loader=yaml.FullLoader)
```
Users may have [issues installing PyYAML](https://stackoverflow.com/questions/49911550/how-to-upgrade-disutils-package-pyyaml) as a dependency with the error message:
```bash
Cannot uninstall 'PyYAML'. It is a distutils installed project and ...
```
One way around this is to run:
```bash
pip install --ignore-installed PyYAML
```
Metadata
Release files for pyyamlsettings 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyyamlsettings-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for pyyamlsettings-0.0.4-py3-none-any.whl |
| pyyamlsettings-0.0.4-py2-none-any.whl | Python 2 | none | any | Details for pyyamlsettings-0.0.4-py2-none-any.whl |
Total release size: 14.7 kB
Release files / pyyamlsettings-0.0.4-py3-none-any.whl
| Download URL | pyyamlsettings-0.0.4-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e66230a41c577c14baa1a4df7066a550ea4215a452dab17f7d62b7710c59192a
|
|
BLAKE2b-256 checksum How to use checksums |
2539872066a360789de950c1d8fd0361848aabb75516efff9d08b1d338145e3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
|
Release files / pyyamlsettings-0.0.4-py2-none-any.whl
| Download URL | pyyamlsettings-0.0.4-py2-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
e2043168b2923e4fc6f78708fc8e490cfcbdb84573a67d7c16e4189fca3b1070
|
|
BLAKE2b-256 checksum How to use checksums |
e9aa015dd611e12c6c6d0241cb6f6eb7fee23ded46ed6bb3a21bdc0525116a5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15
|
Security for pyyamlsettings 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.