Skip to main content

Load and save config files for python projects

Project description

autoyaml because config should be easy

Autoconfig is a config generator that takes a dictionary, writes it to a file and loads it back as a dictionary.

The aim of this project is to standardise the way python projects create and feed parameters into python applications without having to rewrite the same IO functions every time.

Installation

git clone git@github.com:martyni/autoyaml.git
cd autoyaml
pip install .

Usage

Write your config either from an interactive terminal or from a script

from autoyaml import write_config

conf = {
   'parameter1': 1,
   'parameter2': 'something'
}

application_name = 'app_name'

write_config(conf,application_name)

Load your config from another python application

from autoyaml import load_config

class My_Class(object):
   def __init__(self, **kwargs):
      self.parameter1 = kwargs['parameter1']
      self.parameter2 = kwargs['parameter2']
      self.show_parameters()

   def show_parameters(self):
      print('parameter1 : {}'.format(self.parameter1))
      print('parameter2 : {}'.format(self.parameter2))


if __name__ == "__main__":
   my_class = My_Class(**load_config('app_name'))

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

autoyaml-2019.9.20.1235.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file autoyaml-2019.9.20.1235.tar.gz.

File metadata

  • Download URL: autoyaml-2019.9.20.1235.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for autoyaml-2019.9.20.1235.tar.gz
Algorithm Hash digest
SHA256 58e880c6a686df93604ac43018f9c27ad4f63150ed80cb237775629cad4bf140
MD5 76b84a098e1805bfccd95d5356a85134
BLAKE2b-256 0ddb8a769ed0870eee20db59ea44580a9eafd82d3adac943d47ba04148b7ebb8

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