Find and load settings.yaml data into your project
Project description
get-settings-yaml
Small module for finding and parsing settings.yaml file in your project.
Setup
python -m pip install get-settings-yaml
API
Assuming the project structure:
- myproject/
- src/
- run.py
- src/
- my_settings.yaml
If you want to load my_settings.yaml
from run.py
script you should use this code inside:
import os
from get_settings_yaml import parse_settings
CURRENT_WORKING_DIR = os.path.dirname(__file__)
SETTINGS_FNAME = 'my_settings.yaml'
SETTINGS = parse_settings(base_path=CURRENT_WORKING_DIR, settings_filename=SETTINGS_FNAME)
if __name__ == '__main__':
# Do something and use parsed settings
pass
If you want to check path to the settings file:
import os
from get_settings_yaml import load_path
CURRENT_WORKING_DIR = os.path.dirname(__file__)
SETTINGS_FNAME = 'my_settings.yaml'
SETTINGS_PATH = load_path(base_path=CURRENT_WORKING_DIR, settings_filename=SETTINGS_FNAME)
if __name__ == '__main__':
# Do something and load settings later
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for get_settings_yaml-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f83e3bbd4269b54881277d33e6ed5fe330244169a69000c2b3b82842ec69ac47 |
|
MD5 | dfd290c9dbe6ffc0f8c411efc8b3c21e |
|
BLAKE2b-256 | 644fdc48bfd99b10b9625a250f9883e14344689e4cabd1dcb07a08dabe9e3345 |