Skip to main content

CnfRM - ORM for config

Project description

CnfRM

Imagine: an ORM for config

This library lets you declare your config in a way you might know from popular ORM's.

You get

  • expressive configuration declaration
  • popular fileformats (json, yml?)
  • command line options
  • env configuration variables
import cnfrm


class MyConf(cnfrm.Config):
    name = cnfrm.Field("no name")
    size = cnfrm.IntegerField(required=False)
    path = cnfrm.DirectoryField(required=False)
    email = cnfrm.EmailField(required=False)
    filename = cnfrm.FileField()


# create a config instance
config = MyConf()

# start reading things, the later overwrites the former
config.read_env()
config.read_json("~/myconf.json", quiet=True)
config.read_args()

# check if the configuration is complete
config.validate()

# write config to file:
config.write_json("~/myconf.json")

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

cnfrm-0.2.5.tar.gz (4.6 kB view hashes)

Uploaded Source

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