Skip to main content

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
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

get-settings-yaml-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

get_settings_yaml-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file get-settings-yaml-1.0.0.tar.gz.

File metadata

  • Download URL: get-settings-yaml-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for get-settings-yaml-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e62dbd1b441ee110d3bac59172962d99140f8aad8b2343073da32fe0024c566c
MD5 b58d41f254a2fd1f5a3c19a2d17fcfbf
BLAKE2b-256 cef9a3c7a187df0be696ac9a67bc4fbb82d2fa95bb577b8d89432677d4f6b348

See more details on using hashes here.

File details

Details for the file get_settings_yaml-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for get_settings_yaml-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f83e3bbd4269b54881277d33e6ed5fe330244169a69000c2b3b82842ec69ac47
MD5 dfd290c9dbe6ffc0f8c411efc8b3c21e
BLAKE2b-256 644fdc48bfd99b10b9625a250f9883e14344689e4cabd1dcb07a08dabe9e3345

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page