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
Metadata
Release files for get-settings-yaml 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| get-settings-yaml-1.0.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| get_settings_yaml-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 kB
Release files / get-settings-yaml-1.0.0.tar.gz
| Download URL | get-settings-yaml-1.0.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e62dbd1b441ee110d3bac59172962d99140f8aad8b2343073da32fe0024c566c
|
|
BLAKE2b-256 checksum How to use checksums |
cef9a3c7a187df0be696ac9a67bc4fbb82d2fa95bb577b8d89432677d4f6b348
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / get_settings_yaml-1.0.0-py3-none-any.whl
| Download URL | get_settings_yaml-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f83e3bbd4269b54881277d33e6ed5fe330244169a69000c2b3b82842ec69ac47
|
|
BLAKE2b-256 checksum How to use checksums |
644fdc48bfd99b10b9625a250f9883e14344689e4cabd1dcb07a08dabe9e3345
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|